lilei 2 лет назад
Родитель
Сommit
08c6f025d4

+ 3 - 3
api/data.js

@@ -45,14 +45,14 @@ export const getLookUpDatas = (params) => {
   return request({
     url: `lookup/findByLookup/${params.type}`,
     method: 'get'
-  }).then(res=>res.data)
+  })
 }
 // 根据字典code查询所有数据
 export const getAllLookUpDatas = (params) => {
   return request({
     url: `lookup/findAllByLookup/${params.type}`,
     method: 'get'
-  }).then(res=>res.data)
+  })
 }
 // 查询所有数据字典
 export const listLookUp = (params) => {
@@ -60,5 +60,5 @@ export const listLookUp = (params) => {
   return request({
     url: url,
     method: 'post'
-  }).then(res=>res.data)
+  })
 }

+ 8 - 0
api/shelf.js

@@ -253,4 +253,12 @@ export const findPriceShow = (params) => {
     data: params,
     method: 'post'
   })
+}
+// 保存价格设置
+export const savePriceShow = (params) => {
+  return request({
+    url: `shelf/storeParam/saveByParamKey`,
+    data: params,
+    method: 'post'
+  })
 }

+ 1 - 1
pages/digitalShelf/choosePart.vue

@@ -251,7 +251,7 @@
 			this.carInfo = opts.carList?JSON.parse(decodeURIComponent(opts.carList)):null
 			// 获取vin 对应code
 			this.getCarCodeByVin()
-			
+			console.log(this.$store.state.vuex_showPrice)
 			// 游客
 			if(this.userInfo.sysUserFlag == '0'){
 				// 未认证

+ 22 - 1
pages/index/index.vue

@@ -103,7 +103,7 @@
 	} from 'vuex'
 	import scrollBox from '@/components/scrollBox.vue'
 	import UniStatusBar from '@/components/uni-status-bar/uni-status-bar.vue'
-	import { shelfBondRecordWaitPayRecord, findStoreShelf, shelfGetTotalWaitQty, getProductfindByScanCode } from '@/api/shelf.js'
+	import { shelfBondRecordWaitPayRecord, findStoreShelf, shelfGetTotalWaitQty, getProductfindByScanCode, findPriceShow } from '@/api/shelf.js'
 	import { xprhStoreApplyRead } from '@/api/xprh.js'
 	import { listLookUp, getLookUpDatas } from '@/api/data.js';
 	import { scanVinLogQueryRoll, getScanVinLogList, getScanGetMaxQty }from '@/api/car.js'
