优惠卷和商品卷

This commit is contained in:
wwz
2025-03-10 16:33:43 +08:00
parent 70edc6756d
commit 5342133cbd
30 changed files with 2820 additions and 3338 deletions

View File

@@ -17,9 +17,9 @@
<view class="containertopbox">
<view class="containertopboxitem flex-start" v-for="(item,index) in fromInfo.list" :key="index">
<view class="containertopboxitemleft flex-colum"
:class="{'containertopboxitemleft_vip': item.type == 2,'containertopboxitemlefts': fromInfo.status != 1,}">
:class="{'containertopboxitemleft_vip': item.type == 2,'containertopboxitemlefts': fromInfo.status == 0}">
<view class="containertopboxitemleft_one"
:class="fromInfo.status == 1?'':'containertopboxitemleft_ones'">
:class="fromInfo.status != 0?'':'containertopboxitemleft_ones'">
<block v-if="item.type == 2">
<text>{{item.num || 0}}</text>
<text style="font-size: 28rpx;margin-left: 6rpx;"></text>
@@ -31,7 +31,7 @@
</view>
<view class="containertopboxitemleft_tow" :class="{
'containertopboxitemleft_tows': fromInfo.status != 1,
'containertopboxitemleft_tows': fromInfo.status == 0,
'containertopboxitemleft_nameVip': item.type == 2,
}">
{{ item.type == 2 ? item.name : '优惠券(元)'}}
@@ -51,8 +51,8 @@
<view class="containertopboxitemright_tow">
<view> {{ item.type == 2 ? '会员商品券' : item.name}}</view>
<view @click="navigatorGo(item)"
:class="fromInfo.status == 1?'containertopboxitemright_four containertopboxitemright_btn':'containertopboxitemright_fours containertopboxitemright_btn'">
{{fromInfo.status == 1 ? '去使用':'已使用'}}
:class="fromInfo.status == 0?'containertopboxitemright_four containertopboxitemright_btn':'containertopboxitemright_fours containertopboxitemright_btn'">
{{fromInfo.status == 0 ? '去使用':'已使用'}}
</view>
</view>
<view class="containertopboxitemright_there" v-if="item.type == 1 ">
@@ -66,12 +66,9 @@
<image style="width: 402rpx;height: 442rpx;margin:240rpx auto 32rpx;"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/nomore.png" mode="aspectFill"></image>
</view>
<up-loadmore :status="form.status" iconSize='12' fontSize='12' height='20' />
<up-loadmore :status="form.status" fontSize="14" color="#999" iconSize="14" />
</view>
</view>
<!-- <view class="btnBox" >
<view class="btn" @click="cancelCoupon">暂不使用券</view>
</view> -->
</view>
</template>
@@ -79,10 +76,18 @@
import {
ref,
reactive,
onMounted
onMounted,
} from 'vue';
import {
APIcouponfindByUserId
onLoad,
onReady,
onShow,
onPageScroll,
onReachBottom
} from '@dcloudio/uni-app'
import {
APIcouponfindByUserId,
APIfindCoupon
} from '@/common/api/member.js'
const tabList = [{
@@ -101,8 +106,7 @@
const fromInfo = reactive({
tabIndex: 0,
list: [],
status: 1,
payAmount: 0,
status: 0,
shopId: null,
orderId: null,
couopnInfo: null,
@@ -115,6 +119,25 @@
status: 'loadmore',
})
// 判断是选择优惠卷
const Orderinfo = reactive({
typeOrder: '',
shopUserId: "",
payAmount: "",
shoppingCart: [],
show: false
})
// 初始化
const init_fn = () => {
fromInfo.list = []
form.page = 1
form.size = 10
form.status = 'loadmore'
// navtabindex.value == '1' ? getorderList() : userorderList()
getCouponList()
}
const towcontentclick = (item) => {
fromInfo.tabIndex = item.status;
fromInfo.status = item.status;
@@ -123,9 +146,7 @@
}
// 去使用优惠券
const navigatorGo = (item) => {
}
const navigatorGo = (item) => {}
const getCouponList = async () => {
let res = await APIcouponfindByUserId({
@@ -140,7 +161,7 @@
fromInfo.list = []
return false
}
if (res.totalPage == 1 && res.totalRow <= 10) {
if (res.totalPage == 0 || res.totalPage == 1 && res.totalRow <= 10) {
form.status = 'nomore'
fromInfo.list = res.records
if (form.page == 1 && res.records.length == 0) {
@@ -149,7 +170,11 @@
return false;
} else {
form.status = 'loading';
fromInfo.list = [...fromInfo.list, ...res.records];
if (form.page == 1) {
fromInfo.list = res.records
} else {
fromInfo.list = [...fromInfo.list, ...res.records];
}
form.page = ++form.page;
if (form.page > res.totalPage) {
form.status = 'nomore';
@@ -157,12 +182,16 @@
form.status = 'loading';
}
}
console.log(fromInfo.list)
}
const cancelCoupon = () => {
uni.navigateBack();
}
onReachBottom(() => {
if (form.status != 'nomore') {
getCouponList()
}
})
onMounted(async () => {
// 获取当前页面栈
const pages = getCurrentPages();
@@ -174,9 +203,6 @@
if (options.shopId) {
fromInfo.shopId = options.shopId
}
if (options.payAmount) {
fromInfo.payAmount = options.payAmount
}
// if (options.orderId) {
// fromInfo.orderId = options.orderId
// }
@@ -189,7 +215,7 @@
// if (options.productList) {
// this.productList = JSON.parse(decodeURIComponent(options.productList))
// }
getCouponList()
init_fn()
})
</script>