Răsfoiți Sursa

组合开单

jf 5 ani în urmă
părinte
comite
d1e770d21f

+ 66 - 107
hdApp/src/admin/billing/affirm.vue

@@ -31,7 +31,7 @@
 												`${item.bigCount}`
 											}}</text>
 											<text v-if="item.smallCount > 0">/</text>
-											<text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
+											<text v-if="item.smallCount > 0">{{ item.smallCount }}</text>
 										</text>
 									</view>
 								</view>
@@ -54,22 +54,23 @@
 				<view class="module-com input-line-wrap">
 					<tui-list-cell class="line-cell" :hover="false" :arrow="true">
 						<view class="tui-title ">客户</view>
-						<view class="tui-input" v-if="form.customId" @click="showCustomer = true">{{ form.customName }}</view>
+						<view class="tui-input" v-if="clientInfo.id" @click="showCustomer = true">{{ clientInfo.name }}</view>
 						<view class="tui-placeholder" style="width: 100%" v-else @click="showCustomer = true">请选择客户</view>
 					</tui-list-cell>
-					<tui-list-cell class="line-cell" :hover="false" :arrow="false">
-						<view class="tui-title ">送货</view>
-						<button @tap="form.sendType=2" class="admin-button-com mini-btn" :class="form.sendType==2?'blue':'default'">自取</button>
-						<button @click="form.sendType=1" class="admin-button-com mini-btn" :class="form.sendType==1?'blue':'default'">配送</button>
+					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
+						<view class="tui-title ">包装费</view>
+						<input type="number" placeholder="请填写包装费和材料费" v-model="packingMoney" placeholder-class="tui-placeholder">
 					</tui-list-cell>
-					<tui-list-cell class="line-cell" :hover="false" :arrow="false" v-show="form.sendType == 1">
+					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
 						<view class="tui-title ">运费</view>
-						<input type="number" placeholder="留空表示免运费" @input="countAllPrices" v-model="form.sendCost" placeholder-class="tui-placeholder">
+						<input type="number" placeholder="选填" v-model="freight" placeholder-class="tui-placeholder">
 					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false">
 						<view class="tui-title ">结算方式</view>
-						<button @tap="form.debt=1" class="admin-button-com mini-btn" :class="form.debt==1?'blue':'default'">欠款</button>
-						<button @click="form.debt=0" class="admin-button-com mini-btn" :class="form.debt==0?'blue':'default'">已收款</button>
+						<button class="admin-button-com mini-btn" :class="payType==res.id?'blue':'default'" style="margin-right: 10rpx"
+														@tap="payType=res.id"  v-for="(res,i) in getDictionariesInfo.htPayWayOption">
+							{{ res.name }}
+						</button>
 					</tui-list-cell>
 
 
@@ -79,9 +80,9 @@
 		</view>
 		<view class="under-bar">
 			<view class="price-view">
-				<text class="price-title">{{ form.debt==1?'欠款':'已收款' }}</text>
+				<text class="price-title">收款</text>
 				<text class="price-number">
-					¥ <text class="large">{{ allPrice+Number(form.sendCost)  }}</text>
+					¥ <text class="large">{{ allPrice+Number(packingMoney)+Number(freight)  }}</text>
 				</text>
 			</view>
 			<button class="admin-button-com blue middle" @click="affirmFormSubmit">开单</button>
@@ -124,27 +125,10 @@ export default {
 	data() {
 		return {
 			autoLoad: false,
-			form: {
-				debt:1,//结算方式 1欠款订单 0正常订单
-				shopId: "",
-				shopName: "",
-				receiveProvince: "",
-				receiveCity: "",
-				receiveFloor: "",
-				receiveAddress: "",
-				receiveLong: "",
-				receiveLat: "",
-				sendType: 2,
-				sendSide: "2",
-				sendDate: "",
-				sendTime: "",
-				sendCost: "",
-				customId: "",
-				product: ""
-			},
-
-			// 详细地址
-			// showRegion: false,
+			packingMoney:'',//包装费
+			freight:'',//运费
+			payType:null,//选中的-支付类型
+			clientInfo: '',//客户信息
 			showCustomer: false
 		};
 	},
@@ -162,48 +146,63 @@ export default {
 		}
 	},
 	computed: {
-		...mapGetters(["getMerchantInfo", "getLoginInfo"])
+		...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);
-			let params = {
-				province: info.province,
-				city:info.city,
-				address:info.address,
-				floor:info.floor,
-				long: info.long,
-				lat: info.lat,
+			this.clientInfo = info;
+		},
+		//确定开单
+		affirmFormSubmit(){
+			if(this.clientInfo==''){uni.showToast({title:'请选择客户!',icon:'none'});return;}
+			if(this.packingMoney==''){uni.showToast({title:'请输入包装费!',icon:'none'});return;}
+			if(this.payType==null){uni.showToast({title:'请选择结算方式!',icon:'none'});return;}
+			const product = this.selectList.map(ele => {
+				return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount };
+			});
+			let options = {
+				orderType:2,// 开单类型,1成品开单 2花材开单
+				packingFee:this.packingMoney,// 包装费
+				sendCost:this.freight,// 运费
+				customId:this.clientInfo.id,// 客户
+				payWay:this.payType,//付款方式
+				product:product,//下单商品
 			};
