lilei 1 yıl önce
ebeveyn
işleme
25ecbddd92
1 değiştirilmiş dosya ile 27 ekleme ve 17 silme
  1. 27 17
      pages/shelfSetting/shelfSet.vue

+ 27 - 17
pages/shelfSetting/shelfSet.vue

@@ -29,7 +29,7 @@
 					<view class="label" style="width: 40%;" @click="showTip(0)">价格权限设置 <u-icon color="#ffaa00"
 							name="question-circle"></u-icon></view>
 					<view class="text flex align_center" style="width: 60%;text-align: right;"
-						@click="updateShowPrice = true">
+						@click="openSetPriceShow">
 						<text style="width: 80%;flex: 1;">{{showPriceStr.length ? showPriceStr.join("/") : '--'}}</text>
 						<u-icon name="arrow-right" color="#969da3" size="28"></u-icon>
 					</view>
@@ -151,6 +151,7 @@
 				showPrice: [],
 				showPriceStr: [],
 				updateShowPrice: false,
+				showPriceBak: [],
 				showMore: false
 			}
 		},
@@ -379,30 +380,39 @@
 			},
 			// 获取价格显示设置
 			getShelfPriceShow() {
-				this.showPrice = []
-				this.showPriceStr = []
 				getShelfPriceShow({
 					shelfSn: this.shelfSn
 				}).then(res => {
 					if (res.status == 200) {
 						const ret = res.data && res.data
-						ret.map(item => {
-							if (item.paramCode == 'shelf_price_show' && item.paramValue == 1) {
-								this.showPriceStr.push("车主价")
-							}
-							if (item.paramCode == 'shelf_cost_show' && item.paramValue == 1) {
-								this.showPriceStr.push("结算价")
-							}
-							this.showPrice.push({
-								paramCode: item.paramCode,
-								paramValue: item.paramValue,
-								text: item.paramCode == 'shelf_price_show' ? '车主价' : '结算价',
-								checked: item.paramValue == 1
-							})
-						})
+						this.showPriceBak = ret
+						this.formatPriceShow()
+					}
+				})
+			},
+			// 格式化价格显示
+			formatPriceShow(){
+				this.showPrice = []
+				this.showPriceStr = []
+				this.showPriceBak.map(item => {
+					if (item.paramCode == 'shelf_price_show' && item.paramValue == 1) {
+						this.showPriceStr.push("车主价")
 					}
+					if (item.paramCode == 'shelf_cost_show' && item.paramValue == 1) {
+						this.showPriceStr.push("结算价")
+					}
+					this.showPrice.push({
+						paramCode: item.paramCode,
+						paramValue: item.paramValue,
+						text: item.paramCode == 'shelf_price_show' ? '车主价' : '结算价',
+						checked: item.paramValue == 1
+					})
 				})
 			},
+			openSetPriceShow(){
+				this.formatPriceShow()
+				this.updateShowPrice = true
+			},
 			// 选择价格显示
 			priceSetChange(e) {
 				console.log(e)