Commit a7cb7ed6 by chenwq

bug修复,按钮重复点击

1 parent 70bf3a79
...@@ -52,10 +52,21 @@ const getInviteCode = data => { ...@@ -52,10 +52,21 @@ const getInviteCode = data => {
) )
} }
// 查询商户详情
const getMerchantId = data => {
return api.post(
{
method: 'scrm.api.busassistant.merchant.getMerchantIdByMerchantNo',
...data
}
)
}
export default { export default {
getCustomerList, getCustomerList,
saveCustomer, saveCustomer,
updateCustomer, updateCustomer,
getEmployeeList, getEmployeeList,
getInviteCode getInviteCode,
getMerchantId
} }
\ No newline at end of file \ No newline at end of file
...@@ -24,6 +24,7 @@ Page({ ...@@ -24,6 +24,7 @@ Page({
serviceList: [], serviceList: [],
// 场景业务 // 场景业务
scenceList, scenceList,
isConfirm: false
}, },
getAllServiceList() { getAllServiceList() {
...@@ -90,7 +91,11 @@ Page({ ...@@ -90,7 +91,11 @@ Page({
handleConfirm() { handleConfirm() {
let { userInfo } = wx.$storage.get() let { userInfo } = wx.$storage.get()
let { apiNameObj, addOrEdit, formData } = this.data let { apiNameObj, addOrEdit, formData, isConfirm } = this.data
let _this = this
if (isConfirm) {
return true
}
formData.sceneList = this.dealScene() formData.sceneList = this.dealScene()
let validObj = wx.$util.checkRule(formData, constantData.formRule) let validObj = wx.$util.checkRule(formData, constantData.formRule)
if (validObj) { if (validObj) {
...@@ -111,6 +116,10 @@ Page({ ...@@ -111,6 +116,10 @@ Page({
confirmColor: '#3666FE', confirmColor: '#3666FE',
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
_this.setData({
isConfirm: true
})
wx.$api.showLoading('加载中...')
// 创建/编辑接口 // 创建/编辑接口
mineCustomerApi[apiNameObj[addOrEdit]]({ mineCustomerApi[apiNameObj[addOrEdit]]({
...formData, ...formData,
...@@ -134,6 +143,11 @@ Page({ ...@@ -134,6 +143,11 @@ Page({
} else { } else {
wx.$api.showToast(message) wx.$api.showToast(message)
} }
}).finally(() => {
_this.setData({
isConfirm: false
})
wx.hideLoading()
}) })
} }
} }
......
...@@ -15,6 +15,7 @@ Page({ ...@@ -15,6 +15,7 @@ Page({
// 邀请销售 // 邀请销售
isPopupShow: false, isPopupShow: false,
popupVal: '', popupVal: '',
inviteMerchantId: '',
// 提示 // 提示
isTipShow: false, isTipShow: false,
tipObj: { tipObj: {
...@@ -53,6 +54,18 @@ Page({ ...@@ -53,6 +54,18 @@ Page({
this.getList(true) this.getList(true)
}, },
getMerchantId() {
let { customerInfo } = this.data
let params = {
merchantNos: customerInfo.merchantId
}
mineCustomerApi.getMerchantId(params).then(res => {
this.setData({
inviteMerchantId: res ? res[0]?.id : ''
})
})
},
getList(isReset = false) { getList(isReset = false) {
let { customerInfo } = this.data let { customerInfo } = this.data
mineCustomerApi.getEmployeeList({ merchantId: customerInfo.merchantId }).then(res => { mineCustomerApi.getEmployeeList({ merchantId: customerInfo.merchantId }).then(res => {
...@@ -68,9 +81,9 @@ Page({ ...@@ -68,9 +81,9 @@ Page({
}) })
}, },
// 获取邀请二维码和链接
getInviteCode() { getInviteCode() {
let { userInfo } = wx.$storage.get() let { customerInfo, popupVal, inviteMerchantId } = this.data
let { customerInfo, popupVal } = this.data
let _this = this let _this = this
let sceneStr = '' let sceneStr = ''
let sceneToNum = { let sceneToNum = {
...@@ -79,6 +92,10 @@ Page({ ...@@ -79,6 +92,10 @@ Page({
'SC003': 2, 'SC003': 2,
'SC004': 3, 'SC004': 3,
} }
if (!inviteMerchantId) {
wx.$api.showToast('缺少商户号')
return true
}
if (!customerInfo.sceneList || !customerInfo.sceneList.length) { if (!customerInfo.sceneList || !customerInfo.sceneList.length) {
wx.$api.showToast('缺少场景值') wx.$api.showToast('缺少场景值')
return true return true
...@@ -88,7 +105,7 @@ Page({ ...@@ -88,7 +105,7 @@ Page({
sceneStr = sceneStr + (sceneStr ? (',' + sceneToNum[item]) : sceneToNum[item]) sceneStr = sceneStr + (sceneStr ? (',' + sceneToNum[item]) : sceneToNum[item])
}) })
let params = { let params = {
merchantId: userInfo.bussinessId, merchantId: inviteMerchantId,
staffLabel: sceneStr staffLabel: sceneStr
} }
mineCustomerApi.getInviteCode(params).then(res => { mineCustomerApi.getInviteCode(params).then(res => {
...@@ -129,6 +146,7 @@ Page({ ...@@ -129,6 +146,7 @@ Page({
} }
}) })
this.getList() this.getList()
this.getMerchantId()
return true return true
} }
wx.$router.getData(res => { wx.$router.getData(res => {
...@@ -136,6 +154,7 @@ Page({ ...@@ -136,6 +154,7 @@ Page({
customerInfo: res customerInfo: res
}) })
this.getList() this.getList()
this.getMerchantId()
}) })
}, },
......
...@@ -13,7 +13,8 @@ Page({ ...@@ -13,7 +13,8 @@ Page({
apiNameObj: { apiNameObj: {
'add': 'saveService', 'add': 'saveService',
'edit': 'updateService' 'edit': 'updateService'
} },
isConfirm: false
}, },
handleInput(e) { handleInput(e) {
...@@ -41,8 +42,11 @@ Page({ ...@@ -41,8 +42,11 @@ Page({
handleConfirm() { handleConfirm() {
let { userInfo } = wx.$storage.get() let { userInfo } = wx.$storage.get()
let { apiNameObj, addOrEdit, formData } = this.data let { apiNameObj, addOrEdit, formData, isConfirm } = this.data
let _this = this let _this = this
if (isConfirm) {
return true
}
let validObj = wx.$util.checkRule(formData, constantData.formRule) let validObj = wx.$util.checkRule(formData, constantData.formRule)
if (validObj) { if (validObj) {
wx.$api.showToast(validObj.message) wx.$api.showToast(validObj.message)
...@@ -57,6 +61,10 @@ Page({ ...@@ -57,6 +61,10 @@ Page({
confirmColor: '#3666FE', confirmColor: '#3666FE',
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
_this.setData({
isConfirm: true
})
wx.$api.showLoading('加载中...')
// 创建/编辑接口 // 创建/编辑接口
mineServiceApi[apiNameObj[addOrEdit]]({ mineServiceApi[apiNameObj[addOrEdit]]({
...formData, ...formData,
...@@ -75,6 +83,11 @@ Page({ ...@@ -75,6 +83,11 @@ Page({
} else { } else {
wx.$api.showToast(message) wx.$api.showToast(message)
} }
}).finally(() => {
_this.setData({
isConfirm: false
})
wx.hideLoading()
}) })
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!