ソースを参照

采购增加总成本

shish 2 週間 前
コミット
5111f1f52b
1 ファイル変更32 行追加4 行削除
  1. 32 4
      ghsApp/src/pagesPurchase/details.vue

+ 32 - 4
ghsApp/src/pagesPurchase/details.vue

@@ -180,6 +180,10 @@
 							<view v-if="myShopInfo.cgModel == 0">{{perKgFreight}}</view>
 							<input v-else style="border: 1upx solid #eee;color: #3385FF;width: calc(100%);height:70upx;"  type="digit" :disabled="!canIEdit"  @focus="form.avgKgWeight=''" v-model="form.avgKgWeight" placeholder-class="phcolor" class="tui-input" name="avgKgWeight" placeholder="请输入每公斤的运费成本"/>
 						</tui-list-cell>
+						<tui-list-cell class="line-cell" :hover="false">
+							<view class="tui-title ">总成本</view>
+							<view>{{ totalCost }}</view>
+						</tui-list-cell>
 					</block>
 
 					<tui-list-cell class="line-cell" :hover="false">
@@ -194,10 +198,7 @@
 		</view>
 		<view class="under-bar">
 			<view class="price-view">
-				<text class="price-title">金额</text>
-				<text class="price-number">
-					¥ <text class="large">{{ modifyPrice }}</text>
-				</text>
+				<text class="price-title">金额 ¥{{ modifyPrice?parseFloat(modifyPrice) : 0 }} 总成本 ¥{{ totalCost?parseFloat(totalCost) : 0 }}</text>
 			</view>
 			<button v-if="location == 0" class="admin-button-com blue big" @click="formSubmit(0)">下一步</button>
 			<button v-else class="admin-button-com blue big" @click="formSubmit(1)">确认提交</button>
@@ -417,6 +418,32 @@ export default {
 			let calcWeight = realityWeight.toFixed(2);
 			return calcWeight
 		},
+		/**
+		 * 总成本:寄付 = 应付金额 + 提货费 + 本地运费;到付 = 应付金额 + 短途 + 长途 + 提货 + 本地
+		 */
+		totalCost() {
+			let cost = Number(this.modifyPrice) || 0;
+			const pickCharge = Number(this.form.pickCharge);
+			const localCharge = Number(this.form.localCharge);
+			if (pickCharge > 0) {
+				cost += pickCharge;
+			}
+			if (localCharge > 0) {
+				cost += localCharge;
+			}
+			// 到付时短途、长途未计入应付金额,需补入总成本
+			if (Number(this.form.yfPayWay) === 2) {
+				const shortCharge = Number(this.form.shortCharge);
+				const longCharge = Number(this.form.longCharge);
+				if (shortCharge > 0) {
+					cost += shortCharge;
+				}
+				if (longCharge > 0) {
+					cost += longCharge;
+				}
+			}
+			return parseFloat(cost.toFixed(2));
+		},
 		canIEdit() {
 			const { orderSn } = this.option || {};
 			if (!orderSn || this.detailsInfo.status == PURCHASE_ORDER_STATUS.CONFIRM) {
@@ -873,6 +900,7 @@ export default {
 			font-size: 24upx;
 			.price-title {
 				color: #333;
+				font-size: 30upx;
 			}
 			.price-number {
 				margin: 0 10upx;