Merge branch 'dev' into 'master'

uniapp【优化】(优惠券模块):更改优惠券使用规则显示方式

See merge request jianweie/coreshoppro!44
This commit is contained in:
花城
2024-10-19 03:33:18 +00:00
3 changed files with 42 additions and 38 deletions

View File

@@ -16,17 +16,11 @@
</view> </view>
<view class="rules-mode"> <view class="rules-mode">
<view class="use-rules" @click="handleToggleRules(index)"> <view class="use-rules" @click="handleToggleRules(index)">
<view class="tit">使用规则</view> <view class="tit">优惠券使用规则</view>
<uv-icon v-if="item.showRules" name="arrow-up-fill" color="#aaa" <uv-icon v-if="item.showRules" name="arrow-up-fill" color="#aaa"
size="10"></uv-icon> size="10"></uv-icon>
<uv-icon v-else name="arrow-down-fill" color="#aaa" size="10"></uv-icon> <uv-icon v-else name="arrow-down-fill" color="#aaa" size="10"></uv-icon>
</view> </view>
<view class="use-rules" @click="handleToggleDiscount(index)">
<view class="tit">优惠方式</view>
<uv-icon v-if="item.showDiscount" name="arrow-up-fill" color="#aaa"
size="10"></uv-icon>
<uv-icon v-else name="arrow-down-fill" color="#aaa" size="10"></uv-icon>
</view>
</view> </view>
</view> </view>
<view class="btn-box"> <view class="btn-box">
@@ -34,14 +28,16 @@
</view> </view>
</view> </view>
</view> </view>
<view class="rules-box" v-if="item.showRules"> <view v-show="item.showRules">
<view class="tit">优惠券使用规则</view> <view class="rules-box">
<view class="rules" v-for="cell, cellIndex in item.conditions" :key="cellIndex">{{ cell }} <view class="tit">优惠券使用规则</view>
<view class="rules" v-for="cell, cellIndex in item.conditions" :key="cellIndex">{{ cell }}
</view>
</view> </view>
</view> <view class="rules-box">
<view class="rules-box" v-if="item.showDiscount"> <view class="tit">优惠券优惠方式</view>
<view class="tit">优惠券优惠方式</view> <view class="rules" v-for="cell, cellIndex in item.results" :key="cellIndex">{{ cell }}
<view class="rules" v-for="cell, cellIndex in item.results" :key="cellIndex">{{ cell }} </view>
</view> </view>
</view> </view>
<view class="no-coupon" v-if="item.maxRecevieNums > 0 && item.getNumber >= item.maxRecevieNums"> <view class="no-coupon" v-if="item.maxRecevieNums > 0 && item.getNumber >= item.maxRecevieNums">
@@ -97,7 +93,6 @@
state.totalPages = userCoupo.otherData?.totalPages; state.totalPages = userCoupo.otherData?.totalPages;
state.couponList = state.couponList.concat(userCoupo.data?.map(((item : any) => { state.couponList = state.couponList.concat(userCoupo.data?.map(((item : any) => {
item['showRules'] = false; item['showRules'] = false;
item['showDiscount'] = false;
return item; return item;
}))); })));
uni.hideLoading(); uni.hideLoading();
@@ -128,15 +123,8 @@
/** 查看使用规则 */ /** 查看使用规则 */
const handleToggleRules = (index : number) => { const handleToggleRules = (index : number) => {
state.couponList[index].showDiscount = false;
state.couponList[index].showRules = !state.couponList[index].showRules; state.couponList[index].showRules = !state.couponList[index].showRules;
} }
/** 查看优惠方式 */
const handleToggleDiscount = (index : number) => {
state.couponList[index].showRules = false;
state.couponList[index].showDiscount = !state.couponList[index].showDiscount;
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import './coupon.scss'; @import './coupon.scss';

View File

@@ -66,8 +66,9 @@
justify-content: space-between; justify-content: space-between;
.coupon-tit { .coupon-tit {
width: 440rpx; width: 410rpx;
padding-left: 30rpx; padding-left: 30rpx;
padding-right: 30rpx;
.name { .name {
margin-bottom: 10rpx; margin-bottom: 10rpx;
@@ -79,18 +80,24 @@
} }
.time { .time {
margin-bottom: 10rpx;
.tit { .tit {
font-size: 22rpx; font-size: 22rpx;
color: #aaa; color: #aaa;
} }
} }
.use-rules { .rules-mode {
display: flex; display: flex;
align-items: center; align-items: center;
.tit { justify-content: space-between;
font-size: 22rpx; .use-rules {
color: #aaa; display: flex;
margin-right: 10rpx; align-items: center;
.tit {
font-size: 22rpx;
color: #aaa;
margin-right: 10rpx;
}
} }
} }
} }

View File

@@ -12,7 +12,7 @@
<view class="card-box"> <view class="card-box">
<image class="coupon-bg" :src="handleStaticResources('/static/images/coupon-bg.jpg')"></image> <image class="coupon-bg" :src="handleStaticResources('/static/images/coupon-bg.jpg')"></image>
<view class="coupon-msg"> <view class="coupon-msg">
<view class="coupon-tit" @click="handleToggleRules(index)"> <view class="coupon-tit">
<view class="name"> <view class="name">
<text class="tit">{{ item.couponName }}</text> <text class="tit">{{ item.couponName }}</text>
</view> </view>
@@ -20,11 +20,13 @@
<text class="tit"> 有效期{{ timeFormat(item.startTime, 'yyyy-mm-dd') }} <text class="tit"> 有效期{{ timeFormat(item.startTime, 'yyyy-mm-dd') }}
{{ timeFormat(item.endTime, 'yyyy-mm-dd') }}</text> {{ timeFormat(item.endTime, 'yyyy-mm-dd') }}</text>
</view> </view>
<view class="use-rules"> <view class="rules-mode">
<view class="tit">点击查看使用规则</view> <view class="use-rules" @click="handleToggleRules(index)">
<uv-icon v-if="item.showRules" name="arrow-up-fill" color="#aaa" <view class="tit">优惠券使用规则</view>
size="10"></uv-icon> <uv-icon v-if="item.showRules" name="arrow-up-fill" color="#aaa"
<uv-icon v-else name="arrow-down-fill" color="#aaa" size="10"></uv-icon> size="10"></uv-icon>
<uv-icon v-else name="arrow-down-fill" color="#aaa" size="10"></uv-icon>
</view>
</view> </view>
</view> </view>
<view class="btn-box"> <view class="btn-box">
@@ -35,9 +37,16 @@
</view> </view>
</view> </view>
</view> </view>
<view class="rules-box" v-if="item.showRules"> <view v-show="item.showRules">
<view class="tit">优惠券使用规则</view> <view class="rules-box">
<view class="rules" v-for="cell, cellIndex in item.conditions" :key="cellIndex">{{ cell }} <view class="tit">优惠券使用规则</view>
<view class="rules" v-for="cell, cellIndex in item.conditions" :key="cellIndex">{{ cell }}
</view>
</view>
<view class="rules-box">
<view class="tit">优惠券优惠方式</view>
<view class="rules" v-for="cell, cellIndex in item.results" :key="cellIndex">{{ cell }}
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -55,7 +64,7 @@
import type { Response } from '@/core/models'; import type { Response } from '@/core/models';
import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js'; import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
import { handleStaticResources, handleRouteSwitchTab } from '@/core/utils'; import { handleStaticResources, handleRouteSwitchTab } from '@/core/utils';
import { EmptyEnum ,RouteSwitchTabEnum} from '@/core/enum'; import { EmptyEnum, RouteSwitchTabEnum } from '@/core/enum';
interface TabType { interface TabType {
id : string; id : string;