jf 5 лет назад
Родитель
Сommit
22b02bf4fc

+ 73 - 125
hdApp/src/admin/billing/affirmPxClass.vue

@@ -6,70 +6,40 @@
 				<view class="module-com">
 					<view class="commodity-view">
 						<view class="commodity-list">
-							<view
-								class="commodity-item"
-								v-for="(item, index) in selectList"
-								:key="index"
-							>
-								<image class="item-icon" :src="item.cover" alt="商品图" />
-
-								<view class="item-info">
-									<view class="info-line">
-										<text class="item-name">{{ item.itemName }}</text>
-										<text class="item-price">
-											<text class="unit">¥</text>
-
-											<text class="price">
-												{{ getSelectItemPrice(item) }}
-											</text>
-										</text>
-									</view>
-									<view class="info-line">
-										<text class="item-type">{{ item.rank }}级</text>
-										<text class="item-count">
-											<text v-if="item.bigCount > 0 || item.smallCount > 0">{{
-												`${item.bigCount}`
-											}}</text>
-											<text v-if="item.smallCount > 0">/</text>
-											<text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
-										</text>
+							<view class="commodity-item">
+									<view class="flex-space commodity-title">
+										<view class="ov-1x">{{ selectPxInfo.name }}</view>
+										<text>¥{{ selectPxInfo.tuition }}</text>
 									</view>
+								<view class="flex-space commodity-center">
+									<view class="ov-1x">{{ selectPxInfo.target }}</view>
+									<text>x1</text>
 								</view>
 							</view>
 						</view>
-						<view class="summary-bar">
-							<view class="operate-view" @click="gobackEvent">
-								<text class="iconfont icongouwuche"></text>
-								重选花材
-							</view>
-							<view class="describe-view">
-								共{{ allCount }}种,
-								<!-- 共16扎9支, -->
-								合计 ¥<text class="price">{{ allPrice }}</text>
-							</view>
-						</view>
 					</view>
 				</view>
 				<!-- 登录信息 -->
 				<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="name" placeholder-class="tui-placeholder">
 					</tui-list-cell>
-					<tui-list-cell class="line-cell" :hover="false" :arrow="false" v-show="form.sendType == 1">
-						<view class="tui-title ">运费</view>
-						<input type="number" placeholder="留空表示免运费" @input="countAllPrices" v-model="form.sendCost" placeholder-class="tui-placeholder">
+					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
+						<view class="tui-title ">手机号</view>
+						<input type="number" placeholder="请填写" v-model="phone" 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?'blue':'default'" style="margin-right: 5rpx"
+														@tap="payType=res"  v-for="(res,i) in getDictionariesInfo.payWayFullName">
+							{{ res }}
+						</button>
 					</tui-list-cell>
 
 
@@ -79,12 +49,12 @@
 		</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">{{ selectPxInfo.tuition  }}</text>
 				</text>
 			</view>
-			<button class="admin-button-com blue middle" @click="affirmFormSubmit">开单</button>
+			<button class="admin-button-com blue middle" @click="affirmFormSubmit">确定</button>
 		</view>
 		<!-- 选择客户 -->
 		<AppCustomerSel :show.sync="showCustomer" @change="changeCustomerFn" />
@@ -103,7 +73,7 @@ import appAddressGroup from "@/components/app-address-group";
 import appSendTime from "@/components/app-send-time";
 import appFormSend from "@/components/app-form-send";
 const formUtil = require("@/utils/formValidation.js");
-import { createOrder,freight } from "@/api/order/index";
+import { createOrder,freight,createPxClassOrder } from "@/api/order/index";
 // import { freight } from "@/api/order";
 import { mapActions, mapGetters } from "vuex";
 
