Commit 165e4fb9 by chenwq

删除订单相关页面及组件,优化代码结构

1 parent 8aa929b1
Showing 174 changed files with 0 additions and 4788 deletions
......@@ -13,7 +13,6 @@
- `pages/`: 主包页面
- `packageIndex/pages/`: 分包页面(业务一)
- `packageMine/pages/`: 分包页面(业务二)
- `components/`: 可复用组件
- `api/module/`: 按业务模块拆分的接口定义
- `utils/`: 工具函数、网络与埋点等基础能力
......
......@@ -45,19 +45,6 @@
"pages/carSeries/carSeries",
"pages/orderDetail/orderDetail"
]
},
{
"root": "packageMine",
"pages": [
"pages/setting/index",
"pages/address/index/index",
"pages/address/detail/detail",
"pages/order/index/index",
"pages/order/detail/detail",
"pages/order/complete/complete",
"pages/order/afterSale_step_two/afterSale_step_two",
"pages/order/afterSaleDetail/afterSaleDetail"
]
}
],
"usingComponents": {
......
import mineApi from '~/api/module/mine.js'
Component({
/**
* 组件的属性列表
*/
properties: {
defaultAddress: Object,
address:Array,
show: {
type: Boolean,
observer: function (val, o) {
if (val && this.properties.address.length) {
console.log(this.properties.defaultAddress?.id)
this.properties.address.forEach((item, index) => {
item.active = false
if (item.id == this.properties.defaultAddress?.id) {
item.active = true
}
})
this.setData({
address: this.properties.address
})
}
}
},
staff:Boolean
},
/**
* 组件的初始数据
*/
data: {
addressList: []
},
/**
* 组件的方法列表
*/
methods: {
back() {
this.cancel()
},
addNew (e) {
let { url } = e.currentTarget.dataset
wx.p.router.go(url,{
platform:true,
staff:this.data.staff,
notIntercept:this.data.staff
})
},
// 确认
confirm(e) {
let { address } = this.data
const item = address?.find(val => val.active == true)
if (!item || !Object.keys(item)?.length) return wx.p.wxApi.showToast('请选择收货地址')
const contactAddress = item.provinceName+item.cityName+item.countyName+item.address
this.triggerEvent('getAddress', {defaultAddress:item,contactAddress})
this.cancel()
},
cancel() {
this.setData({
show: false
})
this.triggerEvent('cancel')
},
toSelect(e) {
const { item } = e.currentTarget.dataset
let { address } = this.data
address?.forEach(val => {
val.active = false
if (item.id == val.id) val.active = true
})
this.setData({address})
},
addressList() {
mineApi.getCustomerAddressList().then(data => {
// 新增地址后默认将新增的选中
data?.forEach((val, index) => {
val.active = false
if (index == 0) val.active = true
})
this.setData({
address: data
})
wx.hideLoading()
})
}
},
lifetimes: {
attached: function () {
wx.p.eventbus.on('REFRESH_PLATFORM_ADDRESS',()=>{
this.addressList()
})
},
},
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.popclass {
border-radius: 16rpx 16rpx 0 0;
}
.address-container {
position: fixed;
left: 0;
bottom: 0;
right: 0;
top: 0;
z-index: 9;
.address-bg {
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .6);
}
.container {
position: absolute;
width: 100%;
height: 65%;
box-sizing: border-box;
background: #FFFFFF;
border-radius: 32rpx 32rpx 0 0;
left: 0;
bottom: 0;
animation: show-sku-box .5s forwards;
z-index: 2;
}
}
.headeer {
height: 104rpx;
background: #F7F7F7;
border-radius: 16rpx 16rpx 0 0;
box-sizing: border-box;
padding: 0 40rpx;
.icon {
width: 40rpx;
height: 40rpx;
}
.title {
font-weight: 500;
font-size: 32rpx;
color: #282829;
}
}
.list-pannel {
height: calc(100% - 260rpx);
.scroll {
height: 100%;
}
.cell {
display: flex;
align-items: center;
box-sizing: border-box;
padding: 32rpx 40rpx;
position: relative;
.icon {
width: 40rpx;
height: 40rpx;
margin-right: 24rpx;
}
.content-box {
.name-phone {
font-weight: 400;
font-size: 24rpx;
color: #707071;
}
.address {
width: 606rpx;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 28rpx;
color: #333435;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-height: 44rpx;
margin: 4rpx 0 8rpx 0;
}
.default-tip {
width: 104rpx;
height: 32rpx;
background: #f13c3d0f;
border: 1.2rpx solid #F13C3D;
border-radius: 4rpx;
font-weight: 400;
font-size: 20rpx;
color: #F13C3D;
}
}
.line {
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 670rpx;
height: 2rpx;
background: #EFF0F2;
}
}
.nothing {
height: 100%;
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
color: #7A8299;
.icon{
width: 320rpx;
height: 300rpx;
margin-bottom: 20rpx;
}
}
}
.footer {
height: 104rpx;
background: #FFFFFF;
box-shadow: 0 0 0 0 #E9E9E9;
box-sizing: border-box;
padding: 0 32rpx;
.btn {
width: calc(50% - 7rpx);
height: 80rpx;
background: #ffffff0f;
border: 2rpx solid #FB8A32;
border-radius: 20rpx;
font-weight: 500;
font-size: 28rpx;
color: #FB8A32;
margin-right: 17rpx;
}
.confirm_btn {
background: #FB8A32;
color: #FFFFFF;
}
}
.flex_sbc {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex_cc {
display: flex;
align-items: center;
justify-content: center;
}
\ No newline at end of file
<!-- <van-popup show="{{ show }}" bind:click-overlay="cancel" custom-class="popclass" position="bottom" custom-style="height: 1076rpx"></van-popup> -->
<view class="address-container" hidden="{{!show}}">
<view class="address-bg" bindtap="cancel"></view>
<view class="container">
<view class="headeer flex_sbc">
<glsx-image bind:tap="cancel" class="icon" src="/index/back.png"></glsx-image>
<view class="title">选择收货地址</view>
<glsx-image bind:tap="cancel" webp class="icon" src="/index/close.png"></glsx-image>
</view>
<view class="list-pannel">
<scroll-view class="scroll" scroll-y="{{true}}" wx:if="{{address.length}}">
<block wx:for="{{address}}" wx:key="index">
<view bind:tap="toSelect" data-item="{{item}}" data-index="{{index}}" class="cell">
<view class="icon">
<icon type="{{item.active?'success':'circle'}}" color="{{item.active?'#FB8A32':'#B1B1B3'}}" size="20">
</icon>
</view>
<view class="content-box">
<view class="name-phone">{{item.receiveName}} {{item.receiveMobile}}</view>
<view class="address">{{item.provinceName}}{{item.cityName}}{{item.countyName}}{{item.address}}</view>
<view wx:if="{{item.isDefault==1}}" class="default-tip flex_cc">默认地址</view>
</view>
<view class="line"></view>
</view>
</block>
</scroll-view>
<view wx:else class="nothing">
<view class="icon">
<glsx-image webp src="/cart/nothing-icon.png" />
</view>
暂无收货地址
</view>
</view>
<view class="footer flex_cc">
<view bind:tap="addNew" data-url="/packageMine/pages/address/detail/detail" class="btn flex_cc">新增地址</view>
<view bind:tap="confirm" class="btn confirm_btn flex_cc">确认</view>
</view>
</view>
</view>
module.exports = Behavior(
{
data: {
afterType:{
1001:'我要退款退货',
1002:'我要退款(无需退货)'
}
}
})
\ No newline at end of file
import kfMixin from './kfMixin'
import orderMixin from './orderMixin'
import afterSaleMixin from './afterSaleMixin'
import countdownMixin from './countdownMixin'
module.exports = {
kfMixin,
orderMixin,
afterSaleMixin,
countdownMixin
}
module.exports = Behavior({
data: {
//
statusEnum: {
1001: '草稿',
1002: '待拍卖',
1003: '拍卖中',
1004: '交易成功',
1005: '流拍',
1006: '已下架'
},
/**售后状态 (1000:待审核,1001:审核通过,1002:已收货,1003:已退款,1004:已生成新订单,1005:审核不通过,1006:已取消)*/
afterSaleStatus: {
1000: '待审核',
1001: '审核通过',
1002:'已收货',
1003: '已退款',
1005: '审核不通过',
1006: '已取消'
},
/**权益&套餐 */
cardStatus: {
0: '未支付',
1: '已支付',
2: '待收货',
3: '已完成',
4: '售后中',
5: '退款失败',
6: '已退款'
},
reStatus: {
2: '充值中',
3: '充值成功',
4: '退款中',
6: '充值失败',
}
}
})
\ No newline at end of file
// packageEquity/pages/serviceApply/util/components/areaSelect.js
Component({
/**
* 组件的属性列表
*/
properties: {
provinceShow: Boolean,
provinceList:{
type:Array,
observer: function(val) {
this.setData({
provinceList: val
})
}
}
},
/**
* 组件的初始数据
*/
data: {
region: [0, 0, 0],//地址每列的index
regionCode: [],
provinceList: []
},
/**
* 组件的方法列表
*/
methods: {
emitHideRegion(){},
// 省市切换
bindChange(e) {
// 用于对比滑动的是哪一列数据
const val = e.detail.value
if(this.data.region[0] !== val[0]) {
// 如果滑动的是第一列数据,让二三列恢复到0
this.setData({
region: [val[0], 0, 0]
})
} else if(this.data.region[1] !== val[1]) {
// 滑动的是第二列数据
this.setData({
region: [val[0], val[1], 0]
})
} else {
this.setData({
region: e.detail.value
})
}
},
// 确定提交
comfirm() {
const {provinceList, region} = this.data
// 省市code
const provinceCode = provinceList[region[0]].addressCode
const cityCode = provinceList[region[0]].children[region[1]].addressCode
const townCode = provinceList[region[0]].children[region[1]].children[region[2]].addressCode
const codeData = [provinceCode,cityCode,townCode]
// 省市名称
const provinceName = provinceList[region[0]].addressName
const cityName = provinceList[region[0]].children[region[1]].addressName
const townName = provinceList[region[0]].children[region[1]].children[region[2]].addressName
const provinceNameData = [provinceName,cityName,townName]
this.triggerEvent('getProvinceCode',{codeData,provinceNameData})
this.triggerEvent('cancelProvince')
},
// 取消
cancel() {
this.triggerEvent('cancelProvince')
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
.dialog_mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
background: rgba(0, 0, 0, 0.5);
}
.dialog_container {
position: absolute;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 70%;
background: white;
border-radius: 40rpx 40rpx 0 0;
box-shadow: 0px -2rpx 4rpx 0px rgba(0, 0, 0, 0.06);
z-index: 9999;
}
.header {
height: 112rpx;
box-sizing: border-box;
padding: 0 32rpx;
}
.header .cancle {
font-size: 28rpx;
font-weight: 500;
color: #969799;
}
.header .title {
font-size: 32rpx;
font-weight: 500;
color: #323233;
}
.header .comfirm {
font-size: 28rpx;
font-weight: 500;
color: #FC5B32;
}
.main{
height: calc(100% - 112rpx);
box-sizing: border-box;
padding: 0 32rpx;
}
.flex_scb {
display: flex;
align-items: center;
justify-content: space-between;
}
\ No newline at end of file
<view wx:if="{{provinceShow}}" class="dialog_mask {{provinceShow?'dialog_show':''}}">
<view class="dialog_mask" bindtap="cancel"></view>
<view class="dialog_container">
<view class="header flex_scb">
<view class="cancle" bindtap="cancel">取消</view>
<view class="title">城市地区</view>
<view class="comfirm" bindtap="comfirm">确定</view>
</view>
<view class="main">
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 100%;" value="{{region}}" bindchange="bindChange">
<picker-view-column>
<view wx:for="{{provinceList}}" wx:key="{{item.addressCode}}" style="line-height: 50px; text-align: center;">
{{item.addressName}}
</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{provinceList[region[0]].children}}" wx:key="{{item.addressCode}}" style="line-height: 50px; text-align: center;">
{{item.addressName}}
</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{provinceList[region[0]].children[region[1]].children}}" wx:key="{{item.addressCode}}" style="line-height: 50px; text-align: center;">
{{item.addressName}}
</view>
</picker-view-column>
</picker-view>
</view>
</view>
</view>
\ No newline at end of file
// packageMine/pages/address/detail/detail.js
import mapApi from "~/utils/mapapi/mapapi";
const phoneRex = /^[1]([3-9])[0-9]{9}$/;
Page({
/**
* 页面的初始数据
*/
data: {
userObj: {
receiveName: "",
receiveMobile: "",
address: "",
isDefault: 0,
platformObj: {},
},
},
onLoad: function (options) {
wx.p.router.getRouterParams(options).then((params) => {
const { id, isDefault } = params;
if (id) {
wx.setNavigationBarTitle({
title: "编辑收货地址",
});
wx.p.api.mineApi.getCustomerAddressList({id: params.id}).then((res) => {
let data = res[0] || {}
data = wx.p.util.clearObjNull(data)
this.setData({
userObj: data,
})
this.platformAddressShowInfo(data)
});
}
if (isDefault) {
this.setData({
"userObj.isDefault": 1,
});
}
this.getBaseData()
});
},
platformAddressShowInfo(item){
const ADDRESS = `${item.provinceName}-${item.cityName}-${item.countyName}`
this.setData({
'userObj.receiveName':item.receiveName,
'userObj.receiveMobile':item.receiveMobile,
'userObj.address':item.address,
'platformObj.code[0]':item.provinceId,
'platformObj.name[0]':item.provinceName,
'platformObj.code[1]':item.cityId,
'platformObj.name[1]':item.cityName,
'platformObj.code[2]':item.countyId,
'platformObj.name[2]':item.countyName,
'platformObj.address':ADDRESS,
'platformObj.id':item.id,
'userObj.isDefault':item.isDefault,
})
},
useLocation() {
let {
currentAddress: { formatted_addresses, address_component, ad_info },
areaCode
} = this.data;
const provinceNameData = [ad_info.province, ad_info.city, ad_info.district]
const provinceCode = areaCode?.find(val => ad_info.province?.includes(val.addressName))?.addressCode
const cityCode = areaCode.map(val =>
val.children?.find(v => ad_info.city?.includes(v.addressName))?.addressCode
).filter(code => code)[0]
const townCode = areaCode.map(val =>
val.children?.map(v =>
v.children?.find(d => ad_info.district?.includes(d.addressName))?.addressCode
)
).flat().filter(code => code)[0];
const codeData = [provinceCode, cityCode, townCode]
let detail = {
provinceNameData,
codeData
}
this.getProvinceCode({detail})
this.setData({
"userObj.address": formatted_addresses.recommend,
"userObj.areaId": ad_info.adcode,
});
},
/**获取当前位置 */
getLocation() {
let { currentAddress } = this.data;
if (currentAddress) return;
this.setData({
unauthorized: false,
});
wx.getLocation({
type: "gcj02",
})
.then(({ latitude, longitude }) => {
console.log(this);
this.setData({
current: true,
});
mapApi.detailedAdrress([latitude, longitude]).then((detail) => {
this.setData({
currentAddress: detail,
});
});
})
.catch((err) => {
wx.p.wxApi.showToast("获取位置失败");
});
},
/**打开授权设置 */
authAddress() {
this.setData({
showAuth: true,
});
},
/**授权失败 */
authFail() {
this.setData({
unauthorized: true,
});
},
/**授权成功 */
authSuccess() {
this.getLocation();
},
getBaseData() {
wx.p.api.mineApi.getBaseAddress().then(res => {
this.setData({
areaCode: this.areaTree(res)
})
})
},
// 省市区转数型
areaTree(items) {
// items = items.slice(0,50)
let res = [] // 存放结果集
let map = {}
// 判断对象是否有某个属性
let getHasOwnProperty = (obj, property) => Object.prototype.hasOwnProperty.call(obj, property)
// 边做map存储,边找对应关系
for (const i of items) {
map[i.addressCode] = {
...i,
children: getHasOwnProperty(map, i.addressCode) ? map[i.addressCode].children : []
}
const newItem = map[i.addressCode]
if (i.parentAddressCode == 0) {
res.push(newItem)
} else {
if (!getHasOwnProperty(map, i.parentAddressCode)) {
map[i.parentAddressCode] = {
children: []
}
}
map[i.parentAddressCode].children.push(newItem)
}
}
return res
},
showSelect(){
this.setData({
showAreaSelect:true
})
},
cancelProvince(){
this.setData({
showAreaSelect:false
})
},
getProvinceCode(e){
let address = e.detail.provinceNameData.toString()
address = address.replace(/,/g, "-")
this.setData({
'platformObj.code': e.detail.codeData,
"platformObj.address": address,
"platformObj.name": e.detail.provinceNameData,
})
},
input(e) {
let { target } = e.currentTarget.dataset;
let { value } = e.detail;
this.setData({
[`userObj.${target}`]: value,
});
},
blur(e) {
let { value } = e.detail;
this.setData({
"userObj.address": value,
});
},
save() {
let { userObj, platformObj } = this.data;
try {
Object.keys(userObj).map((key) => {
if (key == "receiveName" && !userObj[key]) throw "请输入姓名";
if (key == "receiveMobile") {
if (!userObj[key]) throw "请输入手机号";
if (!phoneRex.test(userObj[key])) throw "请输入正确的手机号";
}
if (key == "address" && !userObj[key]) throw "请填写详细地址";
});
if(!platformObj){
throw '请选择所在地区'
}
} catch (error) {
wx.p.wxApi.showToast(error);
return;
}
let _params = {
receiveName: userObj.receiveName,
receiveMobile: userObj.receiveMobile,
address: userObj.address,
provinceId: platformObj.code[0],
provinceName: platformObj.name[0],
cityId: platformObj.code[1],
cityName: platformObj.name[1],
countyId: platformObj.code[2],
countyName: platformObj.name[2],
isDefault: userObj.isDefault,
}
if (userObj?.id) {
_params.id = userObj.id
}
wx.p.api.mineApi.saveAddress(_params).then(() => {
wx.p.wxApi.showToast("操作成功");
wx.p.router.back(page => {
wx.p.eventbus.emit('REFRESH_PLATFORM_ADDRESS')
})
})
},
setDefault() {
this.setData({
"userObj.isDefault": this.data.userObj.isDefault == 0 ? 1 : 0,
});
},
showSelect() {
this.setData({
showAreaSelect: true,
});
},
cancelProvince() {
this.setData({
showAreaSelect: false,
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
});
{
"navigationBarTitleText": "新建收货地址",
"usingComponents":{
"gl-textarea": "/components/GlTextarea/GlTextarea",
"area-select":"./components/AreaSelect/index"
}
}
\ No newline at end of file
/* packageMine/pages/address/detail/detail.wxss */
@import '../index/index.scss';
page {
background: #F7F8FA;
}
.layout {
padding: var(--margin);
}
.current {
padding: var(--margin);
background: #fff;
border-radius:24rpx;
height: 160rpx;
box-sizing: border-box;
.flex{
height: 100%;
}
}
.current .address-box {
display: flex;
align-items: flex-start;
font-size: var(--margin);
justify-content: space-between;
position: relative;
}
.current .address-box .address-icon{
position: absolute;
width: 36rpx;
height: 36rpx;
left: 0;
}
.current .address-info {
width: calc(100% - 178rpx);
box-sizing: border-box;
padding-left: 68rpx;
}
.current .address-info .address-title {
font-weight: 500;
margin-bottom: 12rpx;
color: #282829;
font-size: 32rpx;
}
.current .address-info .address {
color: #656566;
font-size: 26rpx;
font-weight: 400;
}
.current .address-btn {
font-size: 24rpx;
background-color: #F75454;
width: 168rpx;
height: 40rpx;
color: #fff;
border-radius: 12rpx;
}
.user-info {
margin-top: 24rpx;
padding: 0 var(--margin);
background-color: #fff;
font-size: 28rpx;
border-radius: 24rpx;
}
.user-info .item {
min-height: 108rpx;
display: flex;
align-items: center;
border-bottom: 2rpx solid #F0F0F0;
box-sizing: border-box;
padding: 26rpx 0;
}
.user-info .textarea {
border-bottom: none;
}
.user-info .item .label {
width: 192rpx;
}
.user-info .item .value {
width: calc(100% - 192rpx);
font-size: 28rpx;
}
.user-info .textarea {
align-items: flex-start;
padding-top: 26rpx;
}
.user-info .textarea .value{
padding-top: 4rpx;
height: 120rpx;
}
.default {
display: flex;
align-items: center;
font-size: 28rpx;
font-weight: 500;
color: #333333;
margin-top: 24rpx;
border-radius: 16rpx;
background: #fff;
height: 112rpx;
padding: 0 var(--margin);
display: flex;
justify-content: space-between;
}
.default icon {
margin-right: 8rpx;
}
.default-btn{
margin-top: 206rpx;
}
.btn-box {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 100rpx;
background-color: #fff;
}
.btn-box .btn {
margin: 6rpx calc(var(--margin) * 2);
background-color: var(--btnColor);
height: 88rpx;
font-weight: 500;
color: #fff;
font-size: 32rpx;
border-radius: 20rpx;
}
\ No newline at end of file
<view class="layout">
<view class="current">
<block wx:if="{{!current}}">
<block wx:if="{{unauthorized}}">
<view class="flex" bindtap="authAddress">授权获取当前位置</view>
</block>
<block wx:else>
<view class="flex">获取当前位置中...</view>
</block>
</block>
<block wx:else>
<view class="address-box">
<view class="address-icon y-center">
<glsx-image src="/mine/location.png"></glsx-image>
</view>
<view class="address-info">
<view class="address-title text-hide">
{{currentAddress.formatted_addresses.recommend}}
</view>
<view class="address text-hide">{{currentAddress.address}}</view>
</view>
<view class="address-btn text-center" bindtap="useLocation">使用当前定位</view>
</view>
</block>
</view>
<view class="user-info">
<view class="item">
<view class="label">收货人</view>
<view class="value">
<input bindblur="input" data-target="receiveName" maxlength="10" value="{{userObj.receiveName}}" type="text" placeholder="请填写收货人姓名" placeholder-style="color:#B1B1B3;" />
</view>
</view>
<view class="item">
<view class="label">手机号码</view>
<view class="value">
<input bindblur="input" data-target="receiveMobile" value="{{userObj.receiveMobile}}" type="number" maxlength="11" placeholder="请填写收货人手机号" placeholder-style="color:#B1B1B3;" />
</view>
</view>
<view class="item" bindtap="showSelect">
<view class="label">所在地区</view>
<view class="value " style="color:{{platformObj.address?'':'#B1B1B3'}}">
<block wx:if="{{platformObj.address}}">
{{platformObj.address}}
</block>
<block wx:else>请选择省/市/区</block>
</view>
</view>
<view class="item textarea">
<view class="label">详细地址</view>
<view class="value">
<gl-textarea value="{{userObj.address}}" bindblur="blur" customMaxLength filterEmoji maxlength="30" placeholder="小区楼栋/乡村名称"></gl-textarea>
</view>
</view>
</view>
<view class="default" bindtap="setDefault">
设为默认收货地址
<block wx:if="{{userObj.isDefault == 1}}">
<icon type="success" size="36rpx" color="#FB8A32"></icon>
</block>
<block wx:else>
<icon type="circle" size="36rpx" color="#E3E3E6"></icon>
</block>
</view>
<!-- <view class="default-btn" bindtap="save">保存并使用</view> -->
<view class="btn-box isFullSucreen">
<view class="btn text-center" bindtap="save">保存并使用</view>
</view>
</view>
<authorize scopeType="userLocation" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
<area-select provinceShow="{{showAreaSelect}}" provinceList="{{areaCode}}" bind:cancelProvince="cancelProvince" bind:getProvinceCode="getProvinceCode"></area-select>
<glsx-privacy appletName="优加发拍"></glsx-privacy>
\ No newline at end of file
// packageMine/pages/address/index/index.js
Page({
/**
* 页面的初始数据
*/
data: {
addressList: [],
},
jump(e) {
let { id } = e.currentTarget.dataset,
{ isChooseAddress, addressList } = this.data,
isDefault = addressList.length == 0;
wx.p.router.go("/packageMine/pages/address/detail/detail", {
id,
isChooseAddress,
isDefault,
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.p.router.getRouterParams(options).then((res) => {
this.setData(res);
});
},
chooseThis(e) {
let { item } = e.currentTarget.dataset,
{ isChooseAddress } = this.data;
if (isChooseAddress) {
wx.p.router.back((page) => {
const contactAddress = `${item.province}${item.city}${item.area}${item.address}`;
page.setData({
contactAddress,
contactInfo: {
contactAddress,
contactName: item.receiveName,
contactPhone: item.phoneNumber,
id: item.id
},
isDefault: item.isDefault == 1,
});
});
}
},
getUserAddressList(showTips = "") {
wx.showLoading();
this.setData({
addressList: [],
});
wx.p.api.mineApi.getCustomerAddressList().then((data) => {
this.setData({
addressList: data,
});
if (showTips) wx.p.wxApi.showToast(showTips);
}).finally(() => {
wx.hideLoading();
});
},
chooseDefault(e) {
let {
item: { id, isDefault },
item,
} = e.currentTarget.dataset;
if (isDefault != 0) return;
let params = {
...item,
isDefault: 1
}
wx.p.api.mineApi
.saveAddress(params)
.then(() => {
wx.p.wxApi.showToast("操作成功");
let { isChooseAddress } = this.data;
if (isChooseAddress) {
wx.p.router.back((page) => {
const contactAddress = `${item.province}${item.city}${item.area}${item.address}`;
page.setData({
contactAddress,
contactInfo: {
contactAddress,
contactName: item.receiveName,
contactPhone: item.phoneNumber,
},
isDefault: true,
});
});
} else {
this.getUserAddressList("默认地址更新成功");
}
});
},
del(e) {
let { id } = e.currentTarget.dataset;
wx.showModal({
title: "温馨提示",
content: "是否删除当前地址?",
cancelText: "否",
confirmText: "是",
confirmColor: "#F13C3D",
}).then((res) => {
if (res.confirm) {
wx.p.api.mineApi
.removeAddress({
id
})
.then(() => {
wx.p.wxApi.showToast("删除成功");
setTimeout(() => {
this.getUserAddressList();
}, 500);
});
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getUserAddressList();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
});
{
"navigationBarTitleText": "我的地址"
}
\ No newline at end of file
/* packageMine/pages/address/index/index.wxss */ /* packageMine/pages/address/index/index.wxss */
.layout {
padding-bottom: calc(100rpx + var(--constantSafeAreaInsetBottom));
padding-bottom: calc(100rpx + var(--envSafeAreaInsetBottom));
}
.address-item {
margin: var(--margin);
background-color: #fff;
border-radius: 24rpx;
min-height: 234rpx;
padding: 0 var(--margin);
}
.address-item .top {
display: flex;
padding-top: 34rpx;
justify-content: space-between;
}
.address-item .top .info {
width: calc(100% - 70rpx);
padding-bottom: 20rpx;
font-size: 28rpx;
.address {
color: #282829;
font-weight: 400;
}
}
.address-item .top .info .user {
margin-bottom: 20rpx;
color: #0a0d14;
font-weight: 500;
.name {
margin-left: 0;
font-weight: 500;
}
}
.address-item .top .info .user text {
margin-left: 16rpx;
color: #0a0d14;
font-weight: 400;
}
.address-item .top .icon-box {
height: 40rpx;
.icon-address-edit {
width: 40rpx;
height: 40rpx;
}
}
.address-item .top .icon {
width: var(--margin);
height: var(--margin);
}
.address-item .bottom {
height: 78rpx;
border-top: 1rpx solid #f0f0f0;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 24rpx;
}
.address-item .bottom .choose {
display: flex;
align-items: center;
height: 100%;
color: #6e6e7a;
}
.address-item .bottom .del {
display: flex;
align-items: center;
height: 100%;
color: #656566;
width: 100rpx;
justify-content: flex-end;
}
.address-item .bottom .choose.default {
color: var(--btnColor);
}
.address-item .bottom .choose icon {
margin-right: 20rpx;
}
.nothing {
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
color: #7A8299;
padding-top: 40rpx;
.icon {
width: 320rpx;
height: 300rpx;
margin-bottom: 20rpx;
}
}
.btn-box {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 100rpx;
background-color: #fff;
}
.btn-box .btn {
margin: 6rpx calc(var(--margin) * 2);
background-color: var(--btnColor);
height: 88rpx;
font-weight: 500;
color: #fff;
font-size: 32rpx;
border-radius: 20rpx;
}
<view class="layout">
<block wx:if="{{addressList.length}}">
<block wx:for="{{addressList}}" wx:key="index">
<view class="address-item" catchtap="chooseThis" data-item="{{item}}">
<view class="top">
<view class="info">
<view class="user">
<text class="name">{{item.receiveName}}</text>
<text>{{item.receiveMobile}}</text>
</view>
<view class="address">{{item.provinceName}}{{item.cityName}}{{item.countyName}}{{item.address}}</view>
</view>
<block wx:if="{{!isChooseAddress}}">
<view class="icon-box" catchtap="jump" data-item="{{item}}" data-edit data-id="{{item.id}}">
<view class="sprite-icon icon-address-edit">
<glsx-image src="/mine/edit-address.png"></glsx-image>
</view>
</view>
</block>
</view>
<view class="bottom">
<view class="choose {{item.isDefault == 1?'default':''}}" catchtap="chooseDefault" data-item="{{item}}">
<icon type="{{item.isDefault == 1?'success':'circle'}}" size="32rpx" color="{{item.isDefault == 1?'#FB8A32':'#6E6E7A'}}"></icon>
默认地址
</view>
<block wx:if="{{!isChooseAddress}}">
<view class="del" catchtap="del" data-item="{{item}}" data-id="{{item.id}}">删除</view>
</block>
</view>
</view>
</block>
</block>
<block wx:else>
<view class="nothing">
<view class="icon">
<glsx-image webp src="/cart/nothing-icon.png" />
</view>
暂无收货地址
</view>
</block>
</view>
<view class="btn-box isFullSucreen">
<view class="btn text-center" bindtap="jump">新增收货地址</view>
</view>
\ No newline at end of file
Page({
data: {
couponsList: []
},
toReciveAll() {
let para = {
couponIdList: this.data.ids
}
wx.p.api.couponsApi.toReciveCard(para).then(res => {
if (res) {
wx.p.router.go('/packageMine/pages/coupon/success/success')
}
})
},
/**获取礼券 */
getCoupons() {
let para = {
discountTypes: [3]
}
let ids = []
wx.p.api.couponsApi.getHomeCardData(para).then(res => {
res.list.map(item => {
if (item.effectiveStartTime) {
item.effectiveStartTime = new Date(item.effectiveStartTime).format('yyyy.MM.dd')
item.effectiveEndTime = new Date(item.effectiveEndTime).format('yyyy.MM.dd')
}
ids.push(item.id)
return item
})
this.setData({
couponsList: res.list,
ids
})
})
},
onLoad() {
this.getCoupons()
}
})
{
"navigationBarTitleText": "领券中心",
"usingComponents": {
"coupon-item": "../components/CouponsItem/element"
}
}
\ No newline at end of file
page {
background: #F9F7F7;
}
.center-page {
box-sizing: border-box;
padding: 0 32rpx;
}
.btn_wrapper {
/* width: calc(100% - 64rpx); */
width: 100%;
background: var(--btnColor);
height: 88rpx;
text-align: center;
line-height: 88rpx;
border-radius: 8rpx;
font-size: 32rpx;
color: #FFFFFF;
margin-top: 100rpx;
margin-bottom: 210rpx;
/* position: fixed;
bottom: 210rpx;
left: 50%;
transform: translate(-50%, 0);
z-index: 10; */
}
\ No newline at end of file
<view class="center-page">
<block wx:for="{{couponsList}}" wx:key="index">
<coupon-item mode="center" coupons="{{item}}"></coupon-item>
</block>
<view class="btn_wrapper" bind:tap="toReciveAll">一键领取</view>
</view>
\ No newline at end of file
Component({
properties: {
coupons: {
type: Object,
value: {}
},
mode: {
type: String,
value: 'coupon' //coupon卡券 center领券中心
},
btnStatus: {
type: Number,
value: 0
},
useMemberType: Number,
hideBtn: Boolean,
couponStyle: String
},
data: {
// 2 折扣券,3 代金券,4 兑换券,7 服务券
IMGURL: wx.$imgUrl
},
methods: {
toRecive() {
let para = {
couponIdList: [this.data.coupons.id]
}
wx.p.api.couponsApi.toReciveCard(para).then(res => {
if (res) {
wx.p.router.go('/packageMine/pages/coupon/success/success')
}
})
},
toDetail() {
let {
coupons,
useMemberType
} = this.data, {
discountType,
useChannel,
id
} = coupons, detailInfo = {
xx: 'xx'
}
if (discountType == 2 || discountType == 4) {
wx.p.router.go('/packageMall/pages/coupon/coupon', {
userCouponId: id,
useMemberType,
detailInfo
})
return
}
/**线上商品代金券 */
if (discountType == 3 && useChannel == 1) {
wx.p.router.go('/packageMine/pages/coupon/recommend/recommend', {
couponInfo: coupons
})
return
}
wx.p.router.go('/packageMine/pages/coupon/detail/detail', {
item: coupons
})
}
}
})
\ No newline at end of file
{
"component": true
}
\ No newline at end of file
<!-- <view class="box_wrapper" style="{{couponStyle}}; background-image: url({{btnStatus == 0 ? couponBaseList[coupons.discountType]:unCouponBaseList[coupons.discountType]}});"> -->
<view class="box_wrapper" style="{{couponStyle}}">
<view class="bg">
<glsx-image webp src="mine/coupon/{{btnStatus == 0 ? '' :'un-'}}coupon-{{coupons.discountType}}.png"></glsx-image>
</view>
<view class="container">
<view class="{{coupons.discountType==4 || coupons.discountType==7 ? '':'left_icon_box'}}">
<!-- <image wx:if="{{btnStatus==0}}" class="left_bg" src="../../packageMine/images/coupons/coupons_active.png" />
<image wx:else class="left_bg" src="../../packageMine/images/coupons/coupons.png" /> -->
<!-- <view wx:if="{{coupons.discountType==7}}" class="left_text_one left_text_four">
<text class="anText">券</text>
<text wx:if="{{coupons.useType&&coupons.effectiveType!=3}}">{{ coupons.usedAmount }}/{{ coupons.useAllAmount }}</text>
<text wx:else>不限次数</text>
</view> -->
<view wx:if="{{coupons.discountType==3}}" class="left_text_one left_text_two {{btnStatus == 0 ? 'brightColor':'darkColor'}}">
<text class="price_icon">¥</text>
<text>{{coupons.denomination}}</text>
</view>
<view wx:if="{{coupons.discountType==2}}" class="left_text_one left_text_two {{btnStatus == 0 ? 'brightColor':'darkColor'}}">
<!-- <text class="anText">券</text> -->
<text class="anText" wx:if="{{coupons.discountIntensity}}">{{coupons.discountIntensity}}</text>
<text class="discount" wx:if="{{coupons.discountIntensity}}">折</text>
</view>
<!-- <view class="left_text_one">8.5折</view> -->
<!-- <view class="left_text_one left_text_two">
</view> -->
<!-- <view class="left_text_one left_text_three">满99可用</view> -->
</view>
<view class="main_box {{coupons.discountType==4 || coupons.discountType==7 ? 'leftMargin':''}}">
<view class="title_text {{btnStatus == 0 ? 'brightColor':'darkColor'}}">{{coupons.couponName}}</view>
<view wx:if="{{coupons.useType==0 && coupons.discountType==7}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">不限次数</view>
<view wx:if="{{coupons.useType==1 && coupons.discountType==7}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">可用{{coupons.useAmount}}次</view>
<view wx:if="{{coupons.useType==2 && coupons.discountType==7}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">{{coupons.useLimitDays}}天可用{{coupons.useAmount}}次</view>
<!-- <view wx:if="{{coupons.discountType==3}}" style="height:1px" class="drive"></view> -->
<view wx:if="{{coupons.useBarriers==1 && coupons.discountType!=4}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">无门槛</view>
<view wx:if="{{coupons.useBarriers==2 && coupons.discountType!=4}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">满{{coupons.full}}元可用</view>
<view wx:if="{{coupons.effectiveType==3}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">永久有效</view>
<view wx:if="{{coupons.effectiveType==2}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">{{coupons.receiveStartTime}}-{{coupons.receiveEndTime}}</view>
<view wx:if="{{coupons.effectiveType==1}}" class="h4_text {{btnStatus == 0 ? 'describeColor':'darkColor'}}">有效期至{{coupons.receiveEndTime}}</view>
<!-- <view wx:else class="h4_text drive">{{coupons.receiveStartTime}}-{{coupons.receiveEndTime}}</view> -->
<!-- <view wx:if="{{coupons.effectiveType==1}}" class="h4_text drive">{{coupons.effectiveStartTime}}-{{coupons.effectiveEndTime}}</view> -->
</view>
<!-- <view wx:if="{{mode=='center'}}" class="box_btn box_btn_color" bind:tap="toRecive">领取</view> -->
<block wx:if="{{!hideBtn}}">
<view wx:if="{{mode=='coupon'&&btnStatus==0}}" class="box_btn box_btn_color" bind:tap="toDetail">去使用</view>
<view wx:if="{{mode=='coupon'&&btnStatus==1}}" class="box_btn box_btn_color box_btn_color_grey" bind:tap="toDetail">去查看</view>
<view wx:if="{{mode=='coupon'&&btnStatus==2}}" class="box_btn box_btn_color box_btn_color_grey" bind:tap="toDetail">去查看</view>
</block>
</view>
</view>
\ No newline at end of file
page {
background: white;
}
.box_wrapper {
width: 100%;
height: 162rpx;
/* background: #FFFFFF; */
/* border-radius: 8rpx; */
margin-top: 19rpx;
display: flex;
align-items: center;
position: relative;
box-sizing: border-box;
background-size: cover;
}
.left_icon_box {
width: 156rpx;
height: 156rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
}
.left_bg {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 156rpx;
height: 156rpx;
z-index: 1;
}
.left_text_one {
font-size: 48rpx;
font-weight: 600;
z-index: 2;
}
.left_text_two {
display: flex;
align-items: flex-end;
}
.left_text_four {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.left_text_three {
font-size: 20rpx;
margin-top: 6rpx;
}
.left_tran {
transform: translateX(-120rpx);
}
.anText {
font-size: 48rpx;
/* color: rgba(white, white, white, 0.45); */
font-weight: 600;
/* color: #FFF; */
/* opacity: 0.45; */
}
.price_icon {
font-size: 24rpx;
/* margin-right: 4rpx; */
margin-bottom: 7rpx;
font-weight: 500;
}
.main_box {
height: 156rpx;
box-sizing: border-box;
padding: 24rpx 24rpx 24rpx 0rpx;
justify-content: space-evenly;
display: flex;
flex-direction: column;
z-index: 1;
}
.box_btn {
position: absolute;
right: 47rpx;
top: 50%;
transform: translate(0, -50%);
width: 120rpx;
height: 44rpx;
/* background: #B1B1B3; */
text-align: center;
line-height: 44rpx;
font-size: 28rpx;
font-weight: 600;
}
.box_btn_color {
/* background: var(--btnColor); */
color: var(--btnColor);
}
.box_btn_color_grey {
color: #6D6D6D;
}
.title_text {
color: #282829;
font-weight: 600;
color: #282829;
font-size: 28rpx;
width: 309rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.h4_text {
font-weight: 400;
color: #B1B1B3;
font-size: 20rpx;
}
.leftMargin {
padding-left: 32rpx;
}
.brightColor {
color: var(--btnColor);
}
.darkColor {
color: #6D6D6D;
}
.describeColor {
color: #D83C14;
}
.discount {
font-size: 20rpx;
font-weight: 500;
margin-bottom: 10rpx;
}
.box_wrapper .bg{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.box_wrapper .container {
display: flex;
align-items: center;
position: relative;
z-index: 1;
width: 100%;
height: 100%;
}
import QR from '~/lib/wxqrcode'
Page({
data: {
coupon: {
discountType: 7
},
detailInfo: {},
failure: false,
future: false,
dayDiff: 0,
hourDiff: 0,
minDiff: 0
},
jump(e) {
let { item } = e.currentTarget.dataset
wx.openLocation({
latitude: item.lat,
longitude: item.lng,
name: item.merchantName,
address: item.merchantAddress
})
},
getDetailData(id) {
let para = {
userCouponId: id
}
wx.p.wxApi.showLoading('加载中...')
wx.p.api.couponsApi.couponsDetail(para).then(res => {
wx.hideLoading()
let qrcodeURL = QR.createQrCodeImg(`t=2&c=${res.verificationCode}`)
let failure = false
let future = false
res.receiveTime = new Date(res.receiveTime).format('yyyy.MM.dd hh:mm:ss')
res.verificationCode = res.verificationCode.replace(/(.{4})/g, '$1 ')
if (res.couponState == 2) {
failure = true
} else if (res.couponState == 1) {
failure = false
} else if (res.couponState == 3) {
future = true
} else if (res.couponState == 4) {
future = true
} else if (res.couponState == 5) {
failure = true
}
let dayDiff = 0
let hourDiff = 0
let minDiff = 0
if (future) {
dayDiff = res.nextLimitDays
hourDiff = res.nextLimitHours
minDiff = res.nextLimitMin
}
if (res.list.length) {
res.list.map(el => {
el.verificationTime = new Date(el.verificationTime).format('yyyy-MM-dd hh:mm:ss')
return el
})
}
res.receiveEndTime = new Date(res.receiveEndTime).format('yyyy.MM.dd hh:mm:ss')
res.receiveStartTime = new Date(res.receiveStartTime).format('yyyy.MM.dd hh:mm:ss')
this.setData({
detailInfo: res,
future,
failure,
dayDiff,
hourDiff,
minDiff,
qrcodeURL,
coupon: res,
flag: true
})
})
},
onLoad(options) {
let couponInfo = options.item
this.getDetailData(couponInfo.id)
this.setData({
couponInfo
})
// wx.$Track.setTrack(
// {
// couponInfo
// },
// 6
// )
}
})
{
"navigationBarTitleText": "卡券详情",
"usingComponents": {
"coupon-item": "../components/CouponsItem/element"
}
}
\ No newline at end of file
page {
background: #F7F8FA !important;
/* background: #f5f5f5; */
}
.detail-page {
box-sizing: border-box;
padding: 32rpx 32rpx 20rpx;
}
.an-page {
box-sizing: border-box;
padding: 32rpx;
}
.wrapper {
width: 100%;
background: #FFFFFF;
border-radius: 8rpx;
}
.top_element_wrap {
display: flex;
box-sizing: border-box;
border-bottom: 2rpx solid #EFF0F2;
}
.coupon {
height: 196rpx;
border-radius: 8rpx;
margin: 0 32rpx;
}
.icon_box {
width: 156rpx;
height: 156rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.ele_icon {
position: absolute;
width: 100%;
height: 100%;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 1;
}
.icon_text {
font-size: 36rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #FFFFFF;
position: relative;
z-index: 2;
}
.ele_conetent_box {
box-sizing: border-box;
padding-left: 20rpx;
}
.title_wrap {
margin-top: 64rpx;
box-sizing: border-box;
padding-left: 20rpx;
}
.code_wrap {
margin-top: 36rpx;
box-sizing: border-box;
width: 100%;
text-align: center;
}
.code-text {
font-size: 64rpx;
font-family: DINAlternate-Bold, DINAlternate;
font-weight: bold;
color: var(--btnColor);
letter-spacing: 20rpx;
}
.code_box {
width: calc(100% - 64rpx);
height: 140rpx;
background: #979797;
margin: 0 auto;
margin-top: 36rpx;
}
.html-wrap {
width: 100%;
box-sizing: border-box;
padding: 0 20rpx;
word-wrap: break-word;
}
.title-text {
font-size: 28rpx;
font-weight: 600;
color: #282829;
margin-top: 4rpx;
}
.min-text {
font-size: 24rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #B1B1B3;
margin-top: 2rpx;
}
.date-text {
margin-top: 38rpx;
}
.code-tip {
margin-top: 10rpx;
text-align: center;
}
.drive_line {
width: 100%;
height: 2rpx;
background: #EFF0F2;
}
.shop_info_wrap {
box-sizing: border-box;
padding: 0 20rpx;
margin-top: 24rpx;
}
.shop_header {
display: flex;
align-items: center;
}
.header_img {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
}
.shop_title {
color: #282829;
font-size: 28rpx;
padding-left: 28rpx;
font-weight: 400;
}
.shop_adress {
width: 100%;
font-size: 24rpx;
font-weight: 400;
color: #656566;
margin-top: 24rpx;
}
.shop_date {
font-size: 24rpx;
font-weight: 400;
color: #656566;
margin-top: 8rpx;
}
/* 服务券 */
.other_wrapper {
width: 100%;
}
.an_title_text {
font-size: 32rpx;
font-weight: 500;
color: #333;
margin-bottom: 20rpx;
}
.an_min_title_text {
text-align: center;
font-size: 22rpx;
font-weight: 500;
color: #B1B1B3;
margin-top: 10rpx;
}
/* .code_widget {
width: 100%;
height: 364rpx;
box-sizing: border-box;
background: #FEFFFE;
border-radius: 8rpx;
margin-top: 32rpx;
padding: 32rpx 0;
padding-top: 32rpx;
padding-bottom: 32rpx;
position: relative;
} */
.code_failture {
position: absolute;
left: 50%;
top: 154rpx;
transform: translate(-50%, 0);
padding: 10rpx 44rpx;
color: #FFFFFF;
background: #999999;
border-radius: 16rpx;
}
.code_future {
position: absolute;
left: 50%;
top: 144rpx;
transform: translate(-50%, 0);
padding: 10rpx 50rpx;
color: var(--btnColor);
background: #FDDED5;
border-radius: 16rpx;
}
.code_text_red {
font-size: 28rpx;
text-align: center;
line-height: 40rpx;
}
.mar5 {
margin-bottom: 10rpx;
}
.iamge_qr_wrap {
width: 280rpx;
height: 280rpx;
position: relative;
margin: 24rpx auto;
}
.qrcodeimage {
width: 280rpx;
height: 280rpx;
}
.qrBtn {
/* position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 236rpx;
height: 64rpx; */
display: flex;
/* align-items: center; */
justify-content: center;
/* background: #FFFFFF;
border: 2rpx solid #979797;
box-shadow: 0px 4rpx 8rpx 0px rgba(0, 0, 0, 0.29);
border-radius: 16rpx; */
font-size: 28rpx;
margin: 24rpx 0 12rpx;
/* line-height: 40px; */
/* color: #656566;
font-weight: 400; */
}
.qrBtns {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
font-weight: 400;
color: #FFFFFF;
line-height: 32rpx;
width: 181rpx;
height: 84rpx;
background: #000;
border-radius: 8rpx;
opacity: 0.7;
}
.op30 {
opacity: 0.3;
}
.qrText {
color: var(--btnColor);
}
.code_main_text {
text-align: center;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
}
.count_text {
margin-left: 10rpx;
font-weight: 600;
}
/* .useed_widget {
width: 100%;
height: 554rpx;
box-sizing: border-box;
background: #FEFFFE;
margin-top: 32rpx;
padding: 32rpx 0;
border-radius: 8rpx;
} */
.step_wrapper {
display: flex;
align-items: center;
justify-content: center;
margin-top: 40rpx;
}
.step_icon {
width: 92rpx;
height: 92rpx;
margin-bottom: 20rpx;
}
.step_arrpw {
width: 46rpx;
height: 33rpx;
margin: 0 24rpx;
}
.step_box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.desc_wrapper {
padding: 0 24rpx;
color: #B1B1B3;
font-size: 28rpx;
margin-top: 40rpx;
}
.note_line {
box-sizing: border-box;
/* padding: 0 24rpx; */
/* margin-bottom: 20rpx; */
line-height: 48rpx;
/* display: flex;
align-items: center;
justify-content: space-between; */
}
.line_text {
font-size: 24rpx;
color: #666;
}
.price_icon {
font-size: 20rpx;
margin-right: 4rpx;
}
.code_text_grey {
color: #B1B1B3;
}
.box {
padding: 0 32rpx 40rpx 32rpx;
}
.box-X {
border-radius: 8rpx;
background-color: #fff;
padding: 24rpx 24rpx 40rpx;
}
.box .title {
font-size: 32rpx;
padding-bottom: 24rpx;
font-weight: 500;
}
.box .goods {
margin-top: 24rpx;
display: flex;
align-items: center;
height: 160rpx;
}
.box .goods .icon {
width: 160rpx;
height: 100%;
overflow: hidden;
border-radius: 8rpx;
margin-right: 20rpx;
}
.box .goods .info {
width: calc(100% - 180rpx);
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.box .goods .info .name {
font-size: 30rpx;
color: #333;
}
.box .goods .info .price {
display: flex;
color: var(--btnColor);
font-weight: 500;
}
.box .goods .info .price-X {
margin-top: -8rpx;
font-size: 36rpx;
font-family: DINAlternate-Bold, DINAlternate;
}
.couponBox {
border-radius: 8rpx;
background-color: #fff;
padding: 32rpx 32rpx 20rpx 32rpx;
margin: 0 0 20rpx;
box-shadow: 0rpx 8rpx 16rpx 0rpx rgba(224, 224, 224, 0.5);
}
.note_line .line_text_name {
font-size: 28rpx;
color: #333;
}
.note_line .line {
height: 2rpx;
background: #EEE;
margin: 16rpx 0 14rpx;
}
.couponBox .couponBox-X {
max-width: 610rpx;
line-height: 48rpx;
}
.couponBox .couponBox-X .titleDay {
font-size: 28rpx;
font-weight: 500;
color: #333;
}
.titleDay_text {
font-size: 24rpx;
color: #666;
}
.darkColor {
color: #666;
}
.couponBox .title {
font-size: 32rpx;
font-weight: 500;
color: #333;
}
.couponBox .store-box {
background: #F9F9F9;
border: 2rpx solid #E9E9E9;
border-radius: 8rpx;
padding: 16rpx 32rpx;
margin-bottom: 18rpx;
}
.couponBox .store-box:last-child {
margin-bottom: 0;
}
.couponBox .storeName {
font-size: 28rpx;
color: #333;
margin-bottom: 8rpx;
}
.couponBox .businessTime {
font-size: 24rpx;
color: #999;
padding-bottom: 18rpx;
}
.couponBox .line {
height: 2rpx;
background: #EEE;
}
.couponBox .addressBox {
padding-top: 20rpx;
font-size: 24rpx;
color: #666;
display: flex;
align-items: center;
}
.couponBox .addressBox .navigation {
width: 32rpx;
height: 32rpx;
}
.timeColor {
color: #999;
}
.changeColor {
color: #333;
}
.numberColor {
color: #B4B4B4;
}
.couponBox .topBox {
display: flex;
}
.couponBox .topBox .baseImage {
width: 140rpx;
height: 138rpx;
background-size: cover;
position: absolute;
right: 24rpx;
top: 22rpx;
}
.couponBox .topBox .title_text {
font-size: 36rpx;
font-weight: 600;
margin-bottom: 20rpx;
max-width: 510rpx;
}
.couponBox .lines {
height: 2rpx;
background: #EEE;
margin: 32rpx 0 30rpx;
}
.couponBox .process {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 4rpx;
}
.process .process_text {
margin-left: 4rpx;
font-size: 24rpx;
color: #333;
}
.process image {
width: 24rpx;
height: 24rpx;
}
.process .rightArrow {
padding: 0 40rpx;
}
\ No newline at end of file
// index.js
// 获取应用实例
Page({
data: {
tabs: ['店铺优惠券', '权益优惠券'],
curTabIndex: 0,
couponsList: [],
imgBaseURL: 'https://img01.glsx.com.cn/weapp/resource/equity-h5-new/mini/',
showGiftsModal: false,
giftsList: [],
haveCouponsList: []
},
jump(e) {
let {
item
} = e.currentTarget.dataset
let url = '/packageMine/pages/order/detail/detail'
wx.p.router.go(url, item)
},
state(e) {
let {
key
} = e.currentTarget.dataset
let {
couponsList,
haveCouponsList
} = this.data
couponsList[key].checkCoupon = !couponsList[key].checkCoupon
if (!couponsList[key].checkCoupon) {
couponsList[key].userCouponList = haveCouponsList[key].slice(0, 4)
} else {
couponsList[key].userCouponList = haveCouponsList[key]
}
this.setData({
couponsList
})
},
changeTab(e) {
let {
showLogin
} = this.data
if(showLogin) return
this.data.haveCouponsList = []
this.setData({
curTabIndex: e.detail,
couponsList: [],
flag: false
})
this.getCouponsList()
},
bottomToRefresh(e) {
let isBottom = e.detail.direction
if (isBottom == 'bottom') {
//刷新下一页
}
},
getCouponsList() {
wx.p.wxApi.showLoading('加载中...')
let {
curTabIndex,
isMerchant
} = this.data
let {merchantId} = wx.p.storage.get('merchant_info')
let para = {
useMemberType: 0
}
if (curTabIndex == 1) para.discountType = 8 //线上优惠券加上这个参数
if (!isMerchant) para.merchantId = merchantId
wx.p.api.couponsApi.getCardData(para).then(res => {
wx.hideLoading()
let list = res.map(item => {
item.checkCoupon = false
item.userCouponList.map((itm, index) => {
itm.receiveStartTime = new Date(itm.receiveStartTime).format('yyyy.MM.dd')
if (itm.effectiveType == 1) {
itm.receiveEndTime = new Date(itm.receiveEndTime).format('yyyy.MM.dd hh:mm:ss')
} else {
itm.receiveEndTime = new Date(itm.receiveEndTime).format('yyyy.MM.dd')
}
itm.discountIntensity = itm.discountIntensity / 100
return itm
})
this.data.haveCouponsList.push(item.userCouponList)
return item
})
list = res.map(item => {
if (item.userCouponList.length > 4 && curTabIndex != 1) {
item.userCouponList = item.userCouponList.slice(0, 4)
}
return item
})
this.setData({
couponsList: list,
haveCouponsList: this.data.haveCouponsList,
flag: true
})
})
},
async onLoad(options) {
const showLogin =!wx.p.isLogin
this.setData({
showLogin
})
//判断只展示当前门店的
if (options.isMerchant == 1) {
this.setData({
isMerchant: true
})
}
if (options.pageFrom == 'directional') {
this.setData({
showGiftsModal: true,
giftsList: options.list
})
}
this.getCouponsList()
},
// ***********定向礼包相关内容***********
clickClose() {
this.setData({
showGiftsModal: false
})
},
goInvolidPage() {
wx.p.router.go('../usedDetail/usedDetail', {
isOnline: this.data.curTabIndex
})
},
// 去使用
toUseGifts(e) {
let {
item
} = e.currentTarget.dataset
let {
discountType,
useChannel,
id
} = item
if (discountType == 2 || discountType == 4) {
wx.p.router.go('/packageMall/pages/coupon/coupon', {
userCouponId: id,
useMemberType: item.useMemberType
})
return
}
/**线上商品代金券 */
if (discountType == 3 && useChannel == 1) {
if (item.useMemberType == 1) {
wx.p.wxApi.showToast('代金券已使用')
return
}
wx.p.router.go('/packageMine/pages/coupon/recommend/recommend', {
couponInfo: item
})
return
}
wx.p.router.go('/packageMine/pages/coupon/detail/detail', {
item
})
},
toUseConpon(e) {
const {
brandName,
goodsId,
id,
goodsLogo,
appearance,
goodsName,
couponId
} = e.currentTarget.dataset.item
let path = '/packageEquity/pages/commodity/detail/detail'
let param = {
supplier: 'HW',
brandName,
id: goodsId,
couponsId: id,
couponId
}
if (appearance == 2) {
path = '/packageEquity/pages/commodity/chargeDetail/chargeDetail'
param.productName = goodsName
param.icon = goodsLogo
}
wx.p.router.go(path, {
inType: 'game',
param
})
}
})
\ No newline at end of file
{
"usingComponents": {
"coupon-item": "../components/CouponsItem/element",
"tab":"/components/Tab/Tab"
},
"navigationBarTitleText": "我的卡券"
}
\ No newline at end of file
/* packageMine/pages/coupon/index/index.wxss */
/**index.wxss**/
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
page {
background: #F9F7F7;
}
.tab_widget {
width: 100%;
height: 92rpx;
background: #F9F7F7;
}
.tab_element {
width: 120rpx;
height: 92rpx;
position: relative;
color: #707071;
font-size: 36rpx;
display: flex;
align-items: center;
justify-content: center;
font-weight: 400;
}
.tab_element_active {
font-size: 40rpx;
color: #2D2D2E;
font-weight: 500;
}
.active_tab_line {
width: 48rpx;
height: 8rpx;
background: var(--btnColor);
border-radius: 2rpx;
position: absolute;
left: 50%;
bottom: 0;
transform: translate(-50%, 0);
}
.content_widget {
box-sizing: border-box;
/* padding: 0 32rpx; */
}
.box_wrapper {
width: 100%;
box-sizing: border-box;
padding: 20rpx;
display: flex;
align-items: center;
position: relative;
margin-top: 24rpx;
}
.left_icon_box {
width: 156rpx;
height: 156rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
}
.left_bg {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 156rpx;
height: 156rpx;
z-index: 1;
}
.left_text_one {
font-size: 36rpx;
font-weight: 600;
color: #FFFFFF;
z-index: 2;
}
.left_text_two {
display: flex;
align-items: flex-end;
}
.left_text_three {
font-size: 20rpx;
margin-top: 6rpx;
}
.price_icon {
font-size: 20rpx;
margin-right: 4rpx;
}
.main_box {
height: 156rpx;
box-sizing: border-box;
padding: 4rpx 0 4rpx 20rpx;
}
.box_btn {
position: absolute;
right: 20rpx;
top: 50%;
transform: translate(0, -50%);
width: 120rpx;
height: 44rpx;
background: #B1B1B3;
border-radius: 22rpx;
color: #FFF;
font-size: 20rpx;
text-align: center;
line-height: 44rpx;
}
.title_text {
color: #282829;
font-weight: 600;
color: #282829;
font-size: 28rpx;
}
.h4_text {
font-weight: 400;
color: #B1B1B3;
font-size: 24rpx;
}
.drive {
margin-top: 38rpx;
}
.involid_btn{
display: flex;
justify-content: center;
}
.view_involid{
height: 48rpx;
line-height: 48rpx;
border: 2rpx solid #999999;
border-radius: 24rpx;
color: #999999;
width: 204rpx;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.view_involid .text{
height: 48rpx;
line-height: 48rpx;
}
.view_involid .right{
width: 24rpx;
height: 24rpx;
// vertical-align: middle;
}
.no_data {
padding-top: 48rpx;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 36rpx;
}
.nodata_bg {
width: 320rpx;
height: 320rpx;
}
.nodata_text {
color: #B1B1B3;
font-size: 28rpx;
line-height: 44rpx;
margin-top: 8rpx;
}
/* 定向礼包弹框 */
.flex_ccc {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.gifts_modal {
position: fixed;
left: 0;
right: 0;
top: 0;
right: 0;
background: rgba(0, 0, 0, 0.66);
width: 100%;
height: 100%;
z-index: 999999;
}
.gifts_wrap {
width: 100%;
height: 100%;
}
.gifts_wrapper {
width: 100%;
/* height: 337rpx; */
position: relative;
}
/*自定义背景颜色*/
.custom_banner_wrap{
width: 86%;
min-height: 170rpx;
/* background: linear-gradient(-180deg, #FE7534, #FF4815); */
position: absolute;
top:51.3%;
left: 50%;
transform: translateX(-50%);
z-index: -1;
/* border-radius:0 0 32rpx 32rpx; */
}
.custom_box{
height: 170rpx;
}
.gifts_modal_bg {
width: 87.3%;
height: 51.3%;
}
.gifts_modal_btn {
width: 39%;
height: 102rpx;
margin-top: 56rpx;
}
.gifts_content_wrap {
width: calc(87.3% - 52rpx);
height: 64%;
/* background: #FFFFFF; */
position: absolute;
left: 50%;
bottom: 6rpx;
transform: translate(-50%, 0);
overflow-x: hidden;
overflow-y: scroll;
}
.gifts_modal_bottom_bg {
position: absolute;
left: 50%;
bottom: 6rpx;
transform: translate(-50%, 0);
width: 83.2%;
height: 87rpx;
}
.gifts_item_wrap {
width: 100%;
height: 170rpx;
position: relative;
}
.gifts_item_bg {
width: 100%;
height: 170rpx;
}
.gifts_po_wrap {
position: absolute;
left: 0;
top: 0;
height: 170rpx;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.left_widget {
box-sizing: border-box;
padding:0 0 0 40rpx;
width: 70%;
}
.coup_title{
font-size: 30rpx;
font-weight: 400;
color: #1A1919;
width: 70%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.coup_tip {
font-size: 24rpx;
font-weight: 400;
color: #817F7C;
margin-top: 19rpx;
}
.right_widget{
padding-right: 32rpx;
}
.gifts_to_use_bg{
width: 120rpx;
height: 46rpx;
}
/**小于2的样式*/
.mini_widget{
width: 100%;
min-height: 207rpx;
}
.mini_header_bg{
width: 87.3%;
height: 207rpx;
}
.mini_box_wrap{
width: 86.3%;
height: 281rpx;
position: relative;
box-sizing: border-box;
padding: 0 29rpx;
}
.mini_box_bg{
width: 100%;
height: 345rpx;
position: absolute;
top: -54rpx;
left: 0;
right: 0;
z-index: -1;
}
.storeName {
margin-top: 30rpx;
font-size: 32rpx;
font-weight: 500;
color: #282829;
/* display: inline-block; */
}
.storeWidth {
max-width: 477rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.stretch {
font-size: 32rpx;
font-weight: 500;
color: #999;
margin-left: 10rpx;
}
.stretchColor {
color: var(--btnColor);
font-size: 32rpx;
font-weight: 500;
margin-left: 10rpx;
}
/* .listWidth {
max-height: 810rpx;
overflow: hidden;
white-space: nowrap;
} */
.checkList {
justify-content: center;
margin-top: 18rpx;
}
.checkList .check {
font-size: 24rpx;
color: #999;
}
.state {
width: 24rpx;
height: 24rpx;
margin-left: 10rpx;
}
.associatedOrder {
display: flex;
font-size: 24rpx;
padding-top: 8rpx;
}
.associatedOrder .order {
color: #666;
}
.associatedOrder .order-X {
color: #333;
max-width: 337rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.associatedOrder .checkOrder {
color: var(--btnColor);
position: absolute;
right: 0;
}
.online_conpon_ctnr{
margin-top: 32rpx;
}
.online_conpon{
height: 156rpx;
background: #FFF5F3;
border-radius: 8rpx;
padding: 8rpx;
display: flex;
}
.online_conpon .price_wrap{
padding-left: 16rpx;
display: flex;
flex-direction: column;
justify-content: center;
width: 154rpx;
flex-shrink: 0;
color: var(--btnColor);
}
.price_wrap .num{
height: 84rpx;
font-weight: 600;
font-size: 42rpx;
color: var(--btnColor);
}
.price_wrap .unit{
height: 28rpx;
font-weight: 500;
font-size: 20rpx;
color: var(--btnColor);
vertical-align: text-top;
margin-left: 4rpx;
}
.price_wrap .tip{
height: 34rpx;
font-weight: 400;
font-size: 24rpx;
color: #D83C14;
}
.online_conpon .info_wrap{
flex: 1;
background-color: #fff;
padding: 16rpx 12rpx 16rpx 24rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
}
.info_wrap .name{
height: 80rpx;
font-weight: 600;
font-size: 28rpx;
color: #333333;
line-height: 40rpx;
}
.info_wrap .remark,.info_wrap .date{
height: 28rpx;
line-height: 20rpx;
font-weight: 400;
font-size: 20rpx;
color: #D83C14;
}
.info_wrap .use_btn{
position: absolute;
width: 136rpx;
height: 48rpx;
line-height: 48rpx;
background-image: linear-gradient(90deg, var(--btnColor) 2%, #FF1A33 96%);
border-radius: 23rpx;
color: #fff;
text-align: center;
right: 12rpx;
bottom: 16rpx;
}
.isFullSucreen-btn{
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
\ No newline at end of file
<view class="coupons_container">
<view class="tab_widget">
<tab tab="{{tabs}}" bindclick="changeTab"></tab>
</view>
<block wx:if="{{showLogin}}">
<view class="no_data">
<glsx-image webp class="nodata_bg" src="coupons/no_card_bg.png" />
<view class="nodata_text">暂无优惠券</view>
</view>
</block>
<block wx:else>
<block wx:if="{{flag}}">
<view wx:if="{{couponsList.length}}" style="height:-116rpx;padding-bottom: 35rpx;" class="content_widget">
<scroll-view scroll-y="{{true}}" style="height:100%;padding: 0 32rpx;box-sizing: border-box;" class="scroll_wrap" bindscrolltolower="bottomToRefresh">
<!-- listWidth -->
<view wx:for="{{couponsList}}" wx:key="index">
<block wx:if="{{curTabIndex == 0}}">
<view class="flex storeName">
<text class="storeWidth">{{item.merchantName}}</text>
<text class="{{curTabIndex == 0 ? 'stretchColor':'stretch'}}">({{item.couponAmount}}张)</text>
</view>
<block wx:for="{{item.userCouponList}}" wx:for-item="i" wx:key="id">
<coupon-item btnStatus="{{curTabIndex}}" coupons="{{i}}" useMemberType="{{curTabIndex}}"></coupon-item>
<view class="associatedOrder" wx:if="{{i.goodsOrderCode && curTabIndex == 1}}">
<view class="order">该券已用在订单:</view>
<view class="order-X" catchtap="jump" data-item="{{i.goodsOrderCode}}">{{i.goodsName}}</view>
<view class="checkOrder" catchtap="jump" data-item="{{i.goodsOrderCode}}">查看订单></view>
</view>
</block>
<block wx:if="{{haveCouponsList[index].length > 4}}">
<view class="flex checkList" wx:if="{{!item.checkCoupon}}" catchtap="state" data-key="{{index}}">
<view class="check">查看剩余所有券</view>
<glsx-image webp class="state" src="mine/coupon/down.png" />
</view>
<view class="flex checkList" wx:else catchtap="state" data-key="{{index}}">
<view class="check">收起</view>
<glsx-image webp class="state" src="mine/coupon/up.png" />
</view>
</block>
</block>
<block wx:else>
<view class="online_conpon_ctnr" wx:for="{{item.userCouponList}}" wx:for-item="i" wx:key="id">
<view class="online_conpon">
<view class="price_wrap">
<view>
<text class="num">{{i.denomination || 0}}</text>
<text class="unit">元</text>
</view>
<view class="tip">无门槛</view>
</view>
<view class="info_wrap">
<view class="name">{{i.brandName ? i.brandName + '·' : ''}}{{i.appearance == 2 ? i.goodsName + i.rechargeDenomination : i.goodsName}}</view>
<!-- <view class="remark">无门槛</view> -->
<view class="date" wx:if="{{i.discountType == 8}}">数量:{{i.amount}}</view>
<view class="date" wx:if="{{i.discountType != 8}}">有效期{{i.effectiveDays || 0}}天</view>
<view class="date" wx:else>剩余有效期:{{i.residueEffectiveDays || 0}}天</view>
<view class="use_btn" bindtap="toUseConpon" data-item="{{i}}">去使用</view>
</view>
</view>
</view>
</block>
</view>
</scroll-view>
</view>
<view wx:else class="no_data">
<glsx-image webp class="nodata_bg" src="coupons/no_card_bg.png" />
<view class="nodata_text">暂无优惠券</view>
</view>
<view class="involid_btn isFullSucreen-btn">
<view class="view_involid" bindtap="goInvolidPage">
<text class="text">查看失效券</text>
<glsx-image class="right" src="mine/right.png"></glsx-image>
</view>
</view>
</block>
<!-- 定向礼包弹框 -->
<view wx:if="{{showGiftsModal}}" class="gifts_modal flex_ccc">
<view class="gifts_wrap flex_ccc">
<view wx:if="{{giftsList.length>2}}" class="gifts_wrapper flex_ccc">
<glsx-image webp mode="widthFix" class="gifts_modal_bg" src="{{imgBaseURL}}gifts_list_bg.png" />
<view class="gifts_content_wrap">
<view wx:for="{{giftsList}}" class="gifts_item_wrap">
<glsx-image webp mode="widthFix" class="gifts_item_bg" src="{{imgBaseURL}}gifts_coupons_bg.png" />
<view class="gifts_po_wrap">
<view class="left_widget">
<view class="coup_title">{{item.couponName}}</view>
<view wx:if="{{item.effectiveType==3}}" class="coup_tip">无限期</view>
<view wx:if="{{item.effectiveType==2}}" class="coup_tip">有效期:{{item.receiveStartTime}}-{{item.receiveEndTime}}</view>
<view wx:if="{{item.effectiveType==1}}" class="coup_tip">有效至{{item.receiveEndTime}}</view>
</view>
<view class="right_widget">
<glsx-image webp mode="widthFix" bind:tap="toUseGifts" data-item="{{item}}" class="gifts_to_use_bg" src="{{imgBaseURL}}gifts_touse.png" />
</view>
</view>
</view>
<view style="height:88rpx"></view>
</view>
<glsx-image webp mode="widthFix" class="gifts_modal_bottom_bg" src="{{imgBaseURL}}gifts_fixed_bottom.png" />
</view>
<view wx:if="{{giftsList.length<3}}" class="mini_widget flex_ccc">
<glsx-image webp mode="widthFix" class="mini_header_bg" src="{{imgBaseURL}}gifts_header_bg.png" />
<view class="mini_box_wrap" style="height:{{giftsList.length==2?408:298}}rpx">
<glsx-image webp class="mini_box_bg" style="height:{{giftsList.length==2?450:340}}rpx" src="{{imgBaseURL}}gifts_box_bg.png" />
<view style="height:50rpx"></view>
<view wx:for="{{giftsList}}" class="gifts_item_wrap">
<glsx-image webp mode="widthFix" class="gifts_item_bg" src="{{imgBaseURL}}gifts_coupons_bg.png" />
<view class="gifts_po_wrap">
<view class="left_widget">
<view class="coup_title">{{item.couponName}}</view>
<view wx:if="{{item.effectiveType==3}}" class="coup_tip">无限期</view>
<view wx:if="{{item.effectiveType==2}}" class="coup_tip">有效期:{{item.receiveStartTime}}-{{item.receiveEndTime}}</view>
<view wx:if="{{item.effectiveType==1}}" class="coup_tip">有效至{{item.receiveEndTime}}</view>
</view>
<view class="right_widget">
<glsx-image webp mode="widthFix" bind:tap="toUseGifts" data-item="{{item}}" class="gifts_to_use_bg" src="{{imgBaseURL}}gifts_touse.png" />
</view>
</view>
</view>
</view>
</view>
<glsx-image webp mode="widthFix" bind:tap="clickClose" class="gifts_modal_btn" src="{{imgBaseURL}}gifts_comfirm_btn.png" />
</view>
</view>
</block>
</view>
\ No newline at end of file
// packageMine/pages/coupon/recommend/recommend.js
Page({
/**
* 页面的初始数据
*/
data: {
list: [],
pageNum: 1,
detailInfo: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.id){
// 领取记录id 优惠券id 门店id
this.setData({
couponInfo: { merchantId:options.merchantId,couponId:options.couponId }
},()=>{
this.getDetailData(options.id)
})
return
}
this.setData(options, () => {
this.getDetailData(options.couponInfo.id)
})
},
jump(e) {
let { item } = e.currentTarget.dataset
wx.openLocation({
latitude: item.lat,
longitude: item.lng,
name: item.merchantName,
address: item.merchantAddress
})
},
jumpCommodity(e) {
let { item } = e.currentTarget.dataset
// console.log('item',item);
let { id } = item
let isActivity = false
if (this.data.couponInfo.merchantId == this.data.userInfo.merchantId) {
wx.p.router.go('/packageMall/pages/detail/detail', { id, isActivity, notIntercept: true })
} else {
wx.p.wxApi.showToast('其他门店商品,暂不支持查看')
}
},
getDetailData(id) {
let para = {
userCouponId: id
}
wx.p.wxApi.showLoading('加载中...')
wx.p.api.couponsApi.couponsDetail(para).then(res => {
res.receiveEndTime = new Date(res.receiveEndTime).format('yyyy.MM.dd hh:mm:ss')
res.receiveStartTime = new Date(res.receiveStartTime).format('yyyy.MM.dd hh:mm:ss')
res.receiveTime = new Date(res.receiveTime).format('yyyy.MM.dd hh:mm:ss')
this.setData(
{
detailInfo: res,
flag: true
},
() => {
this.getCouponGoodsPage()
}
)
})
},
getCouponGoodsPage() {
// wx.p.wxApi.showLoading()
let total = 0
let {
list,
pageNum,
couponInfo: { merchantId },
couponInfo: { couponId, id }
} = this.data
wx.p.api.shopmallApi
.getCouponGoodsPage({
pageNum,
couponId: couponId || id,
merchantId
})
.then(data => {
console.log(data)
this.setData({
list: [...list, ...data.list],
total,
listFlag: true
})
wx.hideLoading()
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let { pageNum, total } = this.data
wx.p.util.onReachBottom(
{
pageNum,
total
},
() => {
this.getCouponGoodsPage()
}
)
}
})
{
"navigationBarTitleText": "卡券详情",
"usingComponents": {
}
}
/* packageMine/pages/coupon/recommend/recommend.wxss */
page {
background-color: #F7F8FA !important;
}
.layout{
padding-top: 24rpx;
padding-bottom: 24rpx;
}
.coupon {
height: 203rpx;
/* background: rgba(252, 91, 50, 0.05); */
/* border-radius: 8rpx; */
margin: 0 24rpx;
position: relative;
}
.coupon .bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.coupon .info {
position: relative;
z-index: 2;
display: flex;
width: 100%;
height: 100%;
}
.tips {
font-size: 28rpx;
color: #b1b1b3;
text-align: center;
margin: 32rpx 0 20rpx;
}
.goods-box{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 32rpx ;
}
.goods{
width: 328rpx;
height: 520rpx;
margin-bottom: 32rpx;
position: relative;
}
.coupon .left_box {
width: 255rpx;
height: 150rpx;
color: #FFFFFF;
font-size: 56rpx;
font-weight: 600;
text-align: center;
line-height: 150rpx;
}
.coupon .left_box .price_icon {
font-size: 24rpx;
font-weight: 500;
}
.coupon .right_box {
padding: 28rpx 28rpx 0 28rpx;
width: 464rpx;
}
.top_box {
height: 120rpx;
border-bottom: 2rpx dashed rgba(216, 60, 20, 0.1);
}
.top_box .voucherName {
font-size: 28rpx;
font-weight: 600;
padding-bottom: 8rpx;
}
.h4_text {
font-size: 20rpx;
font-weight: 400;
}
.brightColor {
color: var(--btnColor);
}
.darkColor {
color: #666;
}
.describeColor {
color: #D83C14;
}
.timeColor {
color: #999;
}
.bottom_box {
height: 42rpx;
line-height: 42rpx;
}
.box {
border-radius: 8rpx;
background-color: #fff;
padding: 32rpx 32rpx 20rpx 32rpx;
margin: 20rpx 32rpx 0;
box-shadow: 0rpx 8rpx 16rpx 0rpx rgba(224, 224, 224, 0.5);
}
.box .title {
font-size: 32rpx;
font-weight: 500;
padding-bottom: 24rpx;
color: #333;
}
.box .good {
display: flex;
padding-bottom: 12rpx;
}
.box .good .icon {
width: 144rpx;
height: 144rpx;
}
.box .good .icon image {
border-radius: 8rpx;
}
.box .lines {
height: 2rpx;
background: #EFF0F2;
margin: 20rpx 0 32rpx 0;
}
.box .good .info {
margin-left: 32rpx;
}
.box .good .info .name {
font-size: 28rpx;
color: #282829;
}
.box .good .info .price {
display: flex;
margin-top: 50rpx;
font-size: 36rpx;
font-weight: 600;
color: var(--btnColor);
}
.box .good .info .price .price-X {
margin-left: 10rpx;
}
.box .store-box {
background: #F9F9F9;
border: 2rpx solid #E9E9E9;
border-radius: 8rpx;
padding: 16rpx 32rpx;
margin-bottom: 18rpx;
}
.box .store-box:last-child {
margin-bottom: 0;
}
.box .storeName {
font-size: 28rpx;
color: #333;
margin-top: -4rpx;
}
.box .businessTime {
font-size: 24rpx;
color: #999;
margin-top: 4rpx;
padding-bottom: 18rpx;
}
.box .line {
height: 2rpx;
background: #EEE;
}
.box .addressBox {
padding-top: 20rpx;
font-size: 24rpx;
color: #666;
display: flex;
align-items: center;
}
.box .addressBox .navigation {
width: 32rpx;
height: 32rpx;
}
.box .box-X {
max-width: 610rpx;
line-height: 48rpx;
}
.box .box-X .titleDay {
font-size: 28rpx;
font-weight: 500;
color: #333;
}
.box .box-X .titleDay_text {
font-size: 24rpx;
color: #666;
}
\ No newline at end of file
<block wx:if="{{flag}}">
<view class="layout">
<!-- <view class="coupon" style="background-image: url({{detailInfo.useMemberType == 0 ? onlineCouponBaseList[0]:onlineCouponBaseList[1]}});"> -->
<!-- <coupon-item coupons="{{couponInfo}}" hideBtn couponStyle="background:transparent"></coupon-item> -->
<view class="coupon">
<glsx-image webp src="mine/coupon/daijin{{detailInfo.useMemberType == 0 == 1?'':'-lose'}}.png" class="bg"></glsx-image>
<view class="info">
<view class="left_box">
<text class="price_icon">¥</text>
<text>{{detailInfo.denomination / 100}}</text>
</view>
<view class="right_box">
<view class="top_box">
<view class="voucherName {{detailInfo.useMemberType == 0 ? 'brightColor':''}}">{{couponInfo.couponName}}</view>
<view wx:if="{{(couponInfo.useBarriers==1 && couponInfo.discountType!=4) || (detailInfo.useBarriers==1 && detailInfo.discountType!=4)}}" class="h4_text {{detailInfo.useMemberType == 0 ? 'describeColor':'darkColor'}}">无门槛</view>
<view wx:if="{{(couponInfo.useBarriers==2 && couponInfo.discountType!=4) || (detailInfo.useBarriers==2 && detailInfo.discountType!=4)}}" class="h4_text {{detailInfo.useMemberType == 0 ? 'describeColor':'darkColor'}}">满{{detailInfo.full / 100}}元可用</view>
</view>
<view class="bottom_box">
<view wx:if="{{couponInfo.effectiveType==3 || detailInfo.effectiveType==3}}" class="h4_text timeColor">永久有效</view>
<view wx:if="{{couponInfo.effectiveType==2 || detailInfo.effectiveType==2}}" class="h4_text timeColor">{{detailInfo.receiveStartTime}}-{{detailInfo.receiveEndTime}}</view>
<view wx:if="{{couponInfo.effectiveType==1 || detailInfo.effectiveType==1}}" class="h4_text timeColor">有效期至{{detailInfo.receiveEndTime}}</view>
</view>
</view>
</view>
</view>
<view class="box" style="padding-bottom: 32rpx;">
<view class="box-X" style="padding-bottom: 16rpx;">
<view class="titleDay">有效日期:</view>
<view wx:if="{{couponInfo.effectiveType==3 || detailInfo.effectiveType==3}}" class="titleDay_text darkColor">永久有效</view>
<view wx:if="{{couponInfo.effectiveType==2 || detailInfo.effectiveType==2}}" class="titleDay_text darkColor">{{detailInfo.receiveStartTime}}-{{detailInfo.receiveEndTime}}</view>
<view wx:if="{{couponInfo.effectiveType==1 || detailInfo.effectiveType==1}}" class="titleDay_text darkColor">有效期至{{detailInfo.receiveEndTime}}</view>
</view>
<view class="box-X" style="padding-bottom: 16rpx;">
<view class="titleDay">获取日期:</view>
<view class="titleDay_text darkColor">{{detailInfo.receiveTime}}</view>
</view>
<view class="box-X" style="line-height: 44rpx;">
<view class="titleDay">使用说明:</view>
<view class="titleDay_text darkColor" style="white-space:pre-wrap">{{detailInfo.useDescription || ''}}</view>
</view>
</view>
<view class="box" wx:if="{{list.length}}">
<view class="title">适用商品</view>
<block wx:for="{{list}}" wx:key="index">
<view class="good" catchtap="jumpCommodity" data-item="{{item}}">
<view class="icon">
<image webp src="{{item.goodsImage}}"></image>
</view>
<view class="info">
<view class="name">{{item.goodsName}}</view>
<view class="price">
¥<view class="price-X">{{item.retailPrice / 100}}</view>
</view>
</view>
</view>
<view class="lines" wx:if="{{index < list.length - 1}}"></view>
</block>
</view>
<!-- <view class="box" style="margin-bottom: 32rpx;" wx:if="{{detailInfo.suitMerchantLists && detailInfo.suitMerchantLists.length}}">
<view class="title">适用门店</view>
<view wx:for="{{detailInfo.suitMerchantLists}}" wx:key="index" class="store-box">
<view class="storeName">{{item.merchantName}}</view>
<view wx:if="{{item.bussinessBegintime}}" class="businessTime">营业时间:{{item.bussinessBegintime}}-{{item.bussinessEndtime}}</view>
<view wx:else class="businessTime">营业时间:无</view>
<view class="line" wx:if="{{item.merchantAddress}}"></view>
<view class="addressBox" wx:if="{{item.merchantAddress}}">
<view style="width: 552rpx;padding-right: 24rpx;">{{item.merchantAddress}}</view>
<view class="navigation" catchtap="jump" data-item="{{item}}">
<glsx-image webp src="mine/icon-go.png"></glsx-image>
</view>
</view>
</view>
</view> -->
<!-- <view class="tips">- 为你推荐 -</view>
<view class="goods-box">
<block wx:if="{{listFlag}}">
<block wx:if="{{list.length}}">
<block wx:for="{{list}}" wx:key="index">
<view class="goods">
<goods item="{{item}}"></goods>
</view>
</block>
<block wx:if="{{nothing}}">
<view class="list-nothing ">到底啦!!</view>
</block>
</block>
<block wx:else>
<view class="list-nothing">
暂无可使用商品
</view>
</block>
</block>
</view> -->
</view>
</block>
\ No newline at end of file
Page({
data: {
count: 5
},
countDown() {
let count = this.data.count
this.data.countDownTime = setInterval(() => {
if (count == 0) {
clearInterval(this.data.countDownTime);
this.goToIndex()
return;
}
count--;
this.setData({
count
})
}, 1 * 1000);
},
goToIndex() {
wx.p.router.switchTab('/pages/tab/index/index')
},
goToCoupons() {
clearInterval(this.data.countDownTime);
wx.p.router.redirectTo('/packageMine/pages/coupon/index/index')
},
onUnload() {
clearInterval(this.data.countDownTime);
},
onLoad() {
this.countDown()
}
})
\ No newline at end of file
{
"navigationBarTitleText": "领取成功"
}
\ No newline at end of file
/* packageMine/pages/coupon/success/success.wxss */
\ No newline at end of file
<view class="success_page">
<!-- <image webp class="success_icon" src="../../../../images/coupons/success.png" /> -->
<glsx-image webp class="success_icon" src="coupons/success.png" />
<view class="success_text">您的优惠礼券领取成功!</view>
<view class="success_count">{{count}}秒后自动跳转到首页</view>
<view class="success_btn_wrap btn_pos">
<view class="btn_box btn_orage" bind:tap="goToCoupons">使用优惠券</view>
</view>
<view class="success_btn_wrap">
<view bind:tap="goToIndex" class="btn_box">回到首页</view>
</view>
</view>
\ No newline at end of file
page {
background: #F9F7F7;
}
.success_page {
display: flex;
flex-direction: column;
align-items: center;
}
.success_icon {
width: 140rpx;
height: 140rpx;
border-radius: 50%;
margin-top: 112rpx;
}
.success_text {
font-weight: 500;
color: #282829;
font-size: 32rpx;
margin-top: 84rpx;
}
.success_count {
font-weight: 400;
color: #B1B1B3;
font-size: 28rpx;
margin-top: 20rpx;
}
.success_btn_wrap {
position: fixed;
bottom: 270rpx;
left: 0;
right: 0;
box-sizing: border-box;
padding: 0 32rpx;
}
.btn_box {
width: 100%;
height: 88rpx;
text-align: center;
line-height: 88rpx;
color: #B1B1B3;
font-size: 32rpx;
border-radius: 8rpx;
border: 2rpx solid #B1B1B3;
}
.btn_orage {
background: var(--btnColor);
border: 2rpx solid var(--btnColor);
color: #FFFFFF;
}
.btn_pos {
bottom: 390rpx;
}
\ No newline at end of file
// index.js
// 获取应用实例
Page({
data: {
tabs: ['已使用', '已失效'],
curTabIndex: 0,
couponsList: [],
imgBaseURL: 'https://img01.glsx.com.cn/weapp/resource/equity-h5-new/mini/',
showGiftsModal: false,
giftsList: [],
haveCouponsList: []
},
jump(e) {
let {
item
} = e.currentTarget.dataset
// console.log(e)
let url = '/packageMine/pages/order/detail/detail'
// if (orderStatus > 5 && orderStatus != 14 && orderStatus != 13&&orderStatus != 15) url = 'afterSaleDetail'
wx.p.router.go(url, {
orderCode: item
})
},
state(e) {
let {
key
} = e.currentTarget.dataset
let {
couponsList,
haveCouponsList
} = this.data
couponsList[key].checkCoupon = !couponsList[key].checkCoupon
if (!couponsList[key].checkCoupon) {
couponsList[key].userCouponList = haveCouponsList[key].slice(0, 4)
} else {
couponsList[key].userCouponList = haveCouponsList[key]
}
this.setData({
couponsList
})
},
changeTab(e) {
this.data.haveCouponsList = []
this.setData({
curTabIndex: e.detail,
couponsList: [],
flag: false
})
this.getCouponList()
},
bottomToRefresh(e) {
let isBottom = e.detail.direction
if (isBottom == 'bottom') {
//刷新下一页
}
},
getCouponList() {
wx.p.wxApi.showLoading('加载中...')
let {
curTabIndex,
isMerchant,
isOnline
} = this.data
let {
merchantId
} = wx.p.storage.get('merchant_info')
let para = {
useMemberType: curTabIndex + 1
}
if (isOnline == 1) para.discountType = 8 //线上优惠券加上这个参数
if (!isMerchant) para.merchantId = merchantId
wx.p.api.couponsApi.getCardData(para).then(res => {
wx.hideLoading()
// console.log(res);
let list = res.map(item => {
item.checkCoupon = false
item.userCouponList.map((itm, index) => {
itm.receiveStartTime = new Date(itm.receiveStartTime).format('yyyy.MM.dd')
if (itm.effectiveType == 1) {
itm.receiveEndTime = new Date(itm.receiveEndTime).format('yyyy.MM.dd hh:mm:ss')
} else {
itm.receiveEndTime = new Date(itm.receiveEndTime).format('yyyy.MM.dd')
}
itm.discountIntensity = itm.discountIntensity / 100
return itm
})
this.data.haveCouponsList.push(item.userCouponList)
return item
})
list = res.map(item => {
if (item.userCouponList.length > 4 && isOnline != 1) {
item.userCouponList = item.userCouponList.slice(0, 4)
}
return item
})
this.setData({
couponsList: list,
haveCouponsList: this.data.haveCouponsList,
flag: true
})
})
},
onLoad(options) {
if (options.pageFrom == 'directional') {
this.setData({
showGiftsModal: true,
giftsList: options.list
})
}
this.setData({
isMerchant: true,
isOnline: options.isOnline
})
//判断只展示当前门店的
// if (isMerchant == 1) {
// this.setData({
// isMerchant: true
// })
// }
this.getCouponList()
},
// ***********定向礼包相关内容***********
clickClose() {
this.setData({
showGiftsModal: false
})
},
// 去使用
toUseGifts(e) {
let {
item
} = e.currentTarget.dataset
let {
discountType,
useChannel,
id
} = item
if (discountType == 2 || discountType == 4) {
wx.p.router.go('/packageMall/pages/coupon/coupon', {
userCouponId: id,
useMemberType: item.useMemberType
})
return
}
/**线上商品代金券 */
if (discountType == 3 && useChannel == 1) {
if (item.useMemberType == 1) {
wx.p.wxApi.showToast('代金券已使用')
return
}
wx.p.router.go('/packageMine/pages/coupon/recommend/recommend', {
couponInfo: item
})
return
}
wx.p.router.go('/packageMine/pages/coupon/detail/detail', {
item
})
}
})
\ No newline at end of file
{
"usingComponents": {
"coupon-item": "../components/CouponsItem/element",
"tab":"/components/Tab/Tab"
},
"navigationBarTitleText": "我的卡券"
}
\ No newline at end of file
/* packageMine/pages/coupon/index/index.wxss */
/**index.wxss**/
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
page {
background: #F9F7F7;
}
.tab_widget {
width: 100%;
height: 92rpx;
background: #FFFFFF;
}
.tab_element {
width: 120rpx;
height: 92rpx;
position: relative;
color: #707071;
font-size: 36rpx;
display: flex;
align-items: center;
justify-content: center;
font-weight: 400;
}
.tab_element_active {
font-size: 40rpx;
color: #2D2D2E;
font-weight: 500;
}
.active_tab_line {
width: 48rpx;
height: 8rpx;
background: var(--btnColor);
border-radius: 2rpx;
position: absolute;
left: 50%;
bottom: 0;
transform: translate(-50%, 0);
}
.content_widget {
box-sizing: border-box;
/* padding: 0 32rpx; */
}
.box_wrapper {
width: 100%;
box-sizing: border-box;
padding: 20rpx;
display: flex;
align-items: center;
position: relative;
margin-top: 24rpx;
}
.left_icon_box {
width: 156rpx;
height: 156rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
}
.left_bg {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 156rpx;
height: 156rpx;
z-index: 1;
}
.left_text_one {
font-size: 36rpx;
font-weight: 600;
color: #FFFFFF;
z-index: 2;
}
.left_text_two {
display: flex;
align-items: flex-end;
}
.left_text_three {
font-size: 20rpx;
margin-top: 6rpx;
}
.price_icon {
font-size: 20rpx;
margin-right: 4rpx;
}
.main_box {
height: 156rpx;
box-sizing: border-box;
padding: 4rpx 0 4rpx 20rpx;
}
.box_btn {
position: absolute;
right: 20rpx;
top: 50%;
transform: translate(0, -50%);
width: 120rpx;
height: 44rpx;
background: #B1B1B3;
border-radius: 22rpx;
color: #FFF;
font-size: 20rpx;
text-align: center;
line-height: 44rpx;
}
.title_text {
color: #282829;
font-weight: 600;
color: #282829;
font-size: 28rpx;
}
.h4_text {
font-weight: 400;
color: #B1B1B3;
font-size: 24rpx;
}
.drive {
margin-top: 38rpx;
}
.involid_btn{
display: flex;
justify-content: center;
margin-top: 36rpx;
}
.view_involid{
height: 48rpx;
line-height: 48rpx;
border: 2rpx solid #999999;
border-radius: 24rpx;
color: #999999;
width: 204rpx;
text-align: center;
}
.no_data {
padding-top: 48rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.nodata_bg {
width: 320rpx;
height: 320rpx;
}
.nodata_text {
color: #B1B1B3;
font-size: 28rpx;
line-height: 44rpx;
margin-top: 8rpx;
}
/* 定向礼包弹框 */
.flex_ccc {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.gifts_modal {
position: fixed;
left: 0;
right: 0;
top: 0;
right: 0;
background: rgba(0, 0, 0, 0.66);
width: 100%;
height: 100%;
z-index: 999999;
}
.gifts_wrap {
width: 100%;
height: 100%;
}
.gifts_wrapper {
width: 100%;
/* height: 337rpx; */
position: relative;
}
/*自定义背景颜色*/
.custom_banner_wrap{
width: 86%;
min-height: 170rpx;
/* background: linear-gradient(-180deg, #FE7534, #FF4815); */
position: absolute;
top:51.3%;
left: 50%;
transform: translateX(-50%);
z-index: -1;
/* border-radius:0 0 32rpx 32rpx; */
}
.custom_box{
height: 170rpx;
}
.gifts_modal_bg {
width: 87.3%;
height: 51.3%;
}
.gifts_modal_btn {
width: 39%;
height: 102rpx;
margin-top: 56rpx;
}
.gifts_content_wrap {
width: calc(87.3% - 52rpx);
height: 64%;
/* background: #FFFFFF; */
position: absolute;
left: 50%;
bottom: 6rpx;
transform: translate(-50%, 0);
overflow-x: hidden;
overflow-y: scroll;
}
.gifts_modal_bottom_bg {
position: absolute;
left: 50%;
bottom: 6rpx;
transform: translate(-50%, 0);
width: 83.2%;
height: 87rpx;
}
.gifts_item_wrap {
width: 100%;
height: 170rpx;
position: relative;
}
.gifts_item_bg {
width: 100%;
height: 170rpx;
}
.gifts_po_wrap {
position: absolute;
left: 0;
top: 0;
height: 170rpx;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.left_widget {
box-sizing: border-box;
padding:0 0 0 40rpx;
width: 70%;
}
.coup_title{
font-size: 30rpx;
font-weight: 400;
color: #1A1919;
width: 70%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.coup_tip {
font-size: 24rpx;
font-weight: 400;
color: #817F7C;
margin-top: 19rpx;
}
.right_widget{
padding-right: 32rpx;
}
.gifts_to_use_bg{
width: 120rpx;
height: 46rpx;
}
/**小于2的样式*/
.mini_widget{
width: 100%;
min-height: 207rpx;
}
.mini_header_bg{
width: 87.3%;
height: 207rpx;
}
.mini_box_wrap{
width: 86.3%;
height: 281rpx;
position: relative;
box-sizing: border-box;
padding: 0 29rpx;
}
.mini_box_bg{
width: 100%;
height: 345rpx;
position: absolute;
top: -54rpx;
left: 0;
right: 0;
z-index: -1;
}
.storeName {
margin-top: 30rpx;
font-size: 32rpx;
font-weight: 500;
color: #282829;
/* display: inline-block; */
}
.storeWidth {
max-width: 477rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.stretch {
font-size: 32rpx;
font-weight: 500;
color: #999;
margin-left: 10rpx;
}
.stretchColor {
color: var(--btnColor);
font-size: 32rpx;
font-weight: 500;
margin-left: 10rpx;
}
/* .listWidth {
max-height: 810rpx;
overflow: hidden;
white-space: nowrap;
} */
.checkList {
justify-content: center;
margin-top: 18rpx;
}
.checkList .check {
font-size: 24rpx;
color: #999;
}
.state {
width: 24rpx;
height: 24rpx;
margin-left: 10rpx;
}
.associatedOrder {
display: flex;
font-size: 24rpx;
padding-top: 8rpx;
}
.associatedOrder .order {
color: #666;
}
.associatedOrder .order-X {
color: #333;
max-width: 337rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.associatedOrder .checkOrder {
color: var(--btnColor);
position: absolute;
right: 0;
}
.online_conpon_ctnr{
margin-top: 32rpx;
}
.online_conpon{
height: 156rpx;
background: #F1F1F1;
border-radius: 8rpx;
padding: 8rpx;
display: flex;
}
.online_conpon .price_wrap{
padding-left: 16rpx;
display: flex;
flex-direction: column;
justify-content: center;
width: 154rpx;
flex-shrink: 0;
color: var(--btnColor);
}
.price_wrap .num{
height: 84rpx;
font-weight: 600;
font-size: 42rpx;
color: #6D6D6D;
}
.price_wrap .unit{
height: 28rpx;
font-weight: 500;
font-size: 20rpx;
color: #6D6D6D;
vertical-align: text-top;
margin-left: 4rpx;
}
.price_wrap .tip{
height: 34rpx;
font-weight: 400;
font-size: 24rpx;
color: #6D6D6D;
}
.online_conpon .info_wrap{
flex: 1;
background-color: #fff;
padding: 16rpx 12rpx 16rpx 24rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
}
.info_wrap .name{
height: 80rpx;
font-weight: 600;
font-size: 28rpx;
color: #333333;
line-height: 40rpx;
}
.info_wrap .remark,.info_wrap .date{
height: 28rpx;
line-height: 20rpx;
font-weight: 400;
font-size: 20rpx;
color: #6D6D6D;
}
.info_wrap .use_btn{
position: absolute;
width: 136rpx;
height: 48rpx;
line-height: 48rpx;
background-color: #B0B0B0;
border-radius: 23rpx;
color: #fff;
text-align: center;
right: 12rpx;
bottom: 16rpx;
}
\ No newline at end of file
<view class="coupons_container">
<view class="tab_widget">
<tab tab="{{tabs}}" bindclick="changeTab"></tab>
</view>
<block wx:if="{{flag}}">
<view wx:if="{{couponsList.length}}" style="height:-116rpx;padding-bottom: 35rpx;" class="content_widget">
<scroll-view scroll-y="{{true}}" style="height:100%;padding: 0 32rpx;box-sizing: border-box;" class="scroll_wrap" bindscrolltolower="bottomToRefresh">
<!-- listWidth -->
<view wx:for="{{couponsList}}" wx:key="index">
<block wx:if="{{isOnline!=1}}">
<view class="flex storeName">
<text class="storeWidth">{{item.merchantName}}</text>
<text class="'stretch'">({{item.couponAmount}}张)</text>
</view>
<block wx:for="{{item.userCouponList}}" wx:for-item="i" wx:key="id">
<coupon-item btnStatus="{{curTabIndex+1}}" coupons="{{i}}" useMemberType="{{curTabIndex+1}}"></coupon-item>
<view class="associatedOrder" wx:if="{{i.goodsOrderCode && curTabIndex == 0}}">
<view class="order">该券已用在订单:</view>
<view class="order-X" catchtap="jump" data-item="{{i.goodsOrderCode}}">{{i.goodsName}}</view>
<view class="checkOrder" catchtap="jump" data-item="{{i.goodsOrderCode}}">查看订单></view>
</view>
</block>
<block wx:if="{{haveCouponsList[index].length > 4}}">
<view class="flex checkList" wx:if="{{!item.checkCoupon}}" catchtap="state" data-key="{{index}}">
<view class="check">查看剩余所有券</view>
<glsx-image webp class="state" src="mine/coupon/down.png" />
</view>
<view class="flex checkList" wx:else catchtap="state" data-key="{{index}}">
<view class="check">收起</view>
<glsx-image webp class="state" src="mine/coupon/up.png" />
</view>
</block>
</block>
<block wx:else>
<view class="online_conpon_ctnr" wx:for="{{item.userCouponList}}" wx:for-item="i" wx:key="id">
<view class="online_conpon">
<view class="price_wrap">
<view>
<text class="num">{{i.denomination || 0}}</text>
<text class="unit">元</text>
</view>
<view class="tip">无门槛</view>
</view>
<view class="info_wrap">
<view class="name">{{i.brandName ? i.brandName + '·' : ''}}{{i.appearance == 2 ? i.goodsName + i.rechargeDenomination : i.goodsName}}</view>
<view class="date" wx:if="{{i.discountType == 8}}">数量:{{i.amount}}</view>
<view class="date">有效期{{i.effectiveDays || 0}}天</view>
<view class="use_btn">去使用</view>
</view>
</view>
</view>
</block>
</view>
</scroll-view>
</view>
<view wx:else class="no_data">
<glsx-image webp class="nodata_bg" src="coupons/no_card_bg.png" />
<view class="nodata_text">暂无优惠券</view>
</view>
</block>
<!-- 定向礼包弹框 -->
<view wx:if="{{showGiftsModal}}" class="gifts_modal flex_ccc">
<view class="gifts_wrap flex_ccc">
<view wx:if="{{giftsList.length>2}}" class="gifts_wrapper flex_ccc">
<image webp mode="widthFix" class="gifts_modal_bg" src="{{imgBaseURL}}gifts_list_bg.png" />
<view class="gifts_content_wrap">
<view wx:for="{{giftsList}}" class="gifts_item_wrap">
<image webp mode="widthFix" class="gifts_item_bg" src="{{imgBaseURL}}gifts_coupons_bg.png" />
<view class="gifts_po_wrap">
<view class="left_widget">
<view class="coup_title">{{item.couponName}}</view>
<view wx:if="{{item.effectiveType==3}}" class="coup_tip">无限期</view>
<view wx:if="{{item.effectiveType==2}}" class="coup_tip">有效期:{{item.receiveStartTime}}-{{item.receiveEndTime}}</view>
<view wx:if="{{item.effectiveType==1}}" class="coup_tip">有效至{{item.receiveEndTime}}</view>
</view>
<view class="right_widget">
<image webp mode="widthFix" bind:tap="toUseGifts" data-item="{{item}}" class="gifts_to_use_bg" src="{{imgBaseURL}}gifts_touse.png" />
</view>
</view>
</view>
<view style="height:88rpx"></view>
</view>
<image webp mode="widthFix" class="gifts_modal_bottom_bg" src="{{imgBaseURL}}gifts_fixed_bottom.png" />
</view>
<view wx:if="{{giftsList.length<3}}" class="mini_widget flex_ccc">
<image webp mode="widthFix" class="mini_header_bg" src="{{imgBaseURL}}gifts_header_bg.png" />
<view class="mini_box_wrap" style="height:{{giftsList.length==2?408:298}}rpx">
<image webp class="mini_box_bg" style="height:{{giftsList.length==2?450:340}}rpx" src="{{imgBaseURL}}gifts_box_bg.png" />
<view style="height:50rpx"></view>
<view wx:for="{{giftsList}}" class="gifts_item_wrap">
<image webp mode="widthFix" class="gifts_item_bg" src="{{imgBaseURL}}gifts_coupons_bg.png" />
<view class="gifts_po_wrap">
<view class="left_widget">
<view class="coup_title">{{item.couponName}}</view>
<view wx:if="{{item.effectiveType==3}}" class="coup_tip">无限期</view>
<view wx:if="{{item.effectiveType==2}}" class="coup_tip">有效期:{{item.receiveStartTime}}-{{item.receiveEndTime}}</view>
<view wx:if="{{item.effectiveType==1}}" class="coup_tip">有效至{{item.receiveEndTime}}</view>
</view>
<view class="right_widget">
<image webp mode="widthFix" bind:tap="toUseGifts" data-item="{{item}}" class="gifts_to_use_bg" src="{{imgBaseURL}}gifts_touse.png" />
</view>
</view>
</view>
</view>
</view>
<image webp mode="widthFix" bind:tap="clickClose" class="gifts_modal_btn" src="{{imgBaseURL}}gifts_comfirm_btn.png" />
</view>
</view>
</view>
\ No newline at end of file
import {
getAfterSaleDetail,
calcOrderProp,
getOrder,
API_Methods,
APIS,
} from "~/packageMine/pages/order/utils";
import { ORDER_STATUS, OrderStatusEnum } from "~/constants/mine.js";
Page({
/**
* 页面的初始数据
*/
data: {
order: {
express_no: "",
},
orderInfo: {},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.p.router.getRouterParams(options).then((params) => {
if (params) {
this.setData({
...params,
});
this.getOrderAfterSaleDetail(params.subOrderCode);
}
});
},
submitlogistics() {
this.getOrderAfterSaleDetail();
},
getOrderAfterSaleDetail() {
wx.p.wxApi.showLoading("加载中...");
let { goodsSource, tparReturnOrderCode, subOrderCode, goodsSkuCode } =
this.data;
// Methods = goodsSource == 2 ? "afterSaleDetail" : "platformSaleDetail";
API_Methods[goodsSource][APIS.AFTER_SALE_DETAIL]({
subOrderCode,
tparReturnOrderCode,
goodsSkuCode,
})
.then((res) => {
// let status = 0
// if (res.returnOrderStatus == 1000 || res.returnOrderStatus == 1002 || res.returnOrderStatus == 1001 || res.returnOrderStatus == 1004 || (res.returnOrderStatus == 1003 && res.outRefundType == 2)) {
// status = 0
// } else if (res.returnOrderStatus == 1003 && res.outRefundType == 0) {
// status = 1
// } else if (res.returnOrderStatus == 1005 || (res.returnOrderStatus == 1003 && res.outRefundType == 3) || (res.returnOrderStatus == 1003 && res.outRefundType == 1)) {
// status = 2
// }
// const { returnOrderStatus } = res;
const status = getOrder(res); //getAfterSaleDetail({ returnOrderStatus });
const button = status.detail.buttons?.[goodsSource][0] || {}; //status.buttons?.[goodsSource][0];
// button.action = this[button.handler]
let str = "";
if (res.sendbackAddressModel) {
const { sendbackAddressModel } = res;
str = `${sendbackAddressModel.provinceName}${sendbackAddressModel.cityName}${sendbackAddressModel.countyName}${sendbackAddressModel.address}`;
}
res.addressInfo = str;
const { ___qty, ___price, ___totalPrice } = calcOrderProp(
res.orderGoods
);
Object.assign(res.orderGoods, { ___qty, ___price, ___totalPrice });
this.setData({
orderInfo: res,
status,
button,
});
}).catch((err) => {
wx.p.sentry.reportError(`售后详情异常:${err.message}`, {...this.data,err});
})
.finally(() => {
wx.hideLoading();
});
},
confirm() {
// const { status, orderInfo } = this.data;
// if (status == 0) {
// this.cancelSaleApply();
// } else if (status == 2) {
// wx.p.router.go(
// "/packageMine/pages/order/afterSale_step_two/afterSale_step_two",
// orderInfo
// );
// }
// this.cancelSaleApply()
// console.log('this.button', this.data.button)
this[this.data.button.handler]();
// this.toAfterSale();
},
toAfterSale() {
const { orderInfo } = this.data;
// const { orderGoods, imgUrlList, ...rest } = orderInfo;
// const order = Object.assign({ imgList: imgUrlList }, orderGoods, rest);
wx.p.router.go(
"/packageMine/pages/order/afterSale_step_two/afterSale_step_two",
orderInfo
);
},
/**撤销申请 */
cancelSaleApply() {
const { orderInfo } = this.data;
let para = {
tparReturnOrderCode: orderInfo.tparReturnOrderCode,
};
wx.showModal({
title: "提示",
content: `请确认是否撤销申请`,
confirmColor: "#F13C3D",
})
.then((res) => {
if (res.confirm) {
wx.p.wxApi.showLoading("提交中");
const URLNAME = "platformEditSale";
wx.p.api.shopmallApi[URLNAME](para).then((res) => {
if (res) {
wx.p.wxApi.showToast("撤销成功");
wx.p.router.go("/packageMine/pages/order/index/index", {
tab: ORDER_STATUS[OrderStatusEnum.COMPLETED],
});
}
}).catch((err) => {
wx.p.sentry.reportError(`撤销售后:${err.message}`, {...this.data.orderInfo,err});
});
}
})
.catch((err) => {
wx.p.sentry.reportError(`撤销售后Modal:${err.message}`, {...this.data.orderInfo,err});
wx.p.wxApi.showToast("已取消");
})
.finally(() => {
setTimeout(() => {
wx.hideLoading();
}, 500);
});
},
previewImage(e) {
let params = e.detail; // 从组件传递的数据
wx.p.wxApi.previewImage(params);
},
onExpressNoInput(e) {
const { value } = e.detail;
this.setData({
"order.express_no": value,
});
},
onSubmitLogistics() {
// 提交物流信息的处理逻辑
console.log("提交物流信息");
},
});
{
"navigationBarTitleText": "售后详情",
"usingComponents": {
"refund-status": "./components/RefundStatus/RefundStatus",
"return-address-box": "./components/ReturnAddressBox/ReturnAddressBox",
"after-sale-info-box": "./components/AfterSaleInfoBox/AfterSaleInfoBox",
"re-submit-button": "./components/ReSubmitButton/ReSubmitButton"
}
}
\ No newline at end of file
<block wx:if="{{orderInfo}}">
<view class="layout">
<!-- 退款状态组件 -->
<refund-status wx:if="{{status.detail}}" status="{{status.detail}}"></refund-status>
<!-- 退货地址和物流信息组件 -->
<block wx:if="{{orderInfo.returnOrderStatus==1001}}">
<return-address-box order-info="{{orderInfo}}"/>
</block>
<!-- 售后信息组件 -->
<after-sale-info-box order-info="{{orderInfo}}"></after-sale-info-box>
<!-- 重新提交按钮组件 -->
<re-submit-button wx:if="{{button}}" bindresubmit="confirm" button="{{button}}"></re-submit-button>
</view>
</block>
<glsx-privacy appletName="优加发拍"></glsx-privacy>
\ No newline at end of file
import {
AfterSaleObj,
} from "~/constants/mine.js";
Component({
properties: {
orderInfo: {
type: Object,
value: {}
},
},
data:{
// 退款状态1:待处理,2待发货,3待确认收到退货,4:退款中,5:已退款,6:退款失败,7:审核不通过
afterSaleObj: Object.freeze(AfterSaleObj),
},
methods: {
onPreviewImage(e) {
let params = e.currentTarget.dataset;
wx.p.wxApi.previewImage(params);
}
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {
"content": "/packageMine/pages/order/index/components/Content/Content"
}
}
\ No newline at end of file
.box {
border-radius: 16rpx;
background-color: #fff;
}
.text-box {
padding: 32rpx 24rpx;
}
.text-box .title {
font-weight: 600;
font-size: 32rpx;
color: #282829;
margin-bottom: 24rpx;
}
.text-box .item {
margin-bottom: 12rpx;
display: flex;
align-items: flex-start;
}
.text-box .item .label {
width: auto;
min-width: fit-content;
margin-right: 10rpx;
flex-shrink: 0;
}
.text-box .item .value {
color: #656566;
flex: 1;
word-wrap: break-word;
word-break: break-word;
white-space: normal;
}
.photo-box {
position: relative;
padding: 32rpx 24rpx;
display: grid;
/* 自动根据容器宽度决定列数,每列最小 200rpx,最大 1fr */
grid-template-columns: repeat(auto-fill, minmax(200rpx, 1fr));
gap: 20rpx;
/* 保证最后一行左对齐 */
justify-items: start;
&::before {
content: '';
position: absolute;
top: 0;
left: 24rpx;
right: 24rpx;
height: 1px;
background-color: #FFEFF0F2;
}
.item {
box-sizing: border-box;
width: 200rpx;
height: 200rpx;
// background: #d8d8d8;
// margin: 0 20rpx 20rpx 0;
border-radius: 8rpx;
overflow: hidden;
}
}
\ No newline at end of file
<view class="box">
<view class="text-box">
<view class="title">售后信息</view>
<content wx:if="{{orderInfo.orderGoods}}" item="{{orderInfo.orderGoods}}" />
<view style="margin-top: 32rpx;">
<block wx:for="{{afterSaleObj}}" wx:key="index">
<view class="item">
<view class="label">{{item.title}}:</view>
<view class="value">
<block wx:if="{{item.enum}}">{{item.enum[orderInfo[item.key]]}}</block>
<block wx:elif="{{item.isArray}}">
<block wx:for="{{orderInfo[item.key]}}" wx:key="index" wx:for-item="i">
<text>{{i}};</text>
</block>
</block>
<block wx:else>{{orderInfo[item.key] || ''}}<text>{{item.unit}}</text></block>
</view>
</view>
</block>
</view>
</view>
<block wx:if="{{orderInfo.imgUrlList && orderInfo.imgUrlList.length}}">
<view class="photo-box">
<block wx:for="{{orderInfo.imgUrlList}}" wx:key="index">
<view class="item" bindtap="onPreviewImage" data-current="{{item}}" data-urls="{{orderInfo.imgUrlList}}">
<image webp mode="aspectFill" class="image" src="{{item}}"></image>
</view>
</block>
</view>
</block>
</view>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!