Răsfoiți Sursa

新增培训班开单-清除脏代码

jf 5 ani în urmă
părinte
comite
b38db7bd17
1 a modificat fișierele cu 32 adăugiri și 104 ștergeri
  1. 32 104
      hdApp/src/admin/billing/affirmPxClass.vue

+ 32 - 104
hdApp/src/admin/billing/affirmPxClass.vue

@@ -104,81 +104,36 @@ export default {
 	},
 	onLoad() {
 		this.selectPxInfo = uni.getStorageSync('affirmPxClass');
-		if (!this.getMerchantInfo) {
-			this.initMerchantInfo().then(data => {
-				uni.setNavigationBarTitle({
-					title: data.name
-				});
-			});
-		} else {
-			uni.setNavigationBarTitle({
-				title: this.getMerchantInfo.name
-			});
-		}
 	},
 	computed: {
 		...mapGetters(["getMerchantInfo", "getLoginInfo","getDictionariesInfo"])
 	},
 	methods: {
 		...mapActions(["initMerchantInfo"]),
-		init() {
-			this._getDet();
-		},
-		countAllPrices(e){
-			this.allPrices = this.allPrices+Number(this.form.sendCost)
-			console.log('e',e)
-			console.log('this.form.sendCost',Number(this.form.sendCost))
-			console.log('this.form.sendCost',this.form.sendCost)
-			console.log('this.allPrices',this.allPrices)
-		},
-
-		// api
-		_getDet() {
-			let data = uni.getStorageSync("modifyShopB");
-			if (this.$util.isEmpty(data)) return;
-			Object.keys(this.form).forEach((i, index) => {
-				// if (i != 'password') {
-				this.form[i] = data[i];
-				// }
-			});
-		},
-
-		changeCustomerFn(info) {
-			console.log("changeCustomerFn", info);
-			this.clientInfo = info;
-		},
-		confirmFn(options) {
-			createOrder(options).then(res => {
-				// this.$msg("下单成功");
-				this.resetSelectInfoByType(this.pageType);
-				const {
-					data: { id, orderSn }
-				} = res;
-				// 如果是客户跳转到客户成功页pagesClient/official/clientApply   供货员工下单到 /admin/billing/result
-				let url =
-					this.getLoginInfo.identity == "1"
-						? "pagesClient/official/clientApply"
-						: `/admin/billing/result?orderId=${id}&orderSn=${orderSn}`;
-				uni.redirectTo({
-					url: url,
-					success: result => {},
-					fail: () => {},
-					complete: () => {}
-				});
-			});
-		},
-		affirmFormSubmit(){
+		affirmFormSubmit() {
 			let pattern = /^1\d{10}$/;  //验证以1开头11位数
-			if(this.clientInfo==''){uni.showToast({title:'请选择客户',icon:'none'});return;}
-			if(this.name==''){uni.showToast({title:'请输入姓名',icon:'none'});return;}
-			if(!pattern.test(this.phone)){uni.showToast({title:'请输入正确的手机号',icon:'none'});return;}
-			if(this.payType==''){uni.showToast({title:'请选择付款方式',icon:'none'});return;}
+			if (this.clientInfo == '') {
+				uni.showToast({title: '请选择客户', icon: 'none'});
+				return;
+			}
+			if (this.name == '') {
+				uni.showToast({title: '请输入姓名', icon: 'none'});
+				return;
+			}
+			if (!pattern.test(this.phone)) {
+				uni.showToast({title: '请输入正确的手机号', icon: 'none'});
+				return;
+			}
+			if (this.payType == '') {
+				uni.showToast({title: '请选择付款方式', icon: 'none'});
+				return;
+			}
 			let options = {
-				classId:this.selectPxInfo.id,
-				customId:this.clientInfo.id,
-				name:this.name,
-				mobile:this.phone,
-				payWay:this.payType,
+				classId: this.selectPxInfo.id,
+				customId: this.clientInfo.id,
+				name: this.name,
+				mobile: this.phone,
+				payWay: this.payType,
 			}
 			let self = this;
 			uni.showModal({
@@ -191,7 +146,7 @@ export default {
 							uni.removeStorageSync('affirmPxClass')
 							return
 							const {
-								data: { id, orderSn }
+								data: {id, orderSn}
 							} = res;
 							// 如果是客户跳转到客户成功页pagesClient/official/clientApply   供货员工下单到 /admin/billing/result
 							let url =
@@ -200,9 +155,12 @@ export default {
 									: `/admin/billing/result?orderId=${id}&orderSn=${orderSn}`;
 							uni.redirectTo({
 								url: url,
-								success: result => {},
-								fail: () => {},
-								complete: () => {}
+								success: result => {
+								},
+								fail: () => {
+								},
+								complete: () => {
+								}
 							});
 						});
 						// self.formSubmit();
@@ -210,40 +168,10 @@ export default {
 				}
 			});
 		},
-		// 表单验证
-		async formSubmit(e) {
-			try {
-				// 进行表单检查
-				let formData = this.form;
-
-				const product = this.selectList.map(ele => {
-					return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount };
-				});
-				formData.product = JSON.stringify(product);
-				if (!this.getMerchantInfo) {
-					await this.initMerchantInfo();
-				}
-				formData.shopId = this.getMerchantInfo.id;
-
-				console.log(9999, formData);
-				// this.confirmFn(formData);
-				// let rules = rules.concat(temp);
-				let checkRes = formUtil.validation(formData, []);
-				// 验证通过!
-				if (!checkRes) {
-					this.confirmFn(formData);
-				} else {
-					this.$msg(checkRes);
-				}
-			} catch (error) {
-				console.log(999999, error);
-			}
+		//选择客户
+		changeCustomerFn(info) {
+			this.clientInfo = info;
 		},
-		gobackEvent() {
-			uni.navigateBack({
-				delta: 1
-			});
-		}
 	}
 };
 </script>