|
@@ -1,100 +1,215 @@
|
|
<template>
|
|
<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>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<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() {
|
|
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>
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|
|
<style lang="less">
|
|
- .content{
|
|
|
|
- width: 100%;
|
|
|
|
|
|
+ .page-body{
|
|
height: 100vh;
|
|
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>
|