From 8478015e961b93963e0a269d92c281d84da44f63 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期一, 09 九月 2024 23:47:09 +0800 Subject: [PATCH] update 会员信息、兑换商品等 --- sub_pages/customer/self/member-center.vue | 182 +++++++++ sub_pages/customer/coupon/coupon-self.vue | 38 + common/global.scss | 18 + sub_pages/customer/self/history.vue | 2 pages/user/user-customer.scss | 32 sub_pages/customer/coupon/good-all.vue | 2 static/images/customer/coupon/coupon-bg-user.png | 0 store/index.js | 17 manifest.json | 2 static/images/customer/coupon/member/member-level-bg.png | 0 sub_pages/customer/self/collect.vue | 2 sub_pages/customer/coupon/point-history.vue | 77 ++++ sub_pages/customer/shopping/confirm.vue | 98 +++++ components/banner3d/banner3d.vue | 416 +++++++++++++++++++++++ static/images/customer/coupon/member/icon-member-4.png | 0 pages/order/order-detail.vue | 48 ++ sub_pages/customer/coupon/good-self.vue | 84 ++++ pages/user/supplier-user.vue | 22 18 files changed, 973 insertions(+), 67 deletions(-) diff --git a/common/global.scss b/common/global.scss index e7e7a07..8dd0225 100644 --- a/common/global.scss +++ b/common/global.scss @@ -238,6 +238,24 @@ .component-stock-zero{ position: relative; } +.component-status-zero{ + position: absolute; + line-height: 100%; + // font-size: ; + left: -2rpx; + right: -2rpx; + top: -2rpx; + bottom: -2rpx; + font-size: 600; + content: '已下架'; + color: #fff; + text-align: center; + padding-top: calc(50% - 20rpx); + background-color: #52525275; +} +.component-status-zero{ + position: relative; +} .component-popup_input{ margin: 0 auto; margin-top: 160rpx; diff --git a/components/banner3d/banner3d.vue b/components/banner3d/banner3d.vue new file mode 100644 index 0000000..4e2b8df --- /dev/null +++ b/components/banner3d/banner3d.vue @@ -0,0 +1,416 @@ +<template> + <div class="banner-container"> + <swiper :style="{width: '100vw', height: '410rpx'}" :indicator-dots="swiperConfig.indicatorDots" + :indicator-color="swiperConfig.indicatorColor" :indicator-active-color="swiperConfig.indicatorActiveColor" + :autoplay="swiperConfig.autoplay" :interval="swiperConfig.interval" :duration="swiperConfig.duration" + :circular="swiperConfig.circular" :previous-margin="swiperConfig.previousMargin" + :next-margin="swiperConfig.nextMargin" @change="swiperChange" @animationfinish="animationfinish"> + <swiper-item v-for="(item, i) in bannerList" :key="i"> + <!-- 1.当前展示为第1项时,bannerList最后一项和第二项的justifyContent值分别为flex-end和flex-start,其余项值为center --> + <!-- 2.当前展示为最后一项时,bannerList倒数第2项和第1项的justifyContent值分别为flex-end和flex-start,其余项值为center --> + <!-- 3.当前展示为其他项(非第1和最后1项)时,bannerList当前项的前1项和后1项的justifyContent值分别为flex-end和flex-start,其余项值为center --> + <!-- 4.padding值也需要根据不同项设定不同值,但理同justifyContent --> + <div class="image-container" :style="{ + transform: curIndex===i?'scale(' + scaleX + ',' + scaleY + ')':'scale(1,1)', + transitionDuration: '.3s', + transitionTimingFunction: 'ease' + }" :class="[curIndex===0?((i===listLen-1)?'item-left':(i===1?'item-right':'item-center')):(curIndex===listLen-1?(i===0?'item-right':(i===listLen-2?'item-left':'item-center')):(i===curIndex-1?'item-left':(i===curIndex+1?'item-right':'item-center')))]"> + <image :src="item.bg" class="slide-image" /> + <image :src="item.picture" class="icon-image" :class="[`v${i+1}`]" mode="aspectFit"></image> + <view class="container" :class="[`v${i+1}`]"> + <view class="title">{{bannerList[i].title}}</view> + <view class="line-component" v-if="bannerList[i].point"> + <view class="line-bg"> + <view class="tip" + :style="{'left':(bannerList[i].point.end&&(bannerList[i].point.current/bannerList[i].point.end)||0).toFixed(2)*100+'%'}"> + {{bannerList[i].point.current || 0}} + </view> + <view class="tip-loc" + :style="{'left':(bannerList[i].point.end&&(bannerList[i].point.current/bannerList[i].point.end)||0).toFixed(2)*100+'%'}"> + </view> + </view> + + <view class="desc"> + <span + v-if="bannerList[i].point.end">{{bannerList[i].point.current || 0}}/{{bannerList[i].point.end}},升级还需{{bannerList[i].point.end-bannerList[i].point.current}}成长值</span> + <span v-else>成长值:{{bannerList[i].point.current || 0}}</span> + </view> + </view> + </view> + </div> + </swiper-item> + </swiper> + <!-- <div class="desc-wrap" :class="[isDescAnimating?'hideAndShowDesc':'']"> + <div class="title">{{bannerList[descIndex].title}}</div> + <div class="desc">{{bannerList[descIndex].description}}</div> + </div> --> + </div> +</template> +<script> + export default { + props: { + bannerList: { + type: Array, + default () { + return [] + } + }, + swiperConfig: { + type: Object, + default () { + return { + indicatorDots: true, + indicatorColor: 'rgba(255, 255, 255, .4)', + indicatorActiveColor: 'rgba(255, 255, 255, 1)', + autoplay: false, + interval: 3000, + duration: 300, + circular: true, + previousMargin: '58rpx', + nextMargin: '58rpx' + } + } + }, + scaleX: { + type: String, + default: (634 / 550).toFixed(4) + }, + scaleY: { + type: String, + default: (378 / 328).toFixed(4) + } + }, + computed: { + listLen() { + return this.bannerList.length + } + }, + data() { + return { + curIndex: 0, + descIndex: 0, + isDescAnimating: false + } + }, + methods: { + swiperChange(e) { + const that = this + this.curIndex = e.mp.detail.current + this.isDescAnimating = true + let timer = setTimeout(function() { + that.descIndex = e.mp.detail.current + clearTimeout(timer) + }, 150) + }, + animationfinish(e) { + this.isDescAnimating = false + }, + // getBannerDetail(index) { + // uni.showLoading({ + // title: '将前往详情页面', + // duration: 2000, + // mask: true + // }) + // } + } + } +</script> +<style lang="scss" scoped> + .banner-container { + width: 100vw; + height: 454rpx; + + .image-container { + box-sizing: border-box; + width: 100%; + height: 100%; + display: flex; + position: relative; + + .slide-image { + width: 550rpx; + height: 328rpx; + z-index: 200; + position: relative; + z-index: 0; + } + + .icon-image { + position: absolute; + right: 50rpx; + top: 26rpx; + z-index: 1; + background-size: 100% 100%; + width: 196rpx; + height: 254rpx; + } + + .icon-image.v4 { + top: 10rpx; + } + + .container { + position: absolute; + left: 90rpx; + right: 90rpx; + top: 90rpx; + bottom: 90rpx; + z-index: 1; + + .title { + font-weight: 600; + font-size: 56rpx; + line-height: 80rpx; + text-align: left; + margin-top: 60rpx; + font-style: normal; + } + + .line-component { + margin-top: 60rpx; + + .desc { + font-size: 24rpx; + font-weight: 600; + font-size: 24rpx; + // color: #7D5809; + line-height: 34rpx; + text-align: left; + margin-top: 16rpx; + } + + .line-bg { + width: 322rpx; + height: 12rpx; + // background: #A1B8CC; + border-radius: 6rpx; + position: relative; + + .tip-loc { + width: 22rpx; + height: 12rpx; + // background: #D7E5F3; + border-radius: 6rpx; + position: absolute; + left: 0; + top: 0; + bottom: 0; + border-radius: 6rpx; + } + + .tip { + min-width: 52rpx; + padding-left: 20rpx; + padding-right: 20rpx; + height: 28rpx; + font-size: 20rpx; + + // background: #D7E5F3; + // color: #85A7E3; + line-height: 28rpx; + text-align: center; + font-style: normal; + position: absolute; + left: 0; + top: -40rpx; + } + } + + } + } + + .container.v1 { + .title { + color: #7CC662; + } + + .line-component { + .desc { + color: #6DA05C; + } + + .line-bg { + background: #AECD96; + + .tip-loc { + background: #DEE9CF; + } + + .tip { + background: #DEE9CF; + color: #6DA05C; + } + } + } + } + + .container.v2 { + .title { + color: #7498E0; + } + + .line-component { + .desc { + color: #809BB5; + } + + .line-bg { + background: #A1B8CC; + + .tip-loc { + background: #D7E5F3; + } + + .tip { + background: #D7E5F3; + color: #809BB5; + } + } + } + } + + .container.v3 { + .title { + color: #C47810; + } + + .line-component { + .desc { + color: #7D5809; + } + + .line-bg { + background: #D1B067; + + .tip-loc { + background: #FFF0CE; + } + + .tip { + background: #FFF0CE; + color: #7D5809; + } + } + } + } + + .container.v4 { + .title { + color: #DD834E; + } + + .line-component { + .desc { + color: #B66A2C; + } + + .line-bg { + background: #D69975; + + .tip-loc { + background: #FACAAE; + } + + .tip { + background: #FACAAE; + color: #B66A2C; + } + } + } + } + } + + .item-left { + justify-content: flex-end; + padding: 56rpx 26rpx 0 0; + } + + .item-right { + justify-content: flex-start; + padding: 56rpx 0 0 26rpx; + } + + .item-center { + justify-content: center; + padding: 56rpx 0 0 0; + } + + .desc-wrap { + box-sizing: border-box; + width: 100%; + height: 98rpx; + padding: 24rpx 66rpx 0; + + .title { + width: 100%; + height: 42rpx; + line-height: 42rpx; + color: #222222; + font-size: 30rpx; + font-family: 'PingFangTC-Regular'; + font-weight: 600; + text-align: left; + } + + .desc { + margin-top: 4rpx; + width: 100%; + height: 34rpx; + line-height: 34rpx; + color: #999999; + font-size: 24rpx; + font-family: 'PingFangTC-Regular'; + text-align: left; + } + } + + @keyframes descAnimation { + 0% { + opacity: 1; + } + + 25% { + opacity: .5; + } + + 50% { + opacity: 0; + } + + 75% { + opacity: .5; + } + + 100% { + opacity: 1; + } + } + + @-webkit-keyframes descAnimation { + 0% { + opacity: 1; + } + + 25% { + opacity: .5; + } + + 50% { + opacity: 0; + } + + 75% { + opacity: .5; + } + + 100% { + opacity: 1; + } + } + + .hideAndShowDesc { + animation: descAnimation .3s ease 1; + -webkit-animation: descAnimation .3s ease 1; + } + } +</style> \ No newline at end of file diff --git a/manifest.json b/manifest.json index 782394c..2848179 100644 --- a/manifest.json +++ b/manifest.json @@ -49,7 +49,7 @@ "quickapp" : {}, /* 快应用特有相关 */ "mp-weixin" : { - "appid" : "wx6d0ecc4e18710458", + "appid" : "wx1441324401626290", "setting" : { "urlCheck" : false, "es6" : true, diff --git a/pages/order/order-detail.vue b/pages/order/order-detail.vue index 4ff01fd..6018509 100644 --- a/pages/order/order-detail.vue +++ b/pages/order/order-detail.vue @@ -101,7 +101,12 @@ if (code === 0) { this.dto = { ...this.dto, - ...data + ...data, + // pointGoodsList: [{ + // name: '1', + // num: 1, + // description: 'descriptiondescriptiondescriptiondescriptiondescription' + // }] } } }, @@ -223,7 +228,7 @@ id: this.id, } }) - + this.$message.hideLoading() if (code === 0) { //微信接口 @@ -399,7 +404,7 @@ // this.showSales = false // this.$forceUpdate() // setTimeout(() => { - // uni.navigateBack() + // uni.navigateBack() // }, 1200) } }, @@ -436,7 +441,8 @@ </view> </view> <view v-for="(item,index) of list" :key="index"> - <view class="flower-info m-b-20 m-t-12 br-4" v-if="!showSales||showSales&&(submitForm.orderItemId == item.id)"> + <view class="flower-info m-b-20 m-t-12 br-4" + v-if="!showSales||showSales&&(submitForm.orderItemId == item.id)"> <view class="supplier-name "> <image class="icon-dp" src="/static/common/icon-dp.png"></image> {{ item.supplierName || ''}} @@ -494,6 +500,7 @@ </view> </view> + <view class="info-container bg-white br-4" v-if="!showSales"> <view class="form-item"> <view class="label">订单编号:</view> @@ -573,6 +580,39 @@ </view> </view> + <view class="info-container bg-white br-4 m-t-12" + v-if="!showSales&& dto.pointGoodsList&& dto.pointGoodsList.length>0"> + <view v-for="(item,j) of dto.pointGoodsList" :key="j" class="m-b-12"> + <view class="flower-info br-4"> + <view class="flex flex-wrap-normal"> + <image class="flower-img img100 br-4 m-r-6" :src="item.cover" @click="previewImg(item.cover)"> + </image> + <view class="flex1"> + <view class=" flex"> + <view class="title"> + {{ item.name || ''}} + </view> + </view> + <view class="each-list" style="display: contents;"> + <view class="each-item"> + <view class="label">数量</view> + <view class="value">{{ item.num || 0 }}</view> + + </view> + <view class="each-item" style="min-width: unset;max-width: unset;"> + <view class="label" style="min-width: 55rpx;">描述</view> + <view class="value" style="word-break: break-all;text-align: left;">{{ item.description || '-' }} + </view> + </view> + </view> + </view> + </view> + + </view> + </view> + + + </view> <view class="info-container bg-white br-4 m-t-12" v-if="!showSales"> <view class="icon-view"> diff --git a/pages/user/supplier-user.vue b/pages/user/supplier-user.vue index 101383b..8e66cea 100644 --- a/pages/user/supplier-user.vue +++ b/pages/user/supplier-user.vue @@ -43,31 +43,31 @@ <!-- #ifdef PUB_CUSTOMER_DEV --> <span class="member-level" @click="goto('/sub_pages/customer/self/member-center',true)" v-if="currentInfo&¤tInfo.customerDTO&¤tInfo.customerDTO.userGrowthRecord"> - <view v-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='普通会员'"> - <image class="member-icon v1" + <view v-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='普通会员'" class="v1"> + <image class="member-icon" src="../../static/images/customer/coupon/member/icon-member-1.png"></image> {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} - <uni-icons color="#79C57B" type="right" size="18"></uni-icons> + <uni-icons color="#7CC662" type="right" size="18"></uni-icons> </view> - <view v-else-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='银卡会员'"> + <view v-else-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='银卡会员'" class="v2"> <image class="member-icon v2" src="../../static/images/customer/coupon/member/icon-member-2.png"></image> {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} - <uni-icons color="#96B1E9" type="right" size="18"></uni-icons> + <uni-icons color="#7498E0" type="right" size="18"></uni-icons> </view> - <view v-else-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='金卡会员'"> + <view v-else-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='金卡会员'" class="v3"> <image class="member-icon v3" src="../../static/images/customer/coupon/member/icon-member-3.png"></image> {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} - <uni-icons color="#AD790F" type="right" size="18"></uni-icons> + <uni-icons color="#C47810" type="right" size="18"></uni-icons> </view> - <view v-else> + <view v-else class="v4"> <image class="member-icon v4" - src="../../static/images/customer/coupon/member/icon-member-3.png"></image> + src="../../static/images/customer/coupon/member/icon-member-4.png"></image> {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} - <uni-icons color="#E4531C" type="right" size="18"></uni-icons> + <uni-icons color="#DD834E" type="right" size="18"></uni-icons> </view> @@ -109,7 +109,7 @@ </view> <!-- #ifdef PUB_CUSTOMER_DEV --> - <view class="user-utils m-20 coupon-info-container" @click="goto( `/sub_pages/customer/coupon/good-all`,true)" + <view class="m-20 coupon-info-container" @click="goto( `/sub_pages/customer/coupon/good-all`,true)" v-if="selftype==='customer'||!selftype"> <view> <view class="title">积分商城</view> diff --git a/pages/user/user-customer.scss b/pages/user/user-customer.scss index a200cc4..d4fc338 100644 --- a/pages/user/user-customer.scss +++ b/pages/user/user-customer.scss @@ -1,7 +1,6 @@ .member-level{ font-weight: 600; font-size: 32rpx; - color: #A3EBCD; line-height: 44rpx; text-align: left; font-style: normal; @@ -11,33 +10,36 @@ .member-icon{ display: inline-block; - vertical-align: bottom; - width: 48rpx; - height: 56rpx; + vertical-align: middle; + width: 57rpx; + height: 61rpx; background-size: 100% 100%; } } -.member-level.v1{ - color: #A3EBCD; +.member-level .v1{ + color: #7CC662; } -.member-level.v2{ - color: #96B1E9; +.member-level .v2{ + color: #7498E0; } -.member-level.v3{ - color: #AD790F; +.member-level .v3{ + color: #C47810; } -.member-level.v4{ - color: #E4531C; +.member-level .v4{ + color: #DD834E; } .coupon-info-container{ display: flex; // width: 690rpx; padding: 22rpx 36rpx; // height: 134rpx; - background: linear-gradient( 180deg, #FBECC1 0%, #E6CE9E 100%); + // background: linear-gradient( 180deg, #FBECC1 0%, #E6CE9E 100%); + // background: unset !important; border-radius: 8rpx; - border: 2rpx solid; - border-image: linear-gradient(180deg, rgba(238, 217, 173, 1), rgba(219, 182, 105, 1)) 2 2; + // border: 2rpx solid; + // border-image: linear-gradient(180deg, rgba(238, 217, 173, 1), rgba(219, 182, 105, 1)) 2 2; + background-image: url('../../static/images/customer/coupon/coupon-bg-user.png'); + background-size: 100% 100%; .title{ font-weight: 600; font-size: 36rpx; diff --git a/static/images/customer/coupon/coupon-bg-user.png b/static/images/customer/coupon/coupon-bg-user.png new file mode 100644 index 0000000..7abf9f2 --- /dev/null +++ b/static/images/customer/coupon/coupon-bg-user.png Binary files differ diff --git a/static/images/customer/coupon/member/icon-member-4.png b/static/images/customer/coupon/member/icon-member-4.png new file mode 100644 index 0000000..261f533 --- /dev/null +++ b/static/images/customer/coupon/member/icon-member-4.png Binary files differ diff --git a/static/images/customer/coupon/member/member-level-bg.png b/static/images/customer/coupon/member/member-level-bg.png new file mode 100644 index 0000000..30c75d2 --- /dev/null +++ b/static/images/customer/coupon/member/member-level-bg.png Binary files differ diff --git a/store/index.js b/store/index.js index a97699e..74f075d 100644 --- a/store/index.js +++ b/store/index.js @@ -34,6 +34,10 @@ 'shopnum': 0, 'coupon': 0 }, + cache: { + coupon: {}, + goods:[], + }, defaultaddress: {} }, mutations: { @@ -120,6 +124,19 @@ console.log('sign_clear', key) state.sign[key] = 0 }, + cache_coupon_select: async function({ + commit, + state + }, dto) { + state.cache['coupon'] = dto || {} + }, + cache_goods_select: async function({ + commit, + state + }, goods) { + state.cache['goods'] = goods || [] + }, + // lazy loading openid logout: async function({ commit, diff --git a/sub_pages/customer/coupon/coupon-self.vue b/sub_pages/customer/coupon/coupon-self.vue index dacb1f9..fa6a535 100644 --- a/sub_pages/customer/coupon/coupon-self.vue +++ b/sub_pages/customer/coupon/coupon-self.vue @@ -1,6 +1,6 @@ <template> <view class="coupon-container"> - <view class="p10"> + <view class="p10" v-if="source!=='shopping'"> <top-tabs :tabs="tabs" :flg="flg" @change="changeTab" type="coupon"> </top-tabs> @@ -8,7 +8,8 @@ <view class=""> <no-data v-if="!list||list.length==0" style="width: 100%;"></no-data> - <view v-for="(item,index) of list" :key="index" class="coupont-item" :class="[query.status]"> + <view v-for="(item,index) of list" :key="index" class="coupont-item" :class="[query.status]" + @click="selectCoupon(item)"> <view class="flex container img100"> <view class="info-price"> <view class="price1"> @@ -31,8 +32,8 @@ </view> </view> </view> - <view style="min-height: 130rpx;"></view> - <view class="bottom-button" @click="getCoupon">领取优惠券</view> + <view style="min-height: 130rpx;" v-if="source!=='shopping'"></view> + <view class="bottom-button" v-if="source!=='shopping'" @click="getCoupon">领取优惠券</view> </view> </template> @@ -63,17 +64,38 @@ query: { status: 'unused' }, - list: [] + list: [], + source: '' + } }, - async onLoad() { - this.listApi = '/api/v2/coupon/app' + `/mine/${this.query.status}/list` + async onLoad(options) { + if (options.source) { + this.source = options.source || '' + } + if (this.source === 'shopping') { + //只展示可用的 + this.page.size = 100 + this.listApi = '/api/v2/coupon/app' + `/mine/unused/list` + + } else { + this.listApi = '/api/v2/coupon/app' + `/mine/${this.query.status}/list` + + } await this.$store.dispatch('sign_clear', 'coupon') this.getList() }, - +onReachBottom() { + this.getMore() + }, methods: { + async selectCoupon(item) { + if (this.source == 'shopping') { + await this.$store.dispatch('cache_coupon_select', item) + uni.navigateBack() + } + }, changeTab(flg) { this.flg = '' + flg this.query.status = this.tabs[flg].status diff --git a/sub_pages/customer/coupon/good-all.vue b/sub_pages/customer/coupon/good-all.vue index 68f60a7..31afb33 100644 --- a/sub_pages/customer/coupon/good-all.vue +++ b/sub_pages/customer/coupon/good-all.vue @@ -12,7 +12,7 @@ <view class="flex point-info"> <view class="point-record m-r-a"> <view class="text-center title">我的积分</view> - <view class="flex"> + <view class="flex" @click="goto('/sub_pages/customer/coupon/point-history',true)"> <image src="../../../static/images/customer/coupon/icon-point.png" class="point-icon"> </image> {{currentInfo.currentPoint || 0}} diff --git a/sub_pages/customer/coupon/good-self.vue b/sub_pages/customer/coupon/good-self.vue index 0813670..547ac56 100644 --- a/sub_pages/customer/coupon/good-self.vue +++ b/sub_pages/customer/coupon/good-self.vue @@ -1,6 +1,6 @@ <template> <view class="coupon-container"> - <view class="p10"> + <view class="p10" v-if="source!=='shopping'"> <top-tabs :tabs="tabs" :flg="flg" @change="changeTab" type="coupon"> </top-tabs> @@ -20,23 +20,39 @@ <view class="time word-e"> {{item.description||''}} </view> - <view class="button" @click="getPointGood(item)"> + <view class="button" @click="getPointGood(item)" v-if="source!=='shopping'"> 查看详情 + </view> + <view class="button" @click="updateSelectGood(item)" v-if="source=='shopping'"> + {{isIngood(item)?'移除':'添加'}} </view> </view> </view> - <view class="tip"> + <!-- <view class="tip"> <span class="t-red">*</span>此券每人限领1张。仅限用于花满芜鲜花交易平台鲜切花花款满额使用,不可与其他优惠同享、不可叠加使用 - </view> + </view> --> </view> </view> - <!-- <view style="min-height: 130rpx;"></view> --> + <view style="min-height: 130rpx;" v-if="source=='shopping'"></view> + <view class="bottom-button" @click="backpage()" v-if="source=='shopping'">返回订单结算</view> + <!-- <view class="bottom-button" @click="toGoodAll">前往兑换</view> --> </view> </template> <script> + import { + mapState + } from 'vuex' export default { + computed: { + ...mapState({ + cache_goods: state => { + return state.cache.goods || [] + }, + }), + }, + data() { return { flg: 0, @@ -62,16 +78,68 @@ query: { status: 'A' }, - list: [] + list: [], + source: '' + } }, - async onLoad() { - this.listApi = '/api/customer/point/goods/exchange/list' + onReachBottom() { + this.getMore() + }, + async onLoad(options) { + if (options.source) { + this.source = options.source || '' + } + if (this.source === 'shopping') { + //只展示可用的 + this.page.size = 100 + this.listApi = '/api/customer/point/goods/exchange/list' + } else { + this.listApi = '/api/customer/point/goods/exchange/list' + } this.getList() }, methods: { + isIngood(item) { + for (var tmp of this.cache_goods) { + if (tmp.id == item.id) { + return true + } + } + + return false + }, + async updateSelectGood(item) { + var has = false + for (var tmp of this.cache_goods) { + if (tmp.id == item.id) { + has = true + break + } + } + var arr = [] + + if (has) { + //移除 + var arr = [] + for (var tmp of this.cache_goods) { + if (tmp.id == item.id) {} else { + arr.push(tmp) + } + } + } else { + //添加 + for (var tmp of this.cache_goods) { + arr.push(tmp) + } + arr.push(item) + } + await this.$store.dispatch('cache_coupon_select', arr) + this.$forceUpdate() + + }, changeTab(flg) { this.flg = '' + flg this.query.status = this.tabs[flg].status diff --git a/sub_pages/customer/coupon/point-history.vue b/sub_pages/customer/coupon/point-history.vue index 8183fd0..92eaacf 100644 --- a/sub_pages/customer/coupon/point-history.vue +++ b/sub_pages/customer/coupon/point-history.vue @@ -1,6 +1,30 @@ <template> + <!-- 列表页面 --> <view> - + <view class="p15" style="min-height: calc(100vh - 260rpx);"> + <no-data v-if="!list||list.length==0" style="width: 100%;"></no-data> + <view v-for="(item,index) in list" :key="index" class="m-b-24"> + <view @click.stop="toDetail(item)" class="notice-item"> + <view v-if="item.typeStr" class="type">{{item.typeStr||'-'}}</view> + <view class="time">{{item.recordDate || ''}}</view> + <view class="form-item"> + <view class="form-item-label">变更类型</view> + <view class="form-item-value">{{item.changeTypeStr || ''}}</view> + </view> + <view class="form-item"> + <view class="form-item-label">积分</view> + <view class="form-item-value">{{item.point || ''}}</view> + </view> + <view class="form-item"> + <view class="form-item-label">备注</view> + <view class="form-item-value">{{item.remarks || ''}}</view> + </view> + </view> + </view> + </view> + + <!-- 判断是否到底了,自动吧 --> + <footer-msg :more="page.total>0&&page.total>page.current*page.size"></footer-msg> </view> </template> @@ -8,15 +32,58 @@ export default { data() { return { - + query: { + // status: '' + } } }, + onLoad() { + + + this.listApi = '/api/customer/point/list' + + this.getList() + + }, + onReachBottom() { + this.getMore() + }, + async onPullDownRefresh() { + this.page.current = 1 + await this.getList() + uni.stopPullDownRefresh() + }, methods: { - + } } </script> -<style> +<style lang="scss" scoped> + .notice-item { + padding: 20rpx; + font-size: 28rpx; + background-color: #fff; -</style> + .type { + font-weight: 600; + + } + + .time { + font-size: 24rpx; + color: darkgray; + } + + .form-item { + display: flex; + + .form-item-label {} + + .form-item-value { + flex: 1; + text-align: right; + } + } + } +</style> \ No newline at end of file diff --git a/sub_pages/customer/self/collect.vue b/sub_pages/customer/self/collect.vue index 1e95be7..1c3c90d 100644 --- a/sub_pages/customer/self/collect.vue +++ b/sub_pages/customer/self/collect.vue @@ -234,7 +234,7 @@ <view class="trade-list-container"> <view class="trade-info-container flex" :class="[dto.status!=='UP'?'OFF':'']" v-for="(dto,index) of list" :key="index"> - <image class="img img100 br-4 m-r-10" :class="[!dto.stock?'component-stock-zero':'']" + <image class="img img100 br-4 m-r-10" :class="[!dto.stock?'component-stock-zero':'',dto.status!=='UP'?'component-status-zero':'']" :src="dto.url||dto.cover" @click.stop="toDetail(dto)"></image> <view class="flex1"> <view class="flex" @click.stop="toDetail(dto)"> diff --git a/sub_pages/customer/self/history.vue b/sub_pages/customer/self/history.vue index 7026ddf..cd67edd 100644 --- a/sub_pages/customer/self/history.vue +++ b/sub_pages/customer/self/history.vue @@ -222,7 +222,7 @@ <view class="trade-list-container"> <view class="trade-info-container flex" :class="[dto.status!=='UP'?'OFF':'']" v-for="(dto,index) of list" :key="index"> - <image class="img img100 br-4 m-r-10" :class="[!dto.stock?'component-stock-zero':'']" + <image class="img img100 br-4 m-r-10" :class="[!dto.stock?'component-stock-zero':'',dto.status!=='UP'?'component-status-zero':'']" :src="dto.url||dto.cover" @click.stop="toDetail(dto)"></image> <view class="flex1"> <view class="flex" @click.stop="toDetail(dto)"> diff --git a/sub_pages/customer/self/member-center.vue b/sub_pages/customer/self/member-center.vue index 8183fd0..20a7331 100644 --- a/sub_pages/customer/self/member-center.vue +++ b/sub_pages/customer/self/member-center.vue @@ -1,22 +1,184 @@ <template> - <view> - + <view class="member-center"> + <image src="../../../static/images/customer/coupon/member/member-level-bg.png" mode="aspectFit" + class="img100 member-level-image"></image> + <view class="banner"> + <banner3d ref="banner3d" v-if="init" :banner-list="bannerList" :swiper-config="swiperConfig"></banner3d> + </view> + <view class="p20" style="padding-top: 0rpx;"> + <view class="info bg-white p20"> + <view class="flex"> + <view>成长值规则</view> + <view class="m-l-a m-r-0 text-right desc-gray" @click="goto('/pages/help/content?id=会员协议',false)">点击查看会员协议 + </view> + </view> + + </view> + <view class="info bg-white p20 m-t-20" + v-if="currentInfo.customerDTO&¤tInfo.customerDTO.userGrowthRecord + &¤tInfo.customerDTO.userGrowthRecord.targetMemberInfos&¤tInfo.customerDTO.userGrowthRecord.targetMemberInfos.length>=1"> + <view class="text-center desc-gray"> + ———————— 会员权益 ———————— + </view> + <view> + <view class="m-t-12">积分达到 + {{currentInfo.customerDTO.userGrowthRecord.targetMemberInfos[0].targetStartPoint || '-'}}</view> + <view class="m-t-12">优惠 + {{currentInfo.customerDTO.userGrowthRecord.targetMemberInfos[0].targetDiscountAmount || '-'}}元/扎 + </view> + + </view> + </view> + <view class="info bg-white p20 m-t-20"> + <view class="text-center desc-gray"> + ————— 成长值获取规则 ————— + </view> + <view class="m-t-12"> + 每消费1元,即可获得1成长值。 + 成长值将在订单交易完成后,根据实际交易金额进行赠送。 + 消费越多,获得的成长值越多,享受更高等级的会员权益。 + 快来参与消费,累积成长值,解锁更多专属福利吧! + </view> + </view> + </view> + </view> + </view> </template> <script> + import banner3d from '@/components/banner3d/banner3d' export default { - data() { - return { - + methods: { + + }, + onLoad() { + if (this.currentInfo.customerDTO && this.currentInfo.customerDTO.userGrowthRecord && this.currentInfo + .customerDTO.userGrowthRecord.currentMemberLevel) { + // userGrowthRecord: {currentMemberLevel: "普通会员", currentGrowthValue: 6919,…} + // currentGrowthValue: 6919 + // currentMemberLevel: "普通会员" + // targetMemberInfos: [{targetMemberLevel: "金卡会员", targetStartPoint: 15001, targetGap: 8082, targetDiscountAmount: 0.4},…] + // 0: {targetMemberLevel: "金卡会员", targetStartPoint: 15001, targetGap: 8082, targetDiscountAmount: 0.4} + // targetDiscountAmount: 0.4 + // targetGap: 8082 + // targetMemberLevel: "金卡会员" + // targetStartPoint: 15001 + // 1: {targetMemberLevel: "钻石会员", targetStartPoint: 10001, targetGap: 3082, targetDiscountAmount: 0.5} + // targetDiscountAmount: 0.5 + // targetGap: 3082 + // targetMemberLevel: "钻石会员" + // targetStartPoint: 10001 + //计算下一个等级的差距 + for (var tmp of this.bannerList) { + tmp.point = { + current: this.currentInfo.customerDTO.userGrowthRecord.currentGrowthValue || 0 + } + } + if (this.currentInfo.customerDTO.userGrowthRecord.targetMemberInfos) { + var t = -1 + for (var tmp of this.bannerList) { + t += 1 + for (var k of this.currentInfo.customerDTO.userGrowthRecord.targetMemberInfos) { + if (tmp.title === k.targetMemberLevel) { + console.log('eq', k, tmp) + tmp.point = { + current: this.currentInfo.customerDTO.userGrowthRecord.currentGrowthValue || 0, + end: k.targetStartPoint || 0, + } + } + } + } + } + + this.init = true + this.$nextTick(() => { + var name = this.currentInfo.customerDTO.userGrowthRecord.currentMemberLevel + var index = -1 + for (var tmp of this.bannerList) { + index += 1 + if (tmp.title === name) { + this.$refs.banner3d.swiperChange({ + mp: { + detail: { + current: index + } + } + }) + break + } + } + }) + } }, - methods: { - - } + data() { + return { + init: false, + bannerList: [{ + bg: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/d3/d31e9011d1c140068942c106c2f7e37bTFDUPzQRgaHx7a20dcefe1fb5eb12e18d294b8c1f86e.png', + picture: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/ef/ef96604518db467fbd344c08e48d1fac8jZdk1ED0Yq023d4f86c2ec36975c981ba522c2bfe3f.png', + title: '普通会员', + // description: '一万年太久,就现在,给你爱', + path: '', + point: undefined + }, { + bg: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/cf/cff11dd119174483a46858ace7ddc2a3lJlA3kEXom5H82b85fac5f2db00d50ece7e650207f78.png', + picture: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/07/075db9222f7a41e981c5b263d7210ed5Ztljs5yDHKILd37c3399011f84f401b755477bb8a323.png', + title: '银卡会员', + // description: '花中樱,鱼乃鲷花中樱,鱼乃鲷', + path: '' + }, { + bg: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/5b/5b9bcdeb29ab4ab7a7a7871e430e9180kwtx0q4ovEGpe93cd3cc7772e4b31a6cfea199663815.png', + picture: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/f1/f192b651606045ddba5c5f04a34a00c2R8MmH6mVsprH81cab47fbe889222f6088f4ca2cf20d5.png', + title: '金卡会员', + // description: '取材自湘西苗族传统的烟熏文化', + path: '' + }, { + bg: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/ce/ce13a8fe5d7d48aeb6e6dec8217d8cbeWia6N8vcYrbse93cd3cc7772e4b31a6cfea199663815.png', + picture: 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/c9/c94d8f444af94b899d1e1593cebb933eDyZyhyoyDxTRaf60a4d692f097e5d790cdb88fae9d0c.png', + title: '钻石会员', + // description: '在自己的小世界里,日日好日,夜夜好清宵', + path: '' + }], + swiperConfig: { + indicatorDots: true, + indicatorColor: 'rgba(255, 255, 255, .4)', + indicatorActiveColor: 'rgba(255, 255, 255, 1)', + autoplay: false, + interval: 3000, + duration: 300, + circular: true, + previousMargin: '58rpx', + nextMargin: '58rpx' + } + } + }, + components: { + banner3d + }, + } </script> -<style> +<style lang="scss" scoped> + .member-center { + position: relative; -</style> + .banner { + position: relative; + z-index: 10; + padding-top: 160rpx; + } + + .member-level-image { + width: 750rpx; + min-height: 530rpx; + position: absolute; + left: 0; + right: 0; + top: 0; + z-index: 1; + } + } +</style> \ No newline at end of file diff --git a/sub_pages/customer/shopping/confirm.vue b/sub_pages/customer/shopping/confirm.vue index f691c38..c88048e 100644 --- a/sub_pages/customer/shopping/confirm.vue +++ b/sub_pages/customer/shopping/confirm.vue @@ -11,11 +11,55 @@ address: state => { return state.defaultaddress || {} }, + cache_coupon: state => { + return state.cache.coupon || {} + }, + cache_goods: state => { + return state.cache.goods || [] + }, }), + coupon_fee() { + //优惠券 + if (this.dto.couponRecordId && this.cache_coupon) { + //计算优惠券 + if (this.cache_coupon.couponDiscountType === 'zero') { + return this.cache_coupon.couponDiscountValue || 0 + } else if (this.cache_coupon.minOrderAmount && this.cache_coupon.minOrderAmount > 0) { + var total = ((dto.totalAmount || 0) + (dto.packing || 0) + (current_transport.fee || 0) || 0) + .toFixed(2) + if (total >= this.cache_coupon.minOrderAmount) { + return this.cache_coupon.couponDiscountValue || 0 + } + } else { + return this.cache_coupon.couponDiscountValue || 0 + } + } + + return 0 + } + + }, + async beforeDestroy() { + await this.$store.dispatch('cache_coupon_select', {}) + await this.$store.dispatch('cache_goods_select', []) }, async onShow() { - + //优惠券 + if (this.cache_coupon && this.cache_coupon.id) { + this.dto.couponRecordId = this.cache_coupon.id + this.dto.couponRecordStr = this.cache_coupon.couponName + } + //兑换券 + this.dto.couponRecordStr = '' + if (this.cache_goods && this.cache_goods.length > 0) { + this.dto.couponRecordStr = '' + var names = [] + for (var tmp of this.cache_goods) { + names.push(tmp.name || tmp.title || '') + } + this.dto.couponRecordStr = names.join(',') + } }, onLoad(options) { // console.log('dto',options) @@ -81,6 +125,9 @@ transportId: '', addressId: '', flowers: [], + couponRecordId: '', + couponRecordStr: '', + goodsRecordIdListStr: '', }, current_transport: {}, cacheAddressId: '', @@ -109,6 +156,18 @@ } }, methods: { + toSelectCoupon() { + //跳转去列表页面进行选择 + uni.navigateTo({ + url: '/sub_pages/customer/coupon/coupon-self?source=shopping' + }) + }, + toSelectGood() { + //跳转去列表页面进行选择 + uni.navigateTo({ + url: '/sub_pages/customer/coupon/good-self?source=shopping' + }) + }, select_need(e) { this.show_select_need = false this.dto.specialNeedsStr = e.value[0].label @@ -175,6 +234,10 @@ }) tmp.$message.hideLoading() if (code === 0) { + //清空优惠券 + this.$store.dispatch('cache_coupon_select', {}) + this.$store.dispatch('cache_goods_select', []) + //提交信息 console.log('pay,', data) // /api/pub/init/callback?orderId= @@ -335,7 +398,19 @@ </view> <view class="p10 bg-white m-t-20 br-4"> + <!-- #ifdef PUB_CUSTOMER_DEV --> <view class="form-item flex "> + <view class="label">优惠券</view> + + <view class="m-l-a m-r-0 flex " :class="[!dto.couponRecordId?'desc-gray':'']" + @click="toSelectCoupon"> + <view>{{dto.couponRecordStr||dto.couponRecordId || '请选择'}}</view> + <u-icon class="m-l-a" name="arrow-right"></u-icon> + </view> + </view> + <!-- #endif --> + + <view class="form-item flex m-t-12"> <view class="label">特殊需求</view> <view class="m-l-a m-r-0 flex " :class="[!dto.specialNeeds?'desc-gray':'']" @click="()=>{ @@ -355,6 +430,18 @@ </view> </view> </view> + <!-- #ifdef PUB_CUSTOMER_DEV --> + <view class="form-item flex "> + <view class="label">兑换券</view> + + <view class="m-l-a m-r-0 flex " + :class="[!dto.goodsRecordIdList||dto.goodsRecordIdList.length==0?'desc-gray':'']" + @click="toSelectGood"> + <view>{{dto.goodsRecordIdListStr|| '请选择'}}</view> + <u-icon class="m-l-a" name="arrow-right"></u-icon> + </view> + </view> + <!-- #endif --> </view> </view> @@ -377,6 +464,12 @@ {{ (current_transport.fee || 0) }} </view> </view> + <view class="desc flex"> + <view>优惠:</view> + <view class="m-l-a m-r-0 text-right"> + -{{ coupon_fee || 0 }} + </view> + </view> </view> @@ -385,7 +478,8 @@ <view class="bottom-price flex"> <view class="m-t-12 m-l-0 m-r-a"> 合计 <span class="t-red">¥ - {{ ((dto.totalAmount || 0) + (dto.packing || 0) + (current_transport.fee || 0) || 0).toFixed(2) }} </span>元 + {{ ((dto.totalAmount || 0) + (dto.packing || 0) + (current_transport.fee || 0) - coupon_fee || 0).toFixed(2) }} + </span>元 </view> <view class="button-green-1 m-l-a m-r-0" style="min-width: 240rpx" @click="submitOrder"> 提交订单 -- Gitblit v1.9.3