Commit 0ec0d1d0 by luyt

feat:产品申请开通

1 parent a8434f56
import api from "~/utils/request/request";
const serverApi = {
getMerchantList: "scrm.api.busassistant.merchant.getMerchantListBySceneRemote", //根据场景值、服务商查询4s店
addCoProduct: "scrm.api.busassistant.merchant.addCoProduct", //申请合作产品
};
export const getMerchantListApi = (data) => {
return api.post(
{
method: serverApi.getMerchantList,
...data,
},
true
);
};
export const addCoProductApi = (data) => {
return api.post(
{
method: serverApi.addCoProduct,
...data,
},
true
);
};
// pages/apply/apply.js
const navStyle = 'background-color: transparent;'
import { IMG_URL } from '~/utils/constantData.js'
import applyApi from '~/api/applyApi/index'
import {getMerchantListApi,addCoProductApi} from '~/api/applyProd.js'
import { behavior as computedBehavior } from '~/utils/lib/miniprogram-computed'
import utils from '~/utils/util.js'
Page({
/**
......@@ -16,20 +17,17 @@ Page({
cooperativeStore:'',
storeShow: false,
actions: [
{
name: '选项1',
},
{
name: '选项2',
},
{
name: '选项3',
// subname: '描述信息',
// openType: 'share',
},
// {
// "merchantId": 0,
// "merchantName": "选项1"
// },
// {
// "merchantId": 1,
// "merchantName": "选项2"
// },
],
selectStoreItem:{}
selectStoreItem:{},
scene:'' //场景值
},
computed: {
selectStoreValue(data) {
......@@ -61,64 +59,93 @@ Page({
// 提交信息
applyFn() {
let { name } = this.data.carObj
console.log('name: ', name)
if (!name) {
let {prodName,selectStoreItem} = this.data
if (!prodName) {
wx.pro.showToast({
title: '请输入开店名称',
icon: 'error'
})
return
}
if(utils.isEmptyObj(selectStoreItem)){
wx.pro.showToast({
title: '请输入选择合作门店',
icon: 'error'
})
return
}
this.submitForm()
// console.log(123)
},
submitForm() {
let { carObj, clueId } = this.data
let { userInfo } = wx.$storage.get()
let MerchantInfo = userInfo.subLoginUser
let params = {
serviceMerchantId: MerchantInfo.merchantId,
serviceMerchantName: MerchantInfo.merchantName,
serviceMerchantPhone: MerchantInfo.phone,
merchantContact: carObj.contact,
phone: carObj.phone,
applyMerchantName: carObj.name,
carType: carObj.model,
baseCustomer: carObj.selNum,
clueId
async submitForm() {
let {prodName,selectStoreItem} = this.data
let userInfo = wx.$storage.get('userInfo')
let params = {
...selectStoreItem,
serviceMerchantId:userInfo.merchantId,
serviceMerchantName:userInfo.merchantName,
coProduct:prodName
}
// return wx.$api.showToast('申请成功')
applyApi
.merchantApply(params)
.then(result => {
console.log(result)
if (result) {
wx.$api.showToast('申请成功')
setTimeout(() => {
wx.$router.back(page => {
let node = page.selectComponent('#indexclue')
node && node.getClueInit()
})
}, 1000)
}
})
.catch(err => {})
let res = await addCoProductApi(params)
// console.log('res: ', res);
if(code == 0){
wx.$api.showToast('申请成功')
setTimeout(() => {
wx.$router.back(page => {
let node = page.selectComponent('#indexclue')
node && node.getClueInit()
})
}, 1000)
}
// // return wx.$api.showToast('申请成功')
// applyApi
// .merchantApply(params)
// .then(result => {
// console.log(result)
// if (result) {
// wx.$api.showToast('申请成功')
// setTimeout(() => {
// wx.$router.back(page => {
// let node = page.selectComponent('#indexclue')
// node && node.getClueInit()
// })
// }, 1000)
// }
// })
// .catch(err => {})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
onLoad(options) {
this.getMerchantListFn()
},
onRoute(params) {
// 线索id
// console.log('params: ', params.scene)
this.setData({
clueId: params
scene:params.scene
})
// console.log('params: ', params)
},
//获取门店
async getMerchantListFn(){
let {scene} = this.data
let params = {scene}
let {code,data} = await getMerchantListApi(params)
if(code== 0 && data.length != 0){
data = data.map(item=>item.name = item.merchantName )
this.setData({
actions:data
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
......
......@@ -154,7 +154,10 @@ Component({
// 开通
openPro() {
wx.$router.go("/packagesList/applyProd/pages/apply");
let obj = {
scene:3
}
wx.$router.go("/packagesList/applyProd/pages/apply",obj);
},
openBus() {
wx.$router.go("/packagesList/apply/pages/apply");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!