Răsfoiți Sursa

采购时增加,包装重量、实付金额和损耗减免

jf 5 ani în urmă
părinte
comite
15106df2d3

+ 1 - 1
ghsApp/src/components/plugin/modal.vue

@@ -136,7 +136,7 @@ export default {
 		handleClickCancel() {
 			// if (!this.maskClosable)return;
 			// this.$emit('cancel')
-			// this.$emit('click', {index: 0})
+			this.$emit('click', {index: 3})
 			// if (!this.maskClosable)return;
 		}
 	}

+ 13 - 7
ghsApp/src/mixins/product.js

@@ -466,15 +466,21 @@ export default {
 		},
 		//减去所有商品
 		delAllEvent(item) {
-			const list = this.selectList;
-			for (let index = 0; index < list.length; index++) {
-				const element = list[index];
-				if (element.id == item.id ) {
-					list.splice(index, 1);
-					break;
+			let list = this.selectList;
+			if(list.length==1){
+				this.setSelectInfoByType({ type: this.pageType, info: [] });
+			}else{
+				for (let index = 0; index < list.length; index++) {
+					const element = list[index];
+					if (element.id == item.id ) {
+						list.splice(index, 1);
+						break;
+					}
 				}
+				this.setSelectInfoByType({ type: this.pageType, info: list });
 			}
-			this.setSelectInfoByType({ type: this.pageType, info: list });
+
+
 			console.log('this.selectList减去所有',this.selectList)
 		},
 		// /**

+ 6 - 1
ghsApp/src/pagesPurchase/add.vue

@@ -209,12 +209,17 @@ export default {
 			this.isAloneAllFocus=false;
 			this.$nextTick(()=>{
 				console.log('customData',this.customData);
+				console.log('val.index',val.index);
+				if (val.index === 3) {
+					this.modalCancel();
+					this.delAllEvent(this.customData);
+					return
+				}
 				if(this.customData.bigCount==0 && this.customData.smallCount==0){
 					this.delAllEvent(this.customData)}
 
 				if (val.index === 0) {
 					this.modalCancel();
-					this.delAllEvent(this.customData)
 				} else {
 					if(this.customData.itemPrice==0||this.customData.itemPrice==''){
 						uni.showToast({title:"请输入总价格",icon:"none"})

+ 44 - 23
ghsApp/src/pagesPurchase/details.vue

@@ -47,7 +47,7 @@
 							<view class="describe-view">
 								共{{ selectList.length }}种,
 								<!-- 共16扎9支, -->
-								合计 ¥<text class="price">{{ allPrice }}</text>
+								合计 ¥<text class="price">{{ selectAllPrice }}</text>
 							</view>
 						</view>
 					</view>
@@ -80,41 +80,49 @@
 					</tui-list-cell> -->
 				</view>
 				<view class="module-com input-line-wrap">
+					<tui-list-cell class="line-cell" :hover="false">
+						<view class="tui-title ">包装重量</view>
+						<input type="digit" :disabled="!canIEdit" v-model="form.packWeight" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="公斤"/>
+					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false">
 						<view class="tui-title ">打包费</view>
-						<input type="digit" :disabled="!canIEdit" v-model="form.packingCharge" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="请填写,留空没有费用"/>
+						<input type="digit" @input="inputFn" :disabled="!canIEdit" v-model="form.packingCharge" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="请填写,留空没有费用"/>
 					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false">
 						<view class="tui-title ">短途运费</view>
-						<input  type="digit" :disabled="!canIEdit" v-model="form.shortCharge" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="请填写,留空没有费用"/>
+						<input  type="digit" @input="inputFn" :disabled="!canIEdit" v-model="form.shortCharge" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="请填写,留空没有费用"/>
 					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false">
 						<view class="tui-title ">长途运费</view>
-						<input  type="digit" :disabled="!canIEdit" v-model="form.longCharge" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="请填写,留空没有费用"/>
+						<input  type="digit" @input="inputFn" :disabled="!canIEdit" v-model="form.longCharge" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="请填写,留空没有费用"/>
 					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false">
 						<view class="tui-title ">提货费</view>
-						<input  type="digit" :disabled="!canIEdit" v-model="form.pickCharge" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="请填写,留空没有费用"/>
+						<input  type="digit" @input="inputFn" :disabled="!canIEdit" v-model="form.pickCharge" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="请填写,留空没有费用"/>
 					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false">
 						<view class="tui-title ">本地运费</view>
-						<input  type="digit" :disabled="!canIEdit" v-model="form.localCharge" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="请填写,留空没有费用"/>
+						<input  type="digit" @input="inputFn" :disabled="!canIEdit" v-model="form.localCharge" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="请填写,留空没有费用"/>
 					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false" :arrow="true">
 						<view class="tui-title ">入库日期</view>
-						<!-- <view class="tui-input" v-if="form.province || form.city">
-							{{ form.province + "-" + form.city }}
-						</view> -->
-						<!-- <view class="tui-placeholder" v-else>请选择</view>
-						<input v-model="form.province" name="province" hidden /> -->
-						<AppDatePicker
-							v-if="canIEdit"
-							:dateVal="form.entryTime"
-							:placeholder="'请选择日期'"
-						/>
+						<AppDatePicker v-if="canIEdit" :dateVal="form.entryTime" :placeholder="'请选择日期'"/>
 						<view v-else>{{ form.entryTime || "请选择日期" }}</view>
 					</tui-list-cell>
 
+					<tui-list-cell class="line-cell" :hover="false">
+						<view class="tui-title ">总金额</view>
+						<view>{{totalPrice}}</view>
+					</tui-list-cell>
+					<tui-list-cell class="line-cell" :hover="false">
+						<view class="tui-title ">实付金额</view>
+						<input  type="digit" :disabled="!canIEdit" v-model="realMoney" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="请填写,留空没有费用"/>
+					</tui-list-cell>
+					<tui-list-cell class="line-cell" :hover="false">
+						<view class="tui-title ">损耗减免</view>
+						<view>{{totalPrice - realMoney }}</view>
+					</tui-list-cell>
+
 					<tui-list-cell class="line-cell remark-wrap" :hover="false">
 						<view class="tui-title">备注</view>
 						<view class="tui-input">
@@ -132,9 +140,10 @@
 		</view>
 		<view class="under-bar">
 			<view class="price-view">
-				<text class="price-title">金额</text>
+				<text class="price-title">实付金额</text>
 				<text class="price-number">
-					¥ <text class="large">{{ Number(allPrice) + Number(form.packingCharge) + Number(form.shortCharge) + Number(form.longCharge) + Number(form.pickCharge) + Number(form.localCharge) }}</text>
+					<!--¥ <text class="large">{{ Number(allPrice) + Number(form.packingCharge) + Number(form.shortCharge) + Number(form.longCharge) + Number(form.pickCharge) + Number(form.localCharge) }}</text>-->
+					¥ <text class="large">{{ realMoney }}</text>
 				</text>
 			</view>
 			<button class="admin-button-com blue middle" v-if="canIEdit" @click="formSubmit">
@@ -188,12 +197,15 @@ export default {
 				longCharge: "",
 				pickCharge: "",
 				localCharge: "",
+				packWeight: "",
 
 				entryTime: "",
 				ghsId: null
 			},
 			showCustomer: false,
-			detailsInfo: {}
+			detailsInfo: {},
+			totalPrice:0,
+			realMoney:0,
 		};
 	},
 	onLoad() {
@@ -203,15 +215,15 @@ export default {
 		if(!this.$util.isEmpty(uni.getStorageSync("newGhs"))){
 			this.showCustomer = true;
 		}
+		this.selectAllPrice();
 	},
 	onUnload(){
 		uni.removeStorageSync('newGhs');
 	},
 	computed: {
 		...mapGetters(["getMerchantInfo", "getLoginInfo"]),
-		allPrice() {
+		selectAllPrice(){
 			let price = 0;
-
 			if (this.selectList) {
 				console.log(this.selectList,'selectList')
 				for (const item of this.selectList) {
@@ -222,7 +234,16 @@ export default {
 					}
 				}
 			}
-			return Math.round(price * 100) / 100;
+			this.realMoney = price.toFixed(2);
+			return price.toFixed(2);
+		},
+		inputFn(e) {
+			let price = Number(this.selectAllPrice);
+			price = price + Number(this.form.packingCharge) + Number(this.form.shortCharge) + Number(this.form.longCharge) + Number(this.form.pickCharge) + Number(this.form.localCharge)
+			this.totalPrice = price.toFixed(2);
+			this.realMoney = price.toFixed(2);
+
+			// return price.toFixed(2);
 		},
 		canIEdit() {
 			const { orderSn } = this.option || {};
@@ -321,7 +342,7 @@ export default {
 				if (!this.getMerchantInfo) {
 					await this.initMerchantInfo();
 				}
-				await createPurchaseOrderApi(formData);
+				await createPurchaseOrderApi({...formData,realPrice:this.realMoney});
 				uni.setStorageSync('flowersItemInfo', itemInfo);
 				this.resetSelectInfoByType(this.pageType);
 				uni.navigateTo({url:'/pagesPurchase/components/pageSuccess?title=新增成功'})