123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <template>
- <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?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 {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.shelfSn = this.hasShelf.shelfSn
- this.priceShowType = this.$store.state.vuex_priceTypeList
- this.getPriceCofig()
- },
- onShow() {
- this.getRow()
- },
- methods:{
-
- getPriceCofig(){
- this.priceType[0].show = this.configPrice.shelf_cost_show == '1' || this.configPrice.non_shelf_cost_show == '1'
- this.priceType[1].show = this.configPrice.shelf_price_show == '1' || this.configPrice.non_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:'正在修改...'
- })
- updateShelfUserParam(params).then(res => {
- if(res.status == 200){
- this.getRow()
- }
- uni.hideLoading()
- })
- },
-
- 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)
- },
-
- 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'
- })
- },
- }
- }
- </script>
- <style lang="less">
- .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>
|