Commit 8bdcbea1 by 李伟康

commit 提交

1 parent b840b741
...@@ -353,8 +353,9 @@ export default { ...@@ -353,8 +353,9 @@ export default {
async createCoupon () { async createCoupon () {
try { try {
const { pageParams: { couponId, carInfo }, customerInfo } = this, { const { pageParams: { couponId, carInfo }, customerInfo } = this, {
shopMerchantId } = uni.$storage.get("userInfo") shopMerchantId } = uni.$storage.get("userInfo"),
await this.validate() validateStatus = await this.validate()
if (!validateStatus) return
uni.showLoading() uni.showLoading()
let { staffName, salesUuid } = customerInfo, let { staffName, salesUuid } = customerInfo,
scene = `id=${couponId}&userId=${salesUuid}&employName=${staffName}&merchantId=${shopMerchantId}&customerName=${customerInfo.customerName}&customerPhone=${customerInfo.phoneNumber}`, scene = `id=${couponId}&userId=${salesUuid}&employName=${staffName}&merchantId=${shopMerchantId}&customerName=${customerInfo.customerName}&customerPhone=${customerInfo.phoneNumber}`,
...@@ -388,12 +389,22 @@ export default { ...@@ -388,12 +389,22 @@ export default {
} }
}, },
async validate () { async validate () {
const { customerName, phoneNumber, carModel, staffName } = this.customerInfo, let flag = true
{ couponId } = this.pageParams try {
// 检查车主姓名 const { customerName, phoneNumber, carModel, staffName } = this.customerInfo,
if (!customerName || !phoneNumber || !carModel || !staffName) throw '请输入客户信息' { couponId } = this.pageParams
if (phoneNumber && !phoneRex.test(phoneNumber)) throw '请输入正确的手机号' // 检查车主姓名
if (!couponId) throw '请选择礼券类型' if (!customerName || !phoneNumber || !carModel || !staffName) throw '请输入客户信息'
if (phoneNumber && !phoneRex.test(phoneNumber)) throw '请输入正确的手机号'
if (!couponId) throw '请选择礼券类型'
} catch (error) {
uni.showToast({
title: error,
icon: 'none',
})
flag = false
}
return flag
}, },
checkCustomerReceivedStatus (receiveCouponStartTime) { checkCustomerReceivedStatus (receiveCouponStartTime) {
try { try {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!