lilei před 2 roky
rodič
revize
bb9d0fdbbb

+ 2 - 2
App.vue

@@ -1,8 +1,8 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.0.215:9110/saas/clz/', // 本地
-			baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
+			baseUrl: 'http://192.168.0.215:9110/saas/clz/', // 本地
+			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},
 		onLaunch: function() {

+ 25 - 0
api/shelf.js

@@ -306,4 +306,29 @@ export const rewardOrderFindBySn = (params) => {
     data: params,
     method: 'post'
   })
+}
+
+// 用户价格权限配置
+export const queryQplsConfig = (params) => {
+  return request({
+    url: `shelf/storeParam/queryQplsConfig`,
+    data: params,
+    method: 'post'
+  })
+}
+// 用户价格配置列表
+export const queryShelfUserParam = (params) => {
+  return request({
+    url: `shelf/storeParam/queryShelfUserParam`,
+    data: params,
+    method: 'post'
+  })
+}
+// 修改货架用户配置  根据id 修改
+export const updateShelfUserParam = (params) => {
+  return request({
+    url: `shelf/storeParam/updateShelfUserParam`,
+    data: params,
+    method: 'post'
+  })
 }

+ 1 - 23
pages/index/index.vue

@@ -119,7 +119,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, findPriceShow,findPriceShowType,findPriceShowEmployee } from '@/api/shelf.js'
+	import { shelfBondRecordWaitPayRecord, findStoreShelf, shelfGetTotalWaitQty, getProductfindByScanCode } from '@/api/shelf.js'
 	import { xprhStoreApplyRead } from '@/api/xprh.js'
 	import { findCurrentRewardRule } from '@/api/rewardRule.js'
 	import { listLookUp, getLookUpDatas, getCurrUserInfo } from '@/api/data.js';
@@ -256,24 +256,6 @@
 					return true
 				}
 			},
-			// 价格显示
-			async getPriceShow(){
-				await findPriceShow().then(res => {
-					this.showPrice = res.data ? res.data.paramValue=='1' : false
-					this.$store.state.vuex_showPrice[0] = this.showPrice
-				})
-				await findPriceShowType().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 findPriceShowEmployee().then(res => {
-					this.showJhPrice = res.data ? res.data.paramValue=='1' : false
-					this.$store.state.vuex_showPrice[2] = this.showJhPrice
-				})
-			},
 			pageInit(){
 				if(this.hasLogin){
 					// 获取扫描记录
@@ -309,10 +291,6 @@
 				getLookUpDatas({ type: code }).then(res => {
 					if (res.status == 200) {
 						this.$store.state[vuexKey] = res.data || [];
-						if(code=='PRICE_SHOW_TYPE'){
-							// 获取显示价格类型
-							this.getPriceShow()
-						}
 					}
 				});
 			},

+ 19 - 4
pages/morePage/morePage.vue

@@ -48,7 +48,7 @@
 				</u-cell-item>
 			</u-cell-group>
 		</view>
-		<view class="list-box" v-if="$hasPermissions('M_employee_mini')||$hasPermissions('M_roleSetting_mini')||$hasPermissions('M_priceShow_mini')">
+		<view class="list-box" v-if="$hasPermissions('M_employee_mini')||$hasPermissions('M_roleSetting_mini')||($hasPermissions('M_priceShow_mini')&&showPriceSet)">
 			<view class="list-title">
 				<u-icon size="32" name="home"></u-icon> <text>基础设置</text>
 			</view>
@@ -63,7 +63,7 @@
 				</u-cell-item>
 			</u-cell-group>
 			<u-cell-group :border="false">
-				<u-cell-item title="价格显示设置" v-if="$hasPermissions('M_priceShow_mini')" @click="toPage('/pages/storeManage/priceSetting/priceSetting')" :title-style="{fontSize:'1em'}">
+				<u-cell-item title="价格权限/显示设置" v-if="$hasPermissions('M_priceShow_mini')&&showPriceSet" @click="toPage('/pages/storeManage/priceSetting/priceSetting')" :title-style="{fontSize:'1em'}">
 					<text slot="icon"></text>
 				</u-cell-item>
 			</u-cell-group>
@@ -97,11 +97,14 @@
 	    mapState,
 	    mapMutations
 	} from 'vuex'
