Commit 8bdcbea1 by 李伟康

commit 提交

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