123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <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>
- </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:''
- }
- },
- onLoad() {
- this.priceTypeList = this.$store.state.vuex_priceTypeList
- this.priceTypeList.map(item => {
- item.text = item.dispName
- item.fontSize = 30
- })
- },
- 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]
- },
- methods: {
- async pageInit(){
- 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.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
- })
- },
- 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()
- })
- },
- 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')
- }
- }
- }
- </script>
- <style lang="less">
- .content{
- width: 100%;
- height: 100vh;
- }
- </style>
|