+	import { queryQplsConfig } from '@/api/shelf.js'
 	export default {
 		data() {
 			return {
 				dealerPhone: null,
-				showPopup: false
+				showPopup: false,
+				showPriceSet: false,
+				shelfSn: null
 			}
 		},
 		computed: {
@@ -118,11 +121,13 @@
 			hasRedPacket(){
 				const rule = this.$store.state.vuex_rewardRule
 				return rule&&rule.ruleStatus == 'release'
-			}
+			},
 		},
 		onShow() {
 			const shelfInfo = this.$store.state.vuex_storeShelf
+			this.shelfSn = shelfInfo.shelfSn
 			this.dealerPhone = shelfInfo&&shelfInfo.contactMobile ? shelfInfo.contactMobile : ''
+			this.getPriceCofig()
 		},
 		methods: {
 			beforeSwitch(index){
@@ -132,6 +137,16 @@
 					return true
 				}
 			},
+			// 获取价格配置
+			getPriceCofig(){
+				queryQplsConfig({shelfSn: this.shelfSn}).then(res => {
+					this.$store.state.vuex_configPrice = res.data || null
+					const ret = [false,false]
+					ret[0]= res.data.shelf_cost_show == '1'
+					ret[1]= res.data.shelf_price_show == '1'
+					this.showPriceSet = ret.filter(item => !!item).length > 1
+				})
+			},
 			// 去扫描
 			openCamera(){
 				if(this.hasLogin){

+ 191 - 76
pages/storeManage/priceSetting/priceSetting.vue

@@ -1,100 +1,215 @@
 <template>
-	<view class="content">
-		<u-cell-group>
-			<u-cell-item title="显示价格">
-				<u-switch slot="right-icon" @change="changeShowPrice" v-model="showPrice"></u-switch>
-			</u-cell-item>
-			<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" @click="clickAction"></u-action-sheet>
+	<view class="page-body">
+		<view class="scroll-list">
+			 <view
+			 class="check-order-list" 
+			 v-for="(item,index) in list" 
+			 :key="item.id" 
+			 >
+			 	<view class="flex align_center justify_between">
+			 		<view class="u-name">
+			 			<text style="margin-right: 0.5rem;">{{item.userName}}</text>
+			 		</view>
+			 		<view class="u-mobile">
+			 			<text v-if="item.isManager == 1">门店负责人 / </text>
+						<text v-else>{{item.roleName}} / </text>
+			 			{{item.phone}}
+			 		</view>
+			 	</view>
+			 	<view class="price-item">
+			 		<u-checkbox-group>
+						<u-checkbox 
+							@change="(e)=>priceChange(e,item)"
+							v-for="(priceItem, priceIndex) in item.priceTypeList" :key="priceItem.id" 
+							v-model="priceItem.checked" 
+							:name="priceItem.val"
+						>{{priceItem.name}}</u-checkbox>
+					</u-checkbox-group>
+			 	</view>
+			 	<view class="price-show-list flex align_center" v-if="item.priceTypeList.length == 2&&item.showListPrice">
+			 		<text>列表显示</text>
+					<view>
+						<u-radio-group v-model="item.showListPriceVal" @change="(e)=>priceShowChange(e,item)">
+							<u-radio 
+								v-for="(priceItem, priceIndex) in priceShowType" :key="priceItem.id" 
+								:name="priceItem.code"
+							>
+								{{priceItem.dispName}}
+							</u-radio>
+						</u-radio-group>
+					</view>
+			 	</view>
+			  </view>
+			  <view style="padding:0 30upx 30upx;">
+			 	 <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
+			 	 <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
+			  </view>
+		</view>
 	</view>
 </template>
 
 <script>
-	import { findPriceShow,findPriceShowType,findPriceShowEmployee,savePriceShow,savePriceShowType,savePriceShowEmployee } from '@/api/shelf'
-	export default {
-		data() {
-			return {
-				showPrice: false,
-				showJhPrice: false,
-				showPriceType: false,
-				priceTypeList:[],
-				priceType:'',
-				priceTypeName:''
+	import {searchEmployee, delEmployee } from '@/api/employee'
+	import { queryQplsConfig, queryShelfUserParam, updateShelfUserParam } from '@/api/shelf.js'
+	import moment from 'moment'
+	export default{
+		name:'personnel',
+		data(){
+			return{
+				status: 'loading',
+				noDataText: '暂无数据',
+				// 查询条件
+				list: [],
+				total: 0,
+				shelfSn: null,
+				priceType:[{
+					val: 'PURCHASES_PRICE',
+					name: '进货价',
+					show: false,
+					checked: false
+				},
+				{
+					val: 'CAR_OWNER_PRICE',
+					name: '车主价',
+					show: false,
+					checked: false
+				}],
+				priceShowType:[]
+			}
+		},
+		computed:{
+			hasShelf(){
+				return this.$store.state.vuex_storeShelf
+			},
+			configPrice(){
+				return this.$store.state.vuex_configPrice
 			}
 		},
 		onLoad() {
-			this.priceTypeList = this.$store.state.vuex_priceTypeList
-			this.priceTypeList.map(item => {
-				item.text = item.dispName
-				item.fontSize = 30
-			})
+			this.shelfSn = this.hasShelf.shelfSn
+			this.priceShowType = this.$store.state.vuex_priceTypeList
+			this.getPriceCofig()
 		},
-		onReady() {
-			// this.pageInit()
-			this.showPrice = this.$store.state.vuex_showPrice[0]
-			this.priceType = this.$store.state.vuex_showPrice[1]
-			this.priceTypeName = this.priceTypeList.find(item => item.code == this.priceType).dispName
-			this.showJhPrice = this.$store.state.vuex_showPrice[2]
+		onShow() {
+			this.getRow()
 		},
-		methods: {
-			async pageInit(){
-				await findPriceShow().then(res => {
-					this.showPrice = res.data ? res.data.paramValue=='1' : false
-					this.$store.state.vuex_showPrice[0] = this.showPrice
+		methods:{
+			// 获取价格配置
+			getPriceCofig(){
+				this.priceType[0].show = this.configPrice.shelf_cost_show == '1'
+				this.priceType[1].show = this.configPrice.shelf_price_show == '1'
+			},
+			priceChange(e,item){
+				console.log(e,item)
+				const row = item.storeParamList.find(k => k.paramCode == e.name)
+				this.updateData({id:row.id,paramValue:e.value?'1':'0'})
+			},
+			priceShowChange(e,item){
+				console.log(e,item)
+				const row = item.storeParamList.find(k => k.paramCode == 'PRICE_SHOW_TYPE')
+				this.updateData({id:row.id,paramValue:e})
+			},
+			// 修改数据
+			updateData(params){
+				uni.showLoading({
+					title:'正在修改...'
 				})
-				await findPriceShowType().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
+				updateShelfUserParam(params).then(res => {
+					if(res.status == 200){
+						this.getRow()
 					}
-				})
-				await findPriceShowEmployee().then(res => {
-					this.showJhPrice = res.data ? res.data.paramValue=='1' : false
-					this.$store.state.vuex_showPrice[2] = this.showJhPrice
+					uni.hideLoading()
 				})
 			},
-			savePrice(data,value){
-				let fun = savePriceShow
-				if(data == 'PRICE_SHOW_TYPE'){
-					fun = savePriceShowType
-				}
-				if(data == 'PRICE_SHOW_EMPLOYEE'){
-					fun = savePriceShowEmployee
-				}
-				fun({
-					paramValue: value
-				}).then(res => {
-					 if(res.status == 200){
-						 uni.showToast({
-						 	icon:'none',
-							title: res.message
-						 })
-					 }
-					 this.pageInit()
+			// 格式化数据
+			formatData(){
+				this.list.map(item => {
+					const a = item.storeParamList
+					const pst = a.find(b=>b.paramCode=='PRICE_SHOW_TYPE') // 列表显示价格值
+					item.showListPriceVal = pst?pst.paramValue:''
+					const cop = a.find(b=>b.paramCode=='CAR_OWNER_PRICE') // 车主价值
+					item.carPriceVal = cop?cop.paramValue:''
+					const pp = a.find(b=>b.paramCode=='PURCHASES_PRICE') // 进货价值
+					item.ppPriceVal = pp?pp.paramValue:''
+					item.priceTypeList = JSON.parse(JSON.stringify(this.priceType.filter(item => item.show)))
+					// 赋值
+					item.priceTypeList.map(key => {
+						key.id = item.userId + '-' + key.val
+						// 车主价
+						if(key.val == 'CAR_OWNER_PRICE'){
+							key.checked = item.carPriceVal == '1'
+						}
+						// 进货价
+						if(key.val == 'PURCHASES_PRICE'){
+							key.checked = item.ppPriceVal == '1'
+						}
+					})
+					// 列表显示价格一行是否显示
+					const showListPrice = item.priceTypeList.filter(item => item.checked)
+					item.showListPrice = showListPrice.length == 2
 				})
+				this.list.splice()
+				console.log(this.list)
 			},
-			changeShowPrice(v){
-				this.savePrice('PRICE_SHOW',v?'1':'0')
-			},
-			clickAction(index){
-				this.savePrice('PRICE_SHOW_TYPE',this.priceTypeList[index].code)
+			// 查询列表
+			getRow () {
+			  let _this = this
+			  this.status = "loading"
+			  queryShelfUserParam({shelfSn: this.shelfSn}).then(res => {
+				if (res.code == 200 || res.status == 204 || res.status == 200) {
+				  _this.list = res.data || []
+				  _this.total = res.data.length
+				} else {
+				  _this.list = []
+				  _this.total = 0
+				  _this.noDataText = res.message
+				}
+				_this.formatData()
+				_this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
+			  })
 			},
-			changeShowJhPrice(v){
-				this.savePrice('PRICE_SHOW_EMPLOYEE',v?'1':'0')
-			}
 		}
 	}
 </script>
 
 <style lang="less">
-	.content{
-		width: 100%;
+	.page-body{
 		height: 100vh;
+		padding:0;
+		.scroll-list{
+			height: 100vh;
+			overflow: auto;
+			.check-order-list{
+				background: #ffffff;
+				padding: 10upx 20upx;
+				margin: 25rpx;
+				border-radius: 20upx;
+				box-shadow: 1px 1px 3px #EEEEEE;
+				> view{
+					padding: 0.8rem 0.5rem;
+					.u-name{
+						font-size: 32rpx;
+					}
+					.u-mobile{
+						color: #999;
+					}
+				}
+			}
+			.price-item{
+				border-top: 1rpx solid #eee;
+				padding-left: 5%;
+			}
+			.price-show-list{
+				margin-left: 5%;
+				border-top: 1rpx solid #eee;
+				>view{
+					padding:0 20rpx;
+				}
+			}
+		}
+		.footer{
+			padding: 0.6rem;
+			background: #ffffff;
+		}
 	}
-</style>
+</style>

+ 1 - 0
store/index.js

@@ -62,6 +62,7 @@ const store = new Vuex.Store({
 		vuex_scanMaxNums: 10, // 最大扫描次数
 		vuex_storeAuthInfo: null ,// 门店认证状态信息
 		vuex_tempData: null, // 临时数据
+		vuex_configPrice: null, // 价格显示配置
 		vuex_tabBarList: [
 			{
 				"pagePath": "/pages/index/index",