jf před 5 roky
rodič
revize
81a0e9a03d

+ 35 - 12
hdApp/src/admin/billing/affirmGhs.vue

@@ -229,13 +229,13 @@
 						<button @click="form.sendType=1" class="admin-button-com mini-btn" :class="form.sendType==1?'blue':'default'">配送</button>
 						<button @tap="form.sendType=2" class="admin-button-com mini-btn" :class="form.sendType==2?'blue':'default'">自取</button>
 					</tui-list-cell>
-						<appSendTime :sendDate.sync="form.sendDate" :sendTime.sync="form.sendTime" ></appSendTime>
+						<appSendTime @alterTime="purchaseFreight(ghsMsg)" :sendDate.sync="form.sendDate" :sendTime.sync="sendTime" ></appSendTime>
 					<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>
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false">
-						<textarea style="height: 100rpx" placeholder="备注..."/>
+						<textarea style="height: 100rpx" v-model="remark" placeholder="备注..."/>
 					</tui-list-cell>
 <!--					<tui-list-cell class="line-cell" :hover="false" :arrow="false">-->
 <!--						<view class="tui-title ">结算方式</view>-->
@@ -250,7 +250,7 @@
 		</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>
@@ -258,7 +258,7 @@
 			<button class="admin-button-com blue middle" @click="affirmFormSubmit">开单</button>
 		</view>
 		<!-- 选择客户 -->
-		<AppCustomerSel :show.sync="showCustomer" @change="changeCustomerFn" />
+<!--		<AppCustomerSel :show.sync="showCustomer" @change="changeCustomerFn" />-->
 	</view>
 </template>
 
@@ -274,9 +274,9 @@ 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 } from "@/api/order/index";
 import { getGhsDataApi } from "@/api/ghs/index";
-// import { freight } from "@/api/order";
+import { freight,createOrder } from "@/api/purchase/index";
 import { mapActions, mapGetters } from "vuex";
 
 export default {
@@ -297,6 +297,8 @@ export default {
 		return {
 			autoLoad: false,
 			ghsMsg:'',
+			sendTime:'',
+			remark:'',
 			form: {
 				debt:1,//结算方式 1欠款订单 0正常订单
 				shopId: "",
@@ -350,7 +352,9 @@ export default {
 		},
 		getGhsData(id) {
 			getGhsDataApi({id:id}).then(res => {
-				this.ghsMsg = res.data
+				this.ghsMsg = res.data;
+				console.log('res.data',this.ghsMsg)
+				this.purchaseFreight(this.ghsMsg);
 			});
 		},
 		countAllPrices(e){
@@ -372,8 +376,7 @@ export default {
 			});
 		},
 
-		changeCustomerFn(info) {
-			console.log("changeCustomerFn", info);
+		purchaseFreight(info) {
 			let params = {
 				province: info.province,
 				city:info.city,
@@ -381,12 +384,11 @@ export default {
 				floor:info.floor,
 				long: info.long,
 				lat: info.lat,
+				sendTime: this.sendTime,
 			};
 			freight(params).then(res => {
 				this.form.sendCost = res.data.sedCost;
 			});
-			this.form.customId = info.id;
-			this.form.customName = info.name;
 		},
 		confirmFn(options) {
 			createOrder(options).then(res => {
@@ -409,13 +411,34 @@ export default {
 			});
 		},
 		affirmFormSubmit(){
+			if(this.sendTime==''){uni.showToast({title:'请先选择时间',icon:'none'});return}
+			const product = this.selectList.map(ele => {
+				return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount };
+			});
+			let parameter = {
+				getType:this.form.sendType,
+				sendTime:this.sendTime,
+				sendCost:this.form.sendCost,
+				remark:this.remark,
+				product:product,
+				supplierId:this.ghsMsg.id,
+			}
 			let self = this;
 			uni.showModal({
 				title: '提示',
 				content: '确认开单?',
 				success: function (res) {
 					if (res.confirm) {
-						self.formSubmit();
+						createOrder(parameter).then(res => {
+							self.resetSelectInfoByType(self.pageType);
+							const {data: { id, orderSn }} = res;
+							// 如果是客户跳转到客户成功页pagesClient/official/clientApply   供货员工下单到 /admin/billing/result
+							let url =
+								self.getLoginInfo.identity == "1"
+									? "pagesClient/official/clientApply"
+									: `/admin/billing/result?orderId=${id}&orderSn=${orderSn}`;
+							uni.redirectTo({url: url,});
+						});
 					}
 				}
 			});

+ 16 - 4
hdApp/src/api/purchase/index.js

@@ -43,7 +43,7 @@ export const createPurchaseOrderApi = async data => {
 };
 
 /** *
- * 待结款 - 结款 
+ * 待结款 - 结款
  */
  export const purchaseClearCreateOrder = async data => {
 	return https.post("/purchase-clear/create-order", data);
@@ -64,7 +64,7 @@ export const createPurchaseOrderApi = async data => {
 };
 
 /** *
- * 延期支付  
+ * 延期支付
  */
  export const purchaseDebtPay = async data => {
 	return https.get("/purchase/debt-pay", data);
@@ -78,8 +78,20 @@ export const createPurchaseOrderApi = async data => {
 };
 
 /** *
- * 采购详情   
+ * 采购详情
  */
  export const purchaseWxPay = async data => {
 	return https.post("/purchase/wx-pay", data);
-};
+};
+/** *
+	* 发快递配送费计算  姜枫 2021.04.12
+	*/
+export const freight = async data => {
+	return https.post("/purchase/freight", data);
+};
+/** *
+	* 采购-下单  姜枫 2021.04.12
+	*/
+export const createOrder = async data => {
+	return https.post("/purchase/create-order", data);
+};

+ 2 - 1
hdApp/src/components/app-send-time.vue

@@ -102,11 +102,12 @@ export default {
 			let oneIndex = e.detail.value[0] || 0;
 			let twoIndex = e.detail.value[1] || 0;
 			this.timeValue = e.detail.value;
-			this.$emit("alterTime")
 			this.$emit(
 				"update:sendTime",
 				this.timeList[0][oneIndex] + ":" + this.timeList[1][twoIndex]
 			);
+			this.$emit("alterTime")
+
 		}
 	},
 	watch: {