From df91b4560ed0f60a2d9c5896770c97775eefeb9a Mon Sep 17 00:00:00 2001 From: guoxing <1369478551@qq.com> Date: Thu, 23 Feb 2023 13:42:04 +0800 Subject: [PATCH] =?UTF-8?q?2023-02-23=20=E4=BF=9D=E5=AD=98=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/coolc-coupon/coolc-coupon.vue | 54 ++- .../components/w-select/readme.md | 70 ++++ .../components/w-select/w-select.vue | 395 ++++++++++++++++++ mallplusui-uniapp-app/package.json | 32 +- .../pages/order/createOrder.vue | 2 +- .../pages/order/createStoreOrder.vue | 2 +- .../pagesU/address/address.vue | 2 +- .../pagesU/address/addressManage.vue | 56 ++- mallplusui-uniapp-app/store/index.js | 6 +- 9 files changed, 557 insertions(+), 62 deletions(-) create mode 100644 mallplusui-uniapp-app/components/w-select/readme.md create mode 100644 mallplusui-uniapp-app/components/w-select/w-select.vue diff --git a/mallplusui-uniapp-app/components/coolc-coupon/coolc-coupon.vue b/mallplusui-uniapp-app/components/coolc-coupon/coolc-coupon.vue index 7fdae18..f2dae47 100644 --- a/mallplusui-uniapp-app/components/coolc-coupon/coolc-coupon.vue +++ b/mallplusui-uniapp-app/components/coolc-coupon/coolc-coupon.vue @@ -8,8 +8,8 @@ 满{{ item.minPoint }} 减 {{ item.amount }} - 立即领取 + + 立即领取 @@ -58,28 +58,42 @@ }, }, computed: { - ...mapState(['hasLogin', 'userInfo']), + ...mapState(['hasLogin','hasVip', 'userInfo']), }, methods: { async acceptCoupon(item) { if (this.hasLogin) { - this.types = !this.types - uni.showLoading({ - title: '请稍后' - }); - - let params = { - couponId: item.id - }; - this.clickSubMethod(item) - let data = await Api.apiCall('post', Api.index.acceptCoupon, params); - // console.log("data?????", data); - // if (data) { - // // this.$api.msg(data); - // this.clickSubMethod(item) - - // } - uni.hideLoading(); + if(this.hasVip){ + this.types = !this.types + uni.showLoading({ + title: '请稍后' + }); + + let params = { + couponId: item.id + }; + this.clickSubMethod(item) + let data = await Api.apiCall('post', Api.index.acceptCoupon, params); + // console.log("data?????", data); + // if (data) { + // // this.$api.msg(data); + // this.clickSubMethod(item) + + // } + uni.hideLoading(); + }else{ + uni.showModal({ + title: '提示', + content: '您不属于惠农会员,暂不能领取此优惠券', + showCancel:false, + success: function(res) { + if (res.confirm) { + return; + } + } + }); + } + } else { uni.navigateTo({ url: '/pages/public/login' diff --git a/mallplusui-uniapp-app/components/w-select/readme.md b/mallplusui-uniapp-app/components/w-select/readme.md new file mode 100644 index 0000000..e7ec2d0 --- /dev/null +++ b/mallplusui-uniapp-app/components/w-select/readme.md @@ -0,0 +1,70 @@ +#### props + +|名称 |类型 |默认值 |说明| +|- |- |- |-| +|width |string |'300rpx' |选择框宽度| +|height |string |'60rpx' |选择框高度| +|round |boolean |true |是否开启圆角| +|bgColor|string |'#fff' |选择框的背景颜色| +|color |string |'#606266' |字体颜色| +|placeholderColor|string |'color:#bcbec4' |提示文字的字体颜色| +|defaultValue |string |'请选择' |默认显示的名称 | | +|valueName|string |'value' |显示的内容字段名,必传| +|list |array |[] |展示的内容列表| +|showClose|boolean |true |是否显示删除按钮| +|multiple|boolean |false |是否开启多选| +|filterable|boolean |false |是否开启搜索功能,开启后直接输入值不选择也可以保存内容| + + +#### events + +|事件名|说明| +|-|-| +|change|选择的内容改变时触发,返回的参数为列表的item| + + +#### 使用举例 + +需要绑定的值通过`v-model`绑定,如下面的`chooseValue`,需要获取item的值可以监听`@change`事件 + +开启多选`multiple`时,双向绑定的值为数组类型,在change事件中根据自己需求进行处理。 + +`valueName`属性必须传,告知组件需要显示的是什么值 + +```html + + +``` \ No newline at end of file diff --git a/mallplusui-uniapp-app/components/w-select/w-select.vue b/mallplusui-uniapp-app/components/w-select/w-select.vue new file mode 100644 index 0000000..0cecc39 --- /dev/null +++ b/mallplusui-uniapp-app/components/w-select/w-select.vue @@ -0,0 +1,395 @@ + + + diff --git a/mallplusui-uniapp-app/package.json b/mallplusui-uniapp-app/package.json index 81b7506..a3fa822 100644 --- a/mallplusui-uniapp-app/package.json +++ b/mallplusui-uniapp-app/package.json @@ -1,17 +1,17 @@ { - "name": "uniapp", - "version": "1.0.0", - "description": "宇运动商城", - "main": "main.js", - "dependencies": { - "amap-js": "^1.2.1", - "jweixin-module": "^1.6.0", - "weixin-js-sdk": "^1.4.0-test" - }, - "devDependencies": {}, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC" -} + "id": "w-select", + "displayName": "下拉选择框w-select", + "version": "1.1.3", + "description": "用于下拉选择,使用v-model双向绑定值", + "keywords": [ + "下拉选择框", + "单选框", + "vue2" + ], + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ] + } +} \ No newline at end of file diff --git a/mallplusui-uniapp-app/pages/order/createOrder.vue b/mallplusui-uniapp-app/pages/order/createOrder.vue index 7b5b3a8..fd53e31 100644 --- a/mallplusui-uniapp-app/pages/order/createOrder.vue +++ b/mallplusui-uniapp-app/pages/order/createOrder.vue @@ -10,7 +10,7 @@ {{ addressData.phoneNumber }} {{ addressData.province }}-{{ addressData.city }}-{{ addressData.region }}-{{ addressData.detailAddress }} + class="address">{{ addressData.region }}-{{ addressData.detailAddress }} 请设置收货地址 diff --git a/mallplusui-uniapp-app/pages/order/createStoreOrder.vue b/mallplusui-uniapp-app/pages/order/createStoreOrder.vue index c5adb30..002fad7 100644 --- a/mallplusui-uniapp-app/pages/order/createStoreOrder.vue +++ b/mallplusui-uniapp-app/pages/order/createStoreOrder.vue @@ -9,7 +9,7 @@ {{ addressData.name }} {{ addressData.phoneNumber }} - {{ addressData.province }}-{{ addressData.city }}-{{ addressData.region }}-{{ addressData.detailAddress }} + {{ addressData.region }}-{{ addressData.detailAddress }} 请设置收货地址 diff --git a/mallplusui-uniapp-app/pagesU/address/address.vue b/mallplusui-uniapp-app/pagesU/address/address.vue index d70e754..c043eb2 100644 --- a/mallplusui-uniapp-app/pagesU/address/address.vue +++ b/mallplusui-uniapp-app/pagesU/address/address.vue @@ -8,7 +8,7 @@ 默认 - {{ item.province }}-{{ item.city }}-{{ item.region }}-{{ item.detailAddress }} + {{ item.region }}-{{ item.detailAddress }} diff --git a/mallplusui-uniapp-app/pagesU/address/addressManage.vue b/mallplusui-uniapp-app/pagesU/address/addressManage.vue index 69492d2..03e0114 100644 --- a/mallplusui-uniapp-app/pagesU/address/addressManage.vue +++ b/mallplusui-uniapp-app/pagesU/address/addressManage.vue @@ -11,13 +11,17 @@ - + 所在地 - - + + + + + - +