@@ -202,6 +202,23 @@
 			}
 		},
 		methods: {
+			async getPriceShow(){
+				await findPriceShow({paramCode:'PRICE_SHOW'}).then(res => {
+					this.showPrice = res.data ? res.data.paramValue=='1' : false
+					this.$store.state.vuex_showPrice[0] = this.showPrice
+				})
+				await findPriceShow({paramCode:'PRICE_SHOW_TYPE'}).then(res => {
+					if(res.data&&res.data.paramValue){
+						this.priceType = res.data.paramValue
+						this.priceTypeName = this.$store.state.vuex_priceTypeList.find(item => item.code == res.data.paramValue).dispName
+						this.$store.state.vuex_showPrice[1] = this.priceType
+					}
+				})
+				await findPriceShow({paramCode:'PRICE_SHOW_EMPLOYEE'}).then(res => {
+					this.showJhPrice = res.data ? res.data.paramValue=='1' : false
+					this.$store.state.vuex_showPrice[2] = this.showJhPrice
+				})
+			},
 			pageInit(){
 				if(this.hasLogin){
 					// 获取扫描记录
@@ -238,6 +255,10 @@
 				getLookUpDatas({ type: code }).then(res => {
 					if (res.status == 200) {
 						this.$store.state[vuexKey] = res.data || [];
+						if(code=='PRICE_SHOW_TYPE'){
+							// 获取显示价格类型
+							this.getPriceShow()
+						}
 					}
 				});
 			},

+ 51 - 14
pages/storeManage/priceSetting/priceSetting.vue

@@ -2,44 +2,81 @@
 	<view class="content">
 		<u-cell-group>
 			<u-cell-item title="显示价格">
-				<u-switch slot="right-icon" v-model="showPrice"></u-switch>
+				<u-switch slot="right-icon" @change="changeShowPrice" v-model="showPrice"></u-switch>
 			</u-cell-item>
-			<u-cell-item title="显示价格类型" value="请选择" @click="showPriceType=true"></u-cell-item>
-			<u-cell-item title="员工是否可见进货价">
-				<u-switch slot="right-icon" v-model="showJhPrice"></u-switch>
+			<u-cell-item title="显示价格类型" v-if="showPrice" :value="priceTypeName||'请选择'" @click="showPriceType=true"></u-cell-item>
+			<u-cell-item title="员工是否可见进货价" v-if="showPrice&&priceType == 'PURCHASES_PRICE'">
+				<u-switch slot="right-icon" @change="changeShowJhPrice" v-model="showJhPrice"></u-switch>
 			</u-cell-item>
 		</u-cell-group>
-		<u-action-sheet :list="priceTypeList" v-model="showPriceType"></u-action-sheet>
+		<!-- 价格类型列表 -->
+		<u-action-sheet :list="priceTypeList" v-model="showPriceType" @click="clickAction"></u-action-sheet>
 	</view>
 </template>
 
 <script>
-	import { findPriceShow } from '@/api/shelf'
+	import { findPriceShow, savePriceShow } from '@/api/shelf'
 	export default {
 		data() {
 			return {
 				showPrice: false,
 				showJhPrice: false,
 				showPriceType: false,
-				priceTypeList:[]
+				priceTypeList:[],
+				priceType:'',
+				priceTypeName:''
 			}
 		},
 		onLoad() {
-			this.getPrice('PRICE_SHOW')
-		},
-		onReady() {
 			this.priceTypeList = this.$store.state.vuex_priceTypeList
 			this.priceTypeList.map(item => {
 				item.text = item.dispName
 				item.fontSize = 30
 			})
-			console.log(this.$store.state)
+		},
+		onReady() {
+			this.pageInit()
 		},
 		methods: {
-			getPrice(data){
-				findPriceShow({paramCode:data}).then(res => {
-					console.log(res)
+			async pageInit(){
+				await findPriceShow({paramCode:'PRICE_SHOW'}).then(res => {
+					this.showPrice = res.data ? res.data.paramValue=='1' : false
+					this.$store.state.vuex_showPrice[0] = this.showPrice
+				})
+				await findPriceShow({paramCode:'PRICE_SHOW_TYPE'}).then(res => {
+					if(res.data&&res.data.paramValue){
+						this.priceType = res.data.paramValue
+						this.priceTypeName = this.priceTypeList.find(item => item.code == res.data.paramValue).dispName
+						this.$store.state.vuex_showPrice[1] = this.priceType
+					}
+				})
+				await findPriceShow({paramCode:'PRICE_SHOW_EMPLOYEE'}).then(res => {
+					this.showJhPrice = res.data ? res.data.paramValue=='1' : false
+					this.$store.state.vuex_showPrice[2] = this.showJhPrice
+				})
+			},
+			savePrice(data,value){
+				savePriceShow({
+					paramCode:data,
+					paramValue: value
+				}).then(res => {
+					 if(res.status == 200){
+						 uni.showToast({
+						 	icon:'none',
+							title: res.message
+						 })
+					 }
+					 this.pageInit()
 				})
+			},
+			changeShowPrice(v){
+				this.savePrice('PRICE_SHOW',v?'1':'0')
+			},
+			clickAction(index){
+				this.savePrice('PRICE_SHOW_TYPE',this.priceTypeList[index].code)
+			},
+			changeShowJhPrice(v){
+				this.savePrice('PRICE_SHOW_EMPLOYEE',v?'1':'0')
 			}
 		}
 	}

+ 1 - 0
store/index.js

@@ -50,6 +50,7 @@ const store = new Vuex.Store({
 		vuex_allLookUp: [],  //  数据字典
 		vuex_paymentTypeList: [], // 支付方式
 		vuex_priceTypeList:[], // 价格类型
+		vuex_showPrice:[false,'',false], // 价格显示规则
 		vuex_userInfo:  null, // 用户信息
 		vuex_userPhoto: null, // 用户头像
 		vuex_permCodes: [], // 权限码