shish 3 лет назад
Родитель
Сommit
830f715807
2 измененных файлов с 36 добавлено и 50 удалено
  1. 6 1
      hdApp/src/api/purchase/index.js
  2. 30 49
      hdApp/src/pagesPurchase/addCgConfirm.vue

+ 6 - 1
hdApp/src/api/purchase/index.js

@@ -103,6 +103,11 @@ export const freight = async data => {
 /** *
 	* 采购-下单  姜枫 2021.04.12
 	*/
-export const createOrder = async data => {
+export const createOrder = data => {
 	return https.post("/purchase/create-order", data);
 };
+
+//向虚拟供货商采购 
+export const addVirtualCg = data => {
+	return https.post("/purchase/add-virtual-cg", data);
+};

+ 30 - 49
hdApp/src/pagesPurchase/addCgConfirm.vue

@@ -50,25 +50,26 @@
 					</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: 10upx" @tap="payType=res.id"  v-for="(res,i) in getDictionariesInfo.htPayWayOption" :key="i">
-							{{ res.name }}
-						</button>
+						<view class="tui-title">付款方式</view>
+						<button @click="payMode = 0" class="admin-button-com middle" :class="payMode == 0 ? 'blue' : 'default'">欠款</button>
+						<button @tap="payMode = 1" class="admin-button-com middle" :class="payMode == 1 ? 'blue' : 'default'">更多</button>
 					</tui-list-cell>
 
-					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
-						<view class="tui-title ">运费</view>
-						<input type="number" placeholder="选填" v-model="freight" @input="countAllPrices()" placeholder-class="tui-placeholder">
+					<tui-list-cell class="line-cell" :arrow="true" v-if="payMode == 1">
+						<div class="tui-title">更多方式</div>
+						<picker mode="selector" :value="form.payWay" :range="payWayList" range-key="name" @change="payWayChange" class="tui-input" >
+						<input v-model="form.payWay" name="payWay" type="text" hidden />
+						<div style="padding:6upx 0 6upx 0;">{{payWayList[payWayindex].name}}</div>
+						</picker>
 					</tui-list-cell>
 
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
-						<view class="tui-title">总金额</view>
-						<text style="color: #3385FF" >{{(allPrice+Number(freight)).toFixed(2)}}</text>
+						<view class="tui-title ">运费</view>
+						<input type="number" placeholder="选填" v-model="sendCost" placeholder-class="tui-placeholder">
 					</tui-list-cell>
 
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
-						<view class="tui-title">实收金额</view>
+						<view class="tui-title">金额</view>
 						<view class="flex-space" style="width: 100%;">
 							<input type="number" @focus="modifyPrice=''" v-model="modifyPrice" placeholder-class="tui-placeholder"/>
 						</view>
@@ -90,35 +91,27 @@
 </template>
 <script>
 import TuiListCell from "@/components/plugin/list-cell";
-import AppAvatarModule from "@/components/module/app-avatar";
-import SimpleAddress from "@/components/plugin/simple-address";
-import AppAreaSel from "@/components/app-area-sel";
 import productMins from "@/mixins/product";
-import appAddressGroup from "@/components/app-address-group";
-import appSendTime from "@/components/app-send-time";
-import { createOrder } from "@/api/order/index";
+import { addVirtualCg } from "@/api/purchase";
 import { mapActions, mapGetters } from "vuex";
 export default {
 	name: "addCgConfirm",
 	components: {
-		TuiListCell,
-		AppAvatarModule,
-		SimpleAddress,
-		AppAreaSel,
-		appAddressGroup,
-		appSendTime
+		TuiListCell
 	},
 	mixins: [productMins],
 	data() {
 		return {
+			//付款模式 0欠款 1现结
+			payMode:0,
+			payWay:0,
 			autoLoad: false,
-			freight:'',
-			modifyPrice:0,
-			payType:0,
+			sendCost:'',
 			showCustomer: false,
-			sendType:1,
 			selectJobType:'cgItem',
 			ghsId:0,
+			payWayList:[{name:"本机微信",id:0},{name:"现金",id:4},{name:"支付宝",id:1},{name:"银行卡",id:5}],
+			payWayindex:0,
 			ghsName:''
 		};
 	},
@@ -129,25 +122,21 @@ export default {
 		if (!this.getMerchantInfo) {
 			this.initMerchantInfo().then(data => {
 				uni.setNavigationBarTitle({title:data.name})
-			});
+			})
 		} else {
-			uni.setNavigationBarTitle({
-				title: this.getMerchantInfo.name
-			});
+			uni.setNavigationBarTitle({ title: this.getMerchantInfo.name })
 		}
-		this.modifyPrice = this.allPrice.toFixed(2);
-		this.modifyPrice = parseFloat(this.modifyPrice)
 	},
 	computed: {
-		...mapGetters(["getMerchantInfo", "getLoginInfo","getDictionariesInfo"])
+		...mapGetters(["getMerchantInfo", "getLoginInfo"]),
+		modifyPrice(){
+			let price = Number(this.allPrice) + Number(this.sendCost)
+			price = parseFloat(price)
+			return price
+		},
 	},
 	methods: {
 		...mapActions(["initMerchantInfo"]),
-		countAllPrices(){
-			let allPrices = this.allPrice.toFixed(2)
-			this.modifyPrice = (Number(allPrices) + Number(this.freight)).toFixed(2);
-			this.modifyPrice = parseFloat(this.modifyPrice)
-		},
 		affirmFormSubmit(){
 			if(this.$util.isEmpty(this.selectList)){
 				this.$msg('请选择花材')
@@ -162,22 +151,14 @@ export default {
 				itemId:item.itemId,property:item.property,unitType:unitType,unitPrice:unitPrice}
 				product.push(current)
 			})
-			let options = {
-				sendCost:this.freight,
-				ghsId:this.ghsId,
-				payWay:this.payType,
-				sendType:this.sendType,
-				modifyPrice: this.modifyPrice,
-				product:JSON.stringify(product),
-				hasPay:1
-			};
+			let options = {sendCost:this.sendCost, ghsId:this.ghsId, modifyPrice: this.modifyPrice, product:JSON.stringify(product), payMode:this.payMode}
 			let that = this;
 			uni.showModal({
 				title: '提示',
 				content: '确认提交?',
 				success: function (res) {
 					if (res.confirm) {
-						createOrder(options).then(res => {
+						addVirtualCg(options).then(res => {
 							that.removeFromSaveDirect()
 							let url = '/pagesPurchase/addCgResult'
 							uni.redirectTo({url: url})