faet 添加领券中心,修改自营内容

This commit is contained in:
AERWEN\26795 2023-10-26 23:20:48 +08:00
parent 543e3e7421
commit d2c7465c4f
18 changed files with 265 additions and 31 deletions

View File

@ -31,6 +31,7 @@
"pages/goods/comments/create/index",
"pages/coupon/coupon-list/index",
"pages/coupon/coupon-detail/index",
"pages/coupon/coupon-center/index",
"pages/coupon/coupon-activity-goods/index",
"pages/promotion-detail/index",
"pages/order/fill-tracking-no/index",

View File

@ -55,6 +55,7 @@ Component({
methods: {
// 删除商品
deleteGoods(e) {
console.log(e,'asda111111111111111');
const { goods } = e.currentTarget.dataset;
this.triggerEvent('delete', { goods });
},

View File

@ -65,9 +65,9 @@
catchspecs="specsTap"
catchclick="goGoodsDetail"
>
<view slot="thumb-cover" class="stock-mask" wx:if="{{goods.shortageStock || goods.stockQuantity <= 3}}">
<!-- <view slot="thumb-cover" class="stock-mask" wx:if="{{goods.shortageStock || goods.stockQuantity <= 3}}">
仅剩{{goods.stockQuantity}}件
</view>
</view> -->
<view slot="append-body" class="goods-stepper">
<view class="stepper-tip" wx:if="{{goods.shortageStock}}">库存不足</view>
<t-stepper
@ -121,6 +121,7 @@
data-goods="{{goods}}"
catchspecs="specsTap"
catchclick="goGoodsDetail"
catchdel="deleteGoods"
>
<view slot="thumb-cover" class="no-storage-mask" wx:if="{{goods.stockQuantity <=0 || (goods.skuId != 0 && goods.skuStockQuantity <=0)}}">
<view class="no-storage-content">无货</view>

View File

@ -150,6 +150,9 @@ Component({
},
methods: {
clickDeletesHandle(){
this.triggerEvent('del', { goods: this.data.goods });
},
clickHandle() {
this.triggerEvent('click', { goods: this.data.goods });
},

View File

@ -70,7 +70,7 @@
<block wx:else>
<view class="no_storage">
<view>请重新选择商品规格</view>
<view class="no_storage__right" bind:handleClick="reSelect">重选</view>
<view class="no_storage__right" bind:tap="clickDeletesHandle" data-goods="{{goods}}">删除</view>
</view>
</block>
</view>

View File

@ -1,7 +1,31 @@
import {
imageProps
} from "~/miniprogram_npm/@vant/weapp/uploader/shared";
import {
addCustomerCoupon
} from '~/services/coupon/addCustomerCoupon';
const statusMap = {
1: { text: '去使用', theme: 'primary' },
2: { text: '已使用', theme: 'default' },
3: { text: '已过期', theme: 'default' },
1: {
text: '去使用',
theme: 'primary'
},
2: {
text: '已使用',
theme: 'default'
},
3: {
text: '已过期',
theme: 'default'
},
4: {
text: '领取',
theme: 'primary'
},
5: {
text: '已领取',
theme: 'default'
},
};
Component({
options: {
@ -40,17 +64,32 @@ Component({
methods: {
// 跳转到详情页
gotoDetail() {
wx.navigateTo({
url: `/pages/coupon/coupon-detail/index?id=${this.data.couponDTO.key}`,
});
},
// gotoDetail() {
// wx.navigateTo({
// url: `/pages/coupon/coupon-detail/index?id=${this.data.couponDTO.key}`,
// });
// },
// 跳转到商品列表
gotoGoodsList() {
wx.navigateTo({
url: `/pages/coupon/coupon-activity-goods/index?id=${this.data.couponDTO.key}`,
let status = this.properties.couponDTO.status
let couponGuid = this.properties.couponDTO.couponGuid
if (status == 4) {
addCustomerCoupon({
couponGuid
}).then((res) => {
if (res.code === 200) {
this.triggerEvent('refresh')
wx.showToast({
icon: '',
title: res.data,
});
}
})
}
// wx.navigateTo({
// url: `/pages/coupon/coupon-activity-goods/index?id=${this.data.couponDTO.key}`,
// });
},
},
});

View File

@ -0,0 +1,36 @@
import {
getCouponList
} from '~/services/coupon/getCouponList';
Page({
data: {
couponList: [],
},
onLoad() {
this.init();
},
init() {
this.fetchList();
},
fetchList() {
// 优惠券接口
getCouponList().then((couponList) => {
this.setData({
couponList
});
});
},
onPullDownRefresh_() {
this.setData({
couponList: [],
},
() => {
this.fetchList();
},
);
},
});

View File

@ -0,0 +1,11 @@
{
"navigationBarTitleText": "领券中心",
"usingComponents": {
"t-pull-down-refresh": "tdesign-miniprogram/pull-down-refresh/pull-down-refresh",
"t-tabs": "tdesign-miniprogram/tabs/tabs",
"t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel",
"t-icon": "tdesign-miniprogram/icon/icon",
"coupon-card": "../components/coupon-card/index",
"t-empty": "tdesign-miniprogram/empty/empty"
}
}

View File

@ -0,0 +1,15 @@
<view class="coupon-list-wrap">
<t-pull-down-refresh
t-class-indicator="t-class-indicator"
id="t-pull-down-refresh"
bind:refresh="onPullDownRefresh_"
background="#fff"
>
<view class="coupon-list-item" wx:for="{{couponList}}" wx:key="key">
<coupon-card couponDTO="{{item}}" bindrefresh="init"/>
</view>
<t-empty wx:if="{{couponList.length == 0}}" t-class="empty-cls" t-class-image="t-empty__image" image="https://tdesign.gtimg.com/miniprogram/images/empty1.png" description="暂无优惠券可领取" />
</t-pull-down-refresh>
</view>

View File

@ -0,0 +1,82 @@
page {
height: 100%;
}
.tabs-external__inner {
height: 88rpx;
width: 100%;
line-height: 88rpx;
z-index: 100;
}
.tabs-external__inner {
font-size: 26rpx;
color: #333333;
position: fixed;
width: 100vw;
top: 0;
left: 0;
}
.tabs-external__inner .tabs-external__track {
/* background: #fa4126 !important; */
}
.tabs-external__inner .tabs-external__item {
/* color: #666; */
}
.tabs-external__inner .tabs-external__active {
font-size: 28rpx;
/* color: #fa4126 !important; */
}
.tabs-external__inner.order-nav .order-nav-item .bottom-line {
bottom: 12rpx;
}
.coupon-list-wrap {
margin-top: 32rpx;
margin-left: 32rpx;
margin-right: 32rpx;
overflow-y: auto;
padding-bottom: 100rpx;
padding-bottom: calc(constant(safe-area-inset-top) + 100rpx);
padding-bottom: calc(env(safe-area-inset-bottom) + 100rpx);
-webkit-overflow-scrolling: touch;
}
.center-entry {
box-sizing: content-box;
border-top: 1rpx solid #dce0e4;
background-color: #fff;
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 100rpx;
padding-bottom: 0;
padding-bottom: constant(safe-area-inset-top);
padding-bottom: env(safe-area-inset-bottom);
}
.center-entry-btn {
color: #1989fa;
font-size: 28rpx;
text-align: center;
line-height: 100rpx;
display: flex;
align-items: center;
justify-content: center;
height: 100rpx;
}
.coupon-list-wrap .t-pull-down-refresh__bar {
background: #fff !important;
}
.t-class-indicator {
color: #b9b9b9 !important;
}
.t-empty__image {
width: 240rpx !important;
height: 240rpx !important;
}

View File

@ -71,10 +71,13 @@ Page({
},
goCouponCenterHandle() {
wx.showToast({
title: '去领券中心',
icon: 'none'
wx.navigateTo({
url: `/pages/coupon/coupon-center/index`,
});
// wx.showToast({
// title: '去领券中心',
// icon: 'none'
// });
},
onPullDownRefresh_() {

View File

@ -28,16 +28,16 @@
</view>
<t-empty wx:if="{{couponList.length == 0}}" t-class="empty-cls" t-class-image="t-empty__image" image="https://tdesign.gtimg.com/miniprogram/images/empty1.png" description="暂无数据" />
</t-pull-down-refresh>
<!-- <view class="center-entry">
<view class="center-entry">
<view class="center-entry-btn" bind:tap="goCouponCenterHandle">
<view>领券中心</view>
<t-icon
name="chevron-right"
color="#fa4126"
color="#1989fa"
size="40rpx"
style="line-height: 28rpx;"
/>
</view>
</view> -->
</view>
</view>

View File

@ -60,7 +60,7 @@ page {
}
.center-entry-btn {
color: #fa4126;
color: #1989fa;
font-size: 28rpx;
text-align: center;
line-height: 100rpx;

View File

@ -1,5 +1,5 @@
<view class="search-page">
<t-search t-class-input-container="t-class__input-container" t-class-input="t-search__input" value="{{searchValue}}" leftIcon="" placeholder="iPhone12pro" bind:submit="handleSubmit" focus>
<t-search t-class-input-container="t-class__input-container" t-class-input="t-search__input" value="{{searchValue}}" leftIcon="" placeholder="请输入关键词" bind:submit="handleSubmit" focus>
<t-icon slot="left-icon" prefix="wr" name="search" size="40rpx" color="#bbb" />
</t-search>
<view class="search-wrap">

View File

@ -243,12 +243,11 @@ Component({
})
},
onBuyAgain() {
Toast({
context: this,
selector: '#t-toast',
message: '你点击了再次购买',
icon: 'check-circle',
onBuyAgain(order) {
console.log(order,'asdasd');
console.log(order.goodsList[0].id,'asdasd');
wx.navigateTo({
url: `/pages/goods/details/index?spuId=${order.goodsList[0].id}`
});
},

View File

@ -6,10 +6,10 @@
<address-card addressData="{{userAddress}}" bind:addclick="onGotoAddress" bind:addressclick="onGotoAddress" />
<view class="order-wrapper" wx:for="{{settleDetailData.storeGoodsList}}" wx:for-item="stores" wx:for-index="storeIndex" wx:key="storeIndex">
<view class="store-wrapper">
<!-- <view class="store-wrapper">
<t-icon prefix="wr" size="40rpx" color="#333333" name="store" class="store-logo" />
{{stores.storeName}}
</view>
</view> -->
<view wx:if="{{orderCardList[storeIndex].goodsList.length > 0}}" wx:for="{{orderCardList[storeIndex].goodsList}}" wx:for-item="goods" wx:for-index="gIndex" wx:key="id" class="goods-wrapper">
<image src="{{goods.thumb}}" class="goods-image" mode="aspectFill" />
<view class="goods-content">

View File

@ -0,0 +1,21 @@
import {
request
} from '../_utils/request';
/** 优惠券列表 */
export async function addCustomerCoupon(data) {
return new Promise((resolve, reject) => {
request({
url: `CustomerCouponApi/addCustomerCoupon`,
data: data,
method: 'POST',
success: function (res) {
resolve(res);
},
fail: function (error) {
reject(error);
}
});
});
}

View File

@ -0,0 +1,22 @@
import {
request
} from '../_utils/request';
/** 优惠券列表 */
export async function getCouponList(parm) {
return new Promise((resolve, reject) => {
request({
url: `CouponApi/getCouponList`,
data: parm,
method: 'GET',
success: function (res) {
let data = res.data;
resolve(data);
},
fail: function (error) {
reject(error);
}
});
});
}