@@ -123,32 +93,17 @@ export default {
 	mixins: [productMins],
 	data() {
 		return {
+			selectPxInfo:'',//选中的-培训班
 			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,
+			name:'',
+			phone:'',
+			payType:'',//选中的-支付类型
+			clientInfo: '',//客户信息
 			showCustomer: false
 		};
 	},
 	onLoad() {
+		this.selectPxInfo = uni.getStorageSync('affirmPxClass');
 		if (!this.getMerchantInfo) {
 			this.initMerchantInfo().then(data => {
 				uni.setNavigationBarTitle({
@@ -162,7 +117,7 @@ export default {
 		}
 	},
 	computed: {
-		...mapGetters(["getMerchantInfo", "getLoginInfo"])
+		...mapGetters(["getMerchantInfo", "getLoginInfo","getDictionariesInfo"])
 	},
 	methods: {
 		...mapActions(["initMerchantInfo"]),
@@ -190,19 +145,7 @@ export default {
 
 		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,
-			};
-			freight(params).then(res => {
-				this.form.sendCost = res.data.sedCost;
-			});
-			this.form.customId = info.id;
-			this.form.customName = info.name;
+			this.clientInfo = info;
 		},
 		confirmFn(options) {
 			createOrder(options).then(res => {
@@ -225,13 +168,44 @@ export default {
 			});
 		},
 		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;}
+			let options = {
+				classId:this.selectPxInfo.id,
+				customId:this.clientInfo.id,
+				name:this.name,
+				mobile:this.phone,
+				payWay:this.payType,
+			}
 			let self = this;
 			uni.showModal({
 				title: '提示',
 				content: '确认开单?',
 				success: function (res) {
 					if (res.confirm) {
-						self.formSubmit();
+						createPxClassOrder(options).then(res => {
+							// this.$msg("下单成功");
+							uni.removeStorageSync('affirmPxClass')
+							return
+							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: () => {}
+							});
+						});
+						// self.formSubmit();
 					}
 				}
 			});
@@ -295,45 +269,19 @@ export default {
 			.commodity-list {
 				padding: 20px;
 				.commodity-item {
-					display: flex;
-					margin-bottom: 20px;
-					.item-icon {
-						flex-shrink: 0;
-						width: 140px;
-						height: 140px;
-					}
-					.item-info {
-						display: flex;
-						flex-direction: column;
-						justify-content: center;
-						flex: 1;
-						margin-left: 20px;
-						.info-line {
-							margin-bottom: 20px;
-							display: flex;
-							justify-content: space-between;
-							align-items: flex-end;
-							.item-name {
-								color: #666;
-								font-size: 28px;
+					.commodity-title{
+							view{
+								width: 70%;
+								font-size: 28rpx;
 							}
-							.item-price {
-								color: #333;
-								font-size: 22px;
-								.price {
-									font-size: 32px;
-									font-weight: bold;
-								}
+							text{
+								color: #ff1f1f;
 							}
-							.item-type {
-								color: #999;
-								font-size: 24px;
-							}
-							.item-count {
-								color: #666;
-								font-size: 24px;
-							}
-						}
+					}
+					.commodity-center{
+						margin-top: 20rpx;
+						color: #949494;
+						view{width: 70%;}
 					}
 				}
 			}

+ 6 - 0
hdApp/src/api/order/index.js

@@ -26,6 +26,12 @@ export const comment = data => {
 export const createOrder = data => {
 	return https.post("/order/create-order", data);
 };
+/** *
+	* 培训班开单(课程确定开单)
+	*/
+export const createPxClassOrder = data => {
+	return https.get("/px-apply/add", data);
+};
 
 /** *
  * 商城下单-相关信息 m

+ 3 - 2
hdApp/src/components/module/app-pxClass-commodity.vue

@@ -77,8 +77,9 @@ export default {
 	created() {},
 	mounted() {},
 	methods: {
-		toAffirmPxClass(){
-			uni.navigateTo({url:''})
+		toAffirmPxClass(obj){
+			uni.setStorageSync("affirmPxClass",obj);
+			uni.navigateTo({url:'/admin/billing/affirmPxClass'})
 		},
 	}
 };

+ 2 - 0
hdApp/src/static/css/reset.scss

@@ -144,3 +144,5 @@ uni-button::after {
 .flex-center{display: flex;align-items: center;justify-content: center};
 .flex-space{display: flex;align-items: center;justify-content: space-between};
 .flex-end{display: flex;align-items: center;justify-content: end};
+.ov-1x{overflow:hidden;	white-space:nowrap;	text-overflow:ellipsis;}
+.ov-2x{text-overflow: -o-ellipsis-lastline;	overflow: hidden;	text-overflow: ellipsis;	display: -webkit-box;	-webkit-line-clamp: 2;	-webkit-box-orient: vertical;}