diff --git a/common/js/request.js b/common/js/request.js index b8214ee..eae29a1 100644 --- a/common/js/request.js +++ b/common/js/request.js @@ -37,7 +37,7 @@ export default { // return false; }, success(res) { - if (res.data.code !== 0) { + if (!res || !res.data || res.data.code !== 0) { uni.showToast({ title: '系统开小差啦T_T,请稍后重试', icon: 'error' diff --git a/components/vertify/vertify-bank-bind.vue b/components/vertify/vertify-bank-bind.vue index 200aa97..d87d346 100644 --- a/components/vertify/vertify-bank-bind.vue +++ b/components/vertify/vertify-bank-bind.vue @@ -36,7 +36,7 @@ }, goToBindBank() { uni.navigateTo({ - url: '/pages/my/b-account-bind' + url: '/pages/my/withdraw' }) } } diff --git a/pages/my/b-account-bind.vue b/pages/my/b-account-bind.vue index bc4ce9c..7805fcc 100644 --- a/pages/my/b-account-bind.vue +++ b/pages/my/b-account-bind.vue @@ -11,20 +11,28 @@ - 姓名 + + 姓名* + - 证件号码 - + + 身份证号码* + + - 手机号 - + + 手机号* + + - 号码 - + + 银行卡号* + + @@ -76,17 +84,35 @@ changAccountType(e) { this.curAccountType = e.currentTarget.dataset.type; }, + validData() { + if (!this.formData.name || !this.formData.certId || !this.formData.phone || !this.formData.bankNum) { + return false; + } + return true; + }, async submit() { if (this.curAccountType === '1') { + if (!this.validData()) { + uni.showToast({ + icon: 'none', + title: '请完成必填项的填写' + }) + return; + } let params = { ...this.formData, workerId: this.curUserInfo.workerId } let res = await this.$request.bindBankCard(params); - if (res.code === 0) { + if (res && res.code === 0) { uni.navigateBack({ delta: -1 }) + } else if (res && res.msg) { + uni.showToast({ + icon: 'none', + title: res.msg + }) } } } diff --git a/pages/my/certification.vue b/pages/my/certification.vue index 083fcaa..2fecf53 100644 --- a/pages/my/certification.vue +++ b/pages/my/certification.vue @@ -29,7 +29,7 @@ - 身份证上传(正反面) + 身份证上传(正反面)* @@ -47,11 +47,11 @@ - 姓名 + 姓名* - 身份证号 + 身份证号* diff --git a/pages/my/new-serv.vue b/pages/my/new-serv.vue index 1256500..08f82da 100644 --- a/pages/my/new-serv.vue +++ b/pages/my/new-serv.vue @@ -8,7 +8,7 @@
- 服务名称 + 服务名称* @@ -17,7 +17,7 @@ - 选择类目 + 选择类目* + + + - - - - - - - - + + + + + + + + @@ -71,7 +72,7 @@ @click="showAllSpecs()"> - + - + + + + + + + + --> + + + + + 附加服务 + + - 上架区域 + 上架区域* - - 区域描述 - + + 区域描述 + + + - 商品封面图上传 + 商品封面图上传* @@ -149,7 +161,7 @@ - 详情图上传 + 详情图上传* @@ -170,7 +182,7 @@ - 轮播图上传 + 轮播图上传* @@ -222,7 +234,7 @@ - +
@@ -273,6 +285,13 @@ }, { code: 5, name: '平方' + }], + servHonorTitle: [{ + code: -1, + name: '无' + }, { + code: 1, + name: '金牌服务' }], productProtectTimes: [{ code: 1, @@ -308,17 +327,17 @@ }, async checkBankAndCertify() { // 查询账户绑定信息 - let bankCardRes = await this.$request.getBindBankCardByWorkerId({ - workerId: this.curUserInfo.workerId - }); - this.bankCard = bankCardRes.data; + // let bankCardRes = await this.$request.getBindBankCardByWorkerId({ + // workerId: this.curUserInfo.workerId + // }); + // this.bankCard = bankCardRes.data; // 查询实名信息 let certifyInfoRes = await this.$request.getWorkerCertify(); this.certifyInfo = certifyInfoRes.data; - if (!this.bankCard || !this.bankCard.bankNum) { - this.$refs.vertifyBankBind.showModal(); - return false; - } else if (!this.certifyInfo || !this.certifyInfo.workerCertificationId) { + // if (!this.bankCard || !this.bankCard.bankNum) { + // this.$refs.vertifyBankBind.showModal(); + // return false; + if (!this.certifyInfo || !this.certifyInfo.workerCertificationId) { this.$refs.vertifyCertify.showModal(); return false; } @@ -512,27 +531,89 @@ // }); // this.formData.video = await this.$request.uploadFile(e.tempFilePaths[0]); // uni.hideLoading(); - // }, + // }, + validData(data) { + let errMsg = ""; + if (!data.servName) { + errMsg = '服务名称不能为空'; + } else if (!data.goodsStandardList || !data.goodsStandardList.length) { + errMsg = '至少选择一个规格'; + } else if (!this.validSpecData(data.goodsStandardList)) { + return false; + } else if (!data.goodsAreaList || !data.goodsAreaList.length) { + errMsg = '至少选择一个上架区域'; + } else if (!data.coverImgList || !data.coverImgList.length) { + errMsg = '封面图不能为空' + } else if (!data.descImgList || !data.descImgList.length) { + errMsg = '详情图不能为空' + } else if (!data.imgList || !data.imgList.length) { + errMsg = '轮播图不能为空' + } + if (errMsg) { + uni.showToast({ + icon: 'none', + title: errMsg + }) + return false; + } + return true; + }, + validSpecData(goodsStandardList) { + let errMsg = ""; + for (let i = 0; i < goodsStandardList.length; i++) { + let spec = goodsStandardList[i]; + if (!spec.goodsStandardName) { + errMsg = '勾选规格的自编辑购买标题不能为空'; + } else if (!spec.goodsPrice) { + errMsg = '勾选规格的价格不能为空'; + } else if (!spec.groupPrice) { + errMsg = '勾选规格的团购价不能为空'; + } else if (!spec.goodsUnit) { + errMsg = '勾选规格的规格单位不能为空'; + } else if (!spec.goodsNum) { + errMsg = '勾选规格的库存不能为空'; + } + if (errMsg) { + uni.showToast({ + icon: 'none', + title: errMsg + }) + break; + } + } + if (errMsg) { + return false; + } + return true; + }, async submit() { + let goodsStandardList = this.formData.specsList.filter((item) => { + if (item.checked) { + return { + ...item + } + } + }); + let goodsAreaList = this.formData.districtList.filter((item) => { + if (item.checked) { + item.countryAreaId = item.areaId; + return item; + } + }); + let data2Valid = { + ...this.formData, + goodsStandardList: goodsStandardList, + goodsAreaList: goodsAreaList + } + if (!this.validData(data2Valid)) { + return; + } + let checkRes = await this.checkBankAndCertify(); if (!checkRes) { return; } - let goodsStandardList = this.formData.specsList.filter((item) => { - if (item.checked) { - return { - ...item, - goodsNum: 99999 - } - } - }); - let goodsAreaList = this.formData.districtList.filter((item) => { - if (item.checked) { - item.countryAreaId = item.areaId; - return item; - } - }); // 0是轮播图,1是详情图 let goodsImgsList = []; this.formData.imgList.forEach((url) => { @@ -587,5 +668,9 @@ .long-btn { width: 95%; + } + + .form-val-area { + flex-basis: 75% !important; }