| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <template>
- <view class="page">
- <navBar title="设置" :back="true" color="black" background="white" />
- <view class="content">
- <view class="item" style="border-radius: 0rpx 0rpx 0rpx 24rpx;;">
- <view class="line">
- <view class="left">
- 显示售价
- </view>
- <view class="right">
- <u-switch v-model="value1" @change="asyncChange1" :disabled="disAbled1" activeColor="#F7790C"
- inactiveColor="#E6E6E6"></u-switch>
- </view>
- </view>
- <view class="line" v-if="role!='svip'&&role!='gvip'">
- <view class="left">
- 显示会员价
- </view>
- <view class="right">
- <u-switch v-model="value2" @change="asyncChange2" :disabled="disAbled2" activeColor="#F7790C"
- inactiveColor="#E6E6E6"></u-switch>
- </view>
- </view>
- <view class="line" v-if="role!='cydg'">
- <view class="left">
- 显示VIP价
- </view>
- <view class="right">
- <u-switch v-model="value3" @change="asyncChange3" :disabled="disAbled3" activeColor="#F7790C"
- inactiveColor="#E6E6E6"></u-switch>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- components: {
- },
- data() {
- return {
- role: '',
- role: '',
- value1: true,
- value2: false,
- value3: false,
- // switchs: uni.getStorageSync('switchs')
- }
- },
- onLoad(o) {
- this.role = o.role
- console.log(this.disAbled1, this.disAbled2, this.disAbled3);
- },
- onShow() {
- this.value1 = Boolean(this.switchs[0])
- this.value2 = Boolean(this.switchs[1])
- this.value3 = Boolean(this.switchs[2])
- console.log(this.switchs);
- },
- computed: {
- switchs() {
- return uni.getStorageSync('switchs')
- },
- disAbled1() {
- if (!this.value2 && !this.value3 && this.value1) {
- return true
- } else {
- return false
- }
- },
- disAbled2() {
- if (!this.value1 && !this.value3 && this.value2) {
- return true
- } else {
- return false
- }
- },
- disAbled3() {
- if (!this.value2 && !this.value1 && this.value3) {
- return true
- } else {
- return false
- }
- },
- },
- methods: {
- asyncChange1(e) {
- if (e) {
- this.switchs[0] = 1
- if (this.value2) {
- this.value2 = false
- this.switchs[1] = 0
- }
- if (this.value3) {
- this.value3 = false
- this.switchs[2] = 0
- }
- } else {
- this.switchs[0] = 0
- }
- uni.setStorageSync('switchs', this.switchs)
- console.log(this.switchs);
- },
- asyncChange2(e) {
- if (e) {
- this.switchs[1] = 1
- if (this.value1) {
- this.value1 = false
- this.switchs[0] = 0
- }
- if (this.value3) {
- this.value3 = false
- this.switchs[2] = 0
- }
- } else {
- this.switchs[1] = 0
- }
- uni.setStorageSync('switchs', this.switchs)
- console.log(this.switchs);
- },
- asyncChange3(e) {
- if (e) {
- this.switchs[2] = 1
- if (this.value1) {
- this.value1 = false
- this.switchs[0] = 0
- }
- if (this.value2) {
- this.value2 = false
- this.switchs[1] = 0
- }
- } else {
- this.switchs[2] = 0
- }
- uni.setStorageSync('switchs', this.switchs)
- console.log(this.switchs);
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .u-switch--disabled {
- opacity: 1 !important;
- }
- @import "./index.scss";
- </style>
|