-			freight(params).then(res => {
-				this.form.sendCost = res.data.sedCost;
+			let self = this;
+			uni.showModal({
+				title: '提示',
+				content: '确认开单?',
+				success: function (res) {
+					if (res.confirm) {
+						createOrder(options).then(res => {
+							console.log('开单成功',res);
+							return;
+							// 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: () => {}
+							});
+						});
+					}
+				}
 			});
-			this.form.customId = info.id;
-			this.form.customName = info.name;
 		},
+
+
 		confirmFn(options) {
 			createOrder(options).then(res => {
 				// this.$msg("下单成功");
@@ -224,47 +223,7 @@ export default {
 				});
 			});
 		},
-		affirmFormSubmit(){
-			let self = this;
-			uni.showModal({
-				title: '提示',
-				content: '确认开单?',
-				success: function (res) {
-					if (res.confirm) {
-						self.formSubmit();
-					}
-				}
-			});
-		},
-		// 表单验证
-		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);
-			}
-		},
 		gobackEvent() {
 			uni.navigateBack({
 				delta: 1

+ 3 - 3
hdApp/src/admin/billing/affirmPxClass.vue

@@ -36,7 +36,7 @@
 					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false">
 						<view class="tui-title ">结算方式</view>
-						<button class="admin-button-com mini-btn" :class="payType==res.id?'blue':'default'" style="margin-right: 5rpx"
+						<button class="admin-button-com mini-btn" :class="payType==res.id?'blue':'default'" style="margin-right: 10rpx"
 														@tap="payType=res.id"  v-for="(res,i) in getDictionariesInfo.htPayWayOption">
 							{{ res.name }}
 						</button>
@@ -97,7 +97,7 @@ export default {
 			autoLoad: false,
 			name:'',
 			phone:'',
-			payType:'',//选中的-支付类型
+			payType:null,//选中的-支付类型
 			clientInfo: '',//客户信息
 			showCustomer: false
 		};
@@ -124,7 +124,7 @@ export default {
 				uni.showToast({title: '请输入正确的手机号', icon: 'none'});
 				return;
 			}
-			if (this.payType == '') {
+			if (this.payType == null) {
 				uni.showToast({title: '请选择付款方式', icon: 'none'});
 				return;
 			}

+ 16 - 20
hdApp/src/admin/billing/index.vue

@@ -1,11 +1,18 @@
 <template>
 	<view class="billing_box_bg">
 		<app-tabs :tabs="tabs" :currentTab="tabIndex" @change="change" itemWidth="33.3%" />
-		<view class="input-wrap" v-if="tabIndex == 0">
+		<view class="input-wrap" v-if="tabIndex == 1">
 			<app-search-module v-model="py" placeholder="请输入关键词,支持拼音首字母搜索" @search="searchFn" />
 		</view>
 		<view class="scroll-middle_bx">
-			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop" v-if="tabIndex == 0">
+
+			<block v-if="tabIndex == 0">
+				<view style="width:100%">
+					<AppWrapperEmpty :type="'billing'" :is-empty="true" />
+				</view>
+			</block>
+
+			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop" v-if="tabIndex == 1">
 				<div v-for="(item, index) in filterProductInfo" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass">
 					<text>{{ item.className || "" }}</text>
 					<text class="tag" v-if=" getSelectClassById(item.classId).bigCount > 0 || getSelectClassById(item.classId).smallCount > 0">
@@ -17,8 +24,7 @@
 					</text>
 				</div>
 			</scroll-view>
-
-			<scroll-view scroll-y class="right-box" v-if="tabIndex == 0" :scroll-into-view="scrollClassId">
+			<scroll-view scroll-y class="right-box" v-if="tabIndex == 1" :scroll-into-view="scrollClassId">
 				<!--内容部分 start -->
 				<block v-if="!$util.isEmpty(filterProductInfo)">
 					<view
@@ -64,11 +70,7 @@
 				</block>
 				<!--内容部分 end -->
 			</scroll-view>
-			<block v-if="tabIndex == 1">
-				<view style="width:100%">
-					<AppWrapperEmpty :type="'billing'" :is-empty="true" />
-				</view>
-			</block>
+
 			<view v-if="tabIndex == 2" class="PxClass-box">
 				<PxClassCommondity  :info="pxClassInfo"></PxClassCommondity>
 			</view>
@@ -104,7 +106,7 @@
 			padding="30rpx 30rpx"
 		>
 		</modal-module>
-		<FooterCart :price="allPrice" :count="allCount" @confirm="confirmSelectEvent" v-if="tabIndex == 0"></FooterCart>
+		<FooterCart :price="allPrice" :count="allCount" @confirm="confirmSelectEvent" v-if="tabIndex == 1"></FooterCart>
 	</view>
 </template>
 
@@ -137,17 +139,11 @@ export default {
 	data() {
 		return {
 			COMMODITY_TYPE,
-			tabIndex: 2,
+			tabIndex: 1,
 			tabs: [
-				{
-					name: "成品"
-				},
-				{
-					name: "组合"
-				},
-				{
-				    name: '课程'
-				},
+				{	name: "成品"	},
+				{	name: "组合"	},
+				{	name: '课程'	},
 			],
 			isModel: false,
 			customData: {