diff --git a/app.json b/app.json index 240499e..d1537cc 100644 --- a/app.json +++ b/app.json @@ -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", diff --git a/pages/cart/components/cart-group/index.js b/pages/cart/components/cart-group/index.js index 99f4f0b..5363516 100644 --- a/pages/cart/components/cart-group/index.js +++ b/pages/cart/components/cart-group/index.js @@ -55,6 +55,7 @@ Component({ methods: { // 删除商品 deleteGoods(e) { + console.log(e,'asda111111111111111'); const { goods } = e.currentTarget.dataset; this.triggerEvent('delete', { goods }); }, diff --git a/pages/cart/components/cart-group/index.wxml b/pages/cart/components/cart-group/index.wxml index aae0cf1..45aef09 100644 --- a/pages/cart/components/cart-group/index.wxml +++ b/pages/cart/components/cart-group/index.wxml @@ -65,9 +65,9 @@ catchspecs="specsTap" catchclick="goGoodsDetail" > - + 库存不足 无货 diff --git a/pages/cart/components/goods-card/index.js b/pages/cart/components/goods-card/index.js index c59658c..fa742b2 100644 --- a/pages/cart/components/goods-card/index.js +++ b/pages/cart/components/goods-card/index.js @@ -150,6 +150,9 @@ Component({ }, methods: { + clickDeletesHandle(){ + this.triggerEvent('del', { goods: this.data.goods }); + }, clickHandle() { this.triggerEvent('click', { goods: this.data.goods }); }, diff --git a/pages/cart/components/goods-card/index.wxml b/pages/cart/components/goods-card/index.wxml index 699fdbe..093ef93 100644 --- a/pages/cart/components/goods-card/index.wxml +++ b/pages/cart/components/goods-card/index.wxml @@ -70,7 +70,7 @@ 请重新选择商品规格 - 重选 + 删除 diff --git a/pages/coupon/components/coupon-card/index.js b/pages/coupon/components/coupon-card/index.js index f7eaec0..198a55b 100644 --- a/pages/coupon/components/coupon-card/index.js +++ b/pages/coupon/components/coupon-card/index.js @@ -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}`, + // }); }, }, -}); +}); \ No newline at end of file diff --git a/pages/coupon/coupon-center/index.js b/pages/coupon/coupon-center/index.js new file mode 100644 index 0000000..5a9c66b --- /dev/null +++ b/pages/coupon/coupon-center/index.js @@ -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(); + }, + ); + }, +}); \ No newline at end of file diff --git a/pages/coupon/coupon-center/index.json b/pages/coupon/coupon-center/index.json new file mode 100644 index 0000000..33a765b --- /dev/null +++ b/pages/coupon/coupon-center/index.json @@ -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" + } +} \ No newline at end of file diff --git a/pages/coupon/coupon-center/index.wxml b/pages/coupon/coupon-center/index.wxml new file mode 100644 index 0000000..feb994f --- /dev/null +++ b/pages/coupon/coupon-center/index.wxml @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/pages/coupon/coupon-center/index.wxss b/pages/coupon/coupon-center/index.wxss new file mode 100644 index 0000000..bfe2225 --- /dev/null +++ b/pages/coupon/coupon-center/index.wxss @@ -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; +} \ No newline at end of file diff --git a/pages/coupon/coupon-list/index.js b/pages/coupon/coupon-list/index.js index c49009c..d3e6dc8 100644 --- a/pages/coupon/coupon-list/index.js +++ b/pages/coupon/coupon-list/index.js @@ -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_() { diff --git a/pages/coupon/coupon-list/index.wxml b/pages/coupon/coupon-list/index.wxml index be5644f..93df06b 100644 --- a/pages/coupon/coupon-list/index.wxml +++ b/pages/coupon/coupon-list/index.wxml @@ -28,16 +28,16 @@ - + diff --git a/pages/coupon/coupon-list/index.wxss b/pages/coupon/coupon-list/index.wxss index 7310524..bfe2225 100644 --- a/pages/coupon/coupon-list/index.wxss +++ b/pages/coupon/coupon-list/index.wxss @@ -60,7 +60,7 @@ page { } .center-entry-btn { - color: #fa4126; + color: #1989fa; font-size: 28rpx; text-align: center; line-height: 100rpx; diff --git a/pages/goods/search/index.wxml b/pages/goods/search/index.wxml index 1928e69..7b98a1d 100644 --- a/pages/goods/search/index.wxml +++ b/pages/goods/search/index.wxml @@ -1,5 +1,5 @@ - + diff --git a/pages/order/components/order-button-bar/index.js b/pages/order/components/order-button-bar/index.js index 43cb8f2..c78a5ac 100644 --- a/pages/order/components/order-button-bar/index.js +++ b/pages/order/components/order-button-bar/index.js @@ -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}` }); }, diff --git a/pages/order/order-confirm/index.wxml b/pages/order/order-confirm/index.wxml index c8c0848..df81795 100644 --- a/pages/order/order-confirm/index.wxml +++ b/pages/order/order-confirm/index.wxml @@ -6,10 +6,10 @@ - + diff --git a/services/coupon/addCustomerCoupon.js b/services/coupon/addCustomerCoupon.js new file mode 100644 index 0000000..070d1f4 --- /dev/null +++ b/services/coupon/addCustomerCoupon.js @@ -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); + } + }); + }); +} diff --git a/services/coupon/getCouponList.js b/services/coupon/getCouponList.js new file mode 100644 index 0000000..795bcf0 --- /dev/null +++ b/services/coupon/getCouponList.js @@ -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); + } + }); + }); +} \ No newline at end of file