Commit 52f32d8a by wangzhihui

Merge branch 'SAAS+V4.56.0-0908' of http://192.168.3.233:8090/saas/mini-program/…

…points-mall into SAAS+V4.56.0-0908
2 parents d5c32925 e95bf192
Showing 111 changed files with 1602 additions and 6490 deletions
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
"pages": [ "pages": [
"pages/loading/loading", "pages/loading/loading",
"pages/tab/index/index", "pages/tab/index/index",
"pages/tab/equity/index", "pages/tab/cart/index",
"pages/tab/mall/index",
"pages/tab/mine/index", "pages/tab/mine/index",
"pages/webView/webView", "pages/webView/webView",
"pages/Login/Login" "pages/Login/Login"
...@@ -18,22 +17,22 @@ ...@@ -18,22 +17,22 @@
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
}, },
"tabBar": { "tabBar": {
"color": "#937F82", "color": "#9DA4B3",
"selectedColor": "#8A303A", "selectedColor": "#4B5466",
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"borderStyle": "white", "borderStyle": "white",
"list": [ "list": [
{ {
"pagePath": "pages/tab/index/index", "pagePath": "pages/tab/index/index",
"text": "首页", "text": "商城",
"iconPath": "assets/images/home.png", "iconPath": "assets/images/index.png",
"selectedIconPath": "assets/images/home_active.png" "selectedIconPath": "assets/images/index_active.png"
}, },
{ {
"pagePath": "pages/tab/mall/index", "pagePath": "pages/tab/cart/index",
"text": "商城", "text": "购物车",
"iconPath": "assets/images/mall.png", "iconPath": "assets/images/cart.png",
"selectedIconPath": "assets/images/mall_active.png" "selectedIconPath": "assets/images/cart_active.png"
}, },
{ {
"pagePath": "pages/tab/mine/index", "pagePath": "pages/tab/mine/index",
...@@ -58,7 +57,7 @@ ...@@ -58,7 +57,7 @@
] ]
}, },
{ {
"root": "packageMall", "root": "packageCart",
"pages": [ "pages": [
"pages/shoppingCart/shoppingCart", "pages/shoppingCart/shoppingCart",
"pages/pay/pay", "pages/pay/pay",
......

5.36 KB | W: | H:

2.11 KB | W: | H:

assets/images/mine.png
assets/images/mine.png
assets/images/mine.png
assets/images/mine.png
  • 2-up
  • Swipe
  • Onion skin

6.3 KB | W: | H:

3.32 KB | W: | H:

assets/images/mine_active.png
assets/images/mine_active.png
assets/images/mine_active.png
assets/images/mine_active.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -87,3 +87,125 @@ export const RefundReason = [ ...@@ -87,3 +87,125 @@ export const RefundReason = [
value: 12, value: 12,
}, },
]; ];
export const RefundStatus = [
{
status: 1,
title: "待处理",
tips: "等待平台处理",
image: "mine/order/wait.png",
},
{
status: 2,
title: "待发货",
tips: "等待平台处理",
image: "mine/order/wait.png",
},
{
status: 3,
title: "待确认收到退货",
tips: "等待平台处理",
image: "mine/order/wait.png",
},
{
status: 4,
title: "退款中",
tips: "等待平台处理",
image: "mine/order/wait.png",
},
{
status: 5,
title: "已退款",
tips: "钱款已退回至原账户",
image: "mine/order/success.png",
},
{
status: 6,
title: "退款失败",
tips: "您可以尝试再次提交退款申请",
image: "mine/order/error.png",
},
{
status: 7,
title: "审核不通过",
tips: "您可以尝试再次提交退款申请",
image: "mine/order/error.png",
},
];
export const ExpressList = [
{
value: 0,
text: "圆通快递",
},
{
value: 1,
text: "顺丰快递",
},
{
value: 2,
text: "中通快递",
},
{
value: 3,
text: "韵达快递",
},
{
value: 4,
text: "京东快递",
},
{
value: 5,
text: "百世快递",
},
{
value: 6,
text: "德邦快递",
},
{
value: 7,
text: "其他",
},
];
export const AfterSaleObj = [
{
title: "退款原因",
key: "refundPrice",
},
{
title: "退款金额",
key: "refundPrice",
},
{
title: "退款数量",
key: "goodsNumber",
},
{
title: "售后编号",
key: "orderCode",
},
{
title: "申请时间",
key: "time",
},
{
title: "申请描述",
key: "remark",
},
];
export const AddressInfo = [
{
title: "地址",
key: "address",
},
{
title: "收货人",
key: "name",
},
{
title: "联系电话",
key: "phone",
},
];
<!-- flex子元素自适应宽度示例 -->
<view class="container">
<view class="section">
<view class="title">使用 flex: 1 平均分配宽度</view>
<view class="flex-container">
<view class="flex-item item1">项目1</view>
<view class="flex-item item2">项目2</view>
<view class="flex-item item3">项目3</view>
</view>
</view>
<view class="section">
<view class="title">使用不同 flex 值分配宽度</view>
<view class="flex-container">
<view class="flex-item item1" style="flex: 2">项目1 (flex: 2)</view>
<view class="flex-item item2" style="flex: 1">项目2 (flex: 1)</view>
<view class="flex-item item3" style="flex: 1">项目3 (flex: 1)</view>
</view>
</view>
<view class="section">
<view class="title">根据内容自适应宽度</view>
<view class="flex-container">
<view class="flex-item item1 auto-width">短</view>
<view class="flex-item item2 auto-width">中等长度内容</view>
<view class="flex-item item3 auto-width">这是一个很长的内容</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* flex子元素自适应宽度示例样式 */
.container {
padding: 20rpx;
}
.section {
margin-bottom: 40rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 20rpx;
color: #333;
}
.flex-container {
display: flex;
width: 100%;
gap: 20rpx;
margin-bottom: 20rpx;
}
.flex-item {
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10rpx;
color: white;
font-size: 28rpx;
}
.item1 {
background-color: #ff6b6b;
}
.item2 {
background-color: #4ecdc4;
}
.item3 {
background-color: #45b7d1;
}
/* 平均分配宽度 */
.flex-item {
flex: 1;
}
/* 根据内容自适应宽度 */
.auto-width {
flex: 0 1 auto;
/* flex-grow: 0 (不扩展)
flex-shrink: 1 (可以收缩)
flex-basis: auto (根据内容确定基础宽度) */
}
\ No newline at end of file \ No newline at end of file
// packageMall/pages/search/search.js // packageCart/pages/coupon/coupon.js
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
searchList: []
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad(options) {
this.setData(options)
this.getSearchList(options.value)
},
getSearchList(value) {
wx.p.wxApi.showLoading()
let {
goodsList
} = this.data
const searchList = []
goodsList.map(e => {
if (e.goodsName.indexOf(value) != -1) searchList.push(e)
})
this.setData({
searchList,
flag: true
})
wx.hideLoading()
},
search(e) {
this.getSearchList(e.detail)
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady() {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow() {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide() {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload() {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh() {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
} }
}) })
\ No newline at end of file \ No newline at end of file
{ {
"navigationBarTitleText": "Flex自适应宽度示例" "usingComponents": {}
} }
\ No newline at end of file \ No newline at end of file
/* packageCart/pages/coupon/coupon.wxss */
\ No newline at end of file \ No newline at end of file
<!--packageCart/pages/coupon/coupon.wxml-->
<text>packageCart/pages/coupon/coupon.wxml</text>
\ No newline at end of file \ No newline at end of file
// packageCart/pages/detail/detail.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{ {
"navigationStyle": "custom" "usingComponents": {}
} }
\ No newline at end of file \ No newline at end of file
/* packageCart/pages/detail/detail.wxss */
\ No newline at end of file \ No newline at end of file
<!--packageCart/pages/detail/detail.wxml-->
<text>packageCart/pages/detail/detail.wxml</text>
\ No newline at end of file \ No newline at end of file
// packageCart/pages/pay/pay.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageCart/pages/pay/pay.wxss */
\ No newline at end of file \ No newline at end of file
<!--packageCart/pages/pay/pay.wxml-->
<text>packageCart/pages/pay/pay.wxml</text>
\ No newline at end of file \ No newline at end of file
// packageCart/pages/search/search.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageCart/pages/search/search.wxss */
\ No newline at end of file \ No newline at end of file
<!--packageCart/pages/search/search.wxml-->
<text>packageCart/pages/search/search.wxml</text>
\ No newline at end of file \ No newline at end of file
// packageCart/pages/shoppingCart/shoppingCart.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
/* packageCart/pages/shoppingCart/shoppingCart.wxss */
\ No newline at end of file \ No newline at end of file
<!--packageCart/pages/shoppingCart/shoppingCart.wxml-->
<text>packageCart/pages/shoppingCart/shoppingCart.wxml</text>
\ No newline at end of file \ No newline at end of file
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
observer: function (n) {
if (n) setTimeout(() => {}, 0.5 * 1000)
}
},
only: {
type: Boolean,
value: true
},
couponData: {
type: Object,
observer(n) {
if (n.length)
this.setData({
noData: true
})
return n
}
},
order: {
type: Number
},
defaultData: String
},
observers: {
couponData: function (newVal) {
return newVal
}
},
/**
* 组件的初始数据
*/
data: {
noData: false,
IMGURL: wx.$imgUrl
},
/**
* 组件的方法列表
*/
methods: {
getCoupon(e) {
return
let {merchantId} = wx.p.storage.get('merchant_info')
let { item } = e.currentTarget.dataset
wx.p.wxApi.showLoading('领取中...')
wx.p.api.shopmallApi
.getCoupon({
couponIdList: [item.couponId],
receiveWay: 1,
receiveSource: 3,
merchantId: Number(merchantId)
})
.then(({ code, data, message }) => {
console.log(data)
wx.hideLoading()
if (code == '0') {
wx.showToast({
title: '领取成功',
icon: 'none'
})
let thisPage = wx.p.router.getPageInstance()
if (thisPage.getGoodscouponList) thisPage.getGoodscouponList()
}
})
},
// 更换优惠券
selectCoupon(e) {
let { index } = e.currentTarget.dataset
for (let i = 0; i < this.data.couponData.length; i++) {
if (index == i) {
this.data.couponData[i].isChecked = !this.data.couponData[i].isChecked
} else {
this.data.couponData[i].isChecked = false
}
this.setData({
couponData: this.data.couponData
})
}
},
//确认
confirm() {
this.triggerEvent('click', this.data.couponData)
this.setData({
couponData: this.data.couponData
})
}
},
lifetimes: {
attached() {}
}
})
<popup title="优惠详情" show="{{show}}" only="{{only}}" bindconfirm="confirm" height="75%">
<view class="coupon-box">
<view class="box">
<scroll-view style="height:100%;" scroll-y>
<block wx:if="{{noData}}">
<view class="coupon-wrap" wx:for="{{couponData}}" wx:key="index">
<view class="left_icon_box">
<glsx-image webp wx:if="{{true}}" class="left_bg" src="coupons/coupons_active.png" />
<glsx-image webp wx:else class="left_bg" src="coupons/coupons.png" />
<view class="left_text_one left_text_two">
<text class="price_icon">¥</text>
<text>{{(item.denomination)/100}}</text>
</view>
<view class="left_text_five left_text_three" wx:if="{{item.full}}">满{{(item.full)/100}}可用</view>
</view>
<view class="main_box">
<view class="title_text">{{item.couponName}}</view>
<view class="h4_text" wx:if="{{item.useBarriers == 1}}">无限制</view>
<view class="h4_text" wx:if="{{item.useBarriers == 2}}">满减</view>
<!-- 已领取,effectiveType == 1 或者2,都显示时间段,effectiveType == 3 无限制 -->
<view class="h4_text drive" wx:if="{{item.effectiveType == 1||item.effectiveType == 2 }}">{{item.receiveStartTime}}-{{item.receiveEndTime}}</view>
<view class="h4_text drive" wx:if="{{item.effectiveType == 3}}">无期限</view>
</view>
<block wx:if="{{order == 0}}">
<!-- <view class="box_btn box_btn_color box_btn_color_grey" bindtap="toDetail" wx:if="{{item.couponStatus == 0&&item.residueAmount >0}}" data-item="{{item}}" bindtap="getCoupon">领取</view>
<view class="box_btn_color_been_gray " bind:tap="toDetail" wx:elif="{{item.couponStatus != 1&&item.residueAmount ==0}}">已抢光</view>
<view class="box_btn_color_been" bind:tap="toDetail" wx:elif="{{item.couponStatus == 1}}">已领取</view> -->
<block wx:if="{{item.couponStatus == 1}}">
<view class="already">
<glsx-image webp src="coupons/been.png" />
</view>
</block>
</block>
<block wx:else>
<view class="circle-selected" data-item="{{item}}" data-index="{{index}}" wx:if="{{item.isChecked}}" bindtap="selectCoupon">
<glsx-image webp src="coupons/select.png" />
</view>
<view class="noSelect" data-item="{{item}}" data-index="{{index}}" wx:if="{{!item.isChecked}}" bindtap="selectCoupon"></view>
</block>
</view>
</block>
<!-- <block>
<view class="dissatisfy">以下不满足使用条件</view>
<view class="coupon-wrap gray" >
<view class="left_icon_box">
<image webp class="left_bg" src="../../packageMall/images/coupons.png" />
<view class="left_text_one left_text_two">
<text class="price_icon">¥</text>
<text>50</text>
</view>
<view class="left_text_five left_text_three">满99可用</view>
</view>
<view class="main_box">
<view class="title_text">优惠券名称</view>
<view class="h4_text">满300减50,仅限会场商品</view>
<view class="h4_text drive">无限期</view>
</view>
<view class="circle-gray"></view>
<view class="reason">不可用原因:仅可购买XXX商品A</view>
</view>
</block> -->
</scroll-view>
</view>
</view>
<view wx:if="{{!noData}}" class="no_data">
<glsx-image webp class="nodata_bg" src="coupons/no_card_bg.png" />
<view class="nodata_text">暂无优惠券</view>
</view>
</popup>
\ No newline at end of file \ No newline at end of file
/* components/CarBrands/CarBrands.wxss */
.coupon-wrap {
width: 686rpx;
height: 196rpx;
background: rgba(252, 91, 50, 0.05);
border-radius: 8rpx;
box-sizing: border-box;
padding: 20rpx;
display: flex;
align-items: center;
position: relative;
margin: 24rpx auto;
}
.gray {
width: 686rpx;
height: 196rpx;
background: rgba(201, 202, 204, 0.1) !important;
border-radius: 8rpx;
box-sizing: border-box;
padding: 20rpx;
display: flex;
align-items: center;
position: relative;
margin-top: 24rpx auto 0;
}
.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_four {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.left_text_three {
font-size: 28rpx;
margin-top: 6rpx;
width:156rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
text-align: center;
}
.left_text_five {
font-size: 28rpx;
color: #FFFFFF;
z-index: 2;
}
.anText {
font-size: 70rpx;
/* color: rgba(white, white, white, 0.45); */
font-weight: 600;
color: #FFF;
opacity: 0.45;
}
.price_icon {
font-size: 20rpx;
margin-right: 4rpx;
margin-bottom: 7rpx;
}
.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: 132rpx;
height: 50rpx;
background: #B1B1B3;
border-radius: 22rpx;
color: #FFF;
font-size: 20rpx;
text-align: center;
line-height: 50rpx;
}
.box_btn_color {
background: var(--btnColor);
color: #FFFFFF;
}
.box_btn_color_grey {
background: #B1B1B3;
}
.title_text {
color: #282829;
font-weight: 600;
color: #282829;
font-size: 28rpx;
width: 420rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.box_btn_color_been {
font-size: 28rpx;
font-weight: 400;
color: var(--btnColor);
line-height: 40rpx;
white-space: nowrap;
position: absolute;
right: 20rpx;
top: 50%;
transform: translate(0, -50%);
}
.h4_text {
font-weight: 400;
color: #B1B1B3;
font-size: 24rpx;
}
.drive {
margin-top: 38rpx;
}
.y-center {
display: flex;
align-items: 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;
}
.already {
width: 75rpx;
height: 74rpx;
position: absolute;
bottom: 0;
right: 0;
z-index: 99;
}
.dissatisfy {
font-size: 28rpx;
font-weight: 500;
color: #282829;
line-height: 44rpx;
margin-top: 32rpx;
}
.circle-gray {
width: 40rpx;
height: 40rpx;
background: #E3E3E6;
border: 2rpx solid rgba(177, 177, 179, 1);
border-radius: 50%;
}
.reason {
width: 686rpx;
height: 60rpx;
background: rgba(253, 194, 62, 0.06);
font-size: 24rpx;
font-weight: 400;
color: #F13C3D;
line-height: 60rpx;
padding: 0 20rpx;
box-sizing: border-box;
position: absolute;
bottom: -60rpx;
left: 0;
}
.reason::before {
content: '!';
width: 28rpx;
height: 28rpx;
border: 1rpx solid #F13C3D;
color: #F13C3D;
box-sizing: border-box;
border-radius: 50%;
display: inline-block;
text-align: center;
line-height: 24rpx;
margin-right: 12rpx;
}
.circle-selected {
width: 40rpx;
height: 40rpx;
}
.noSelect {
width: 40rpx;
height: 40rpx;
background: #ffffff;
border: 2rpx solid rgba(177, 177, 179, 1);
border-radius: 50%;
}
.box{
height:55vh;
overflow-y: scroll;
padding-bottom: 50rpx;
}
.box_btn_color_been_gray{
font-size: 28rpx;
font-weight: 400;
color: #B1B1B3;
line-height: 40rpx;
white-space: nowrap;
position: absolute;
right: 20rpx;
top: 50%;
transform: translate(0, -50%);
}
\ No newline at end of file \ No newline at end of file
// components/Sku/Sku.js
import { centsToyuan } from '~/utils/format'
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
observer(n) {
if (n)
this.setData({
close: false
})
}
},
showName: String,
skuData: {
type: Object,
observer(n) {
this.setDefaultSku(n)
}
},
isActivity: Boolean
},
/**
* 组件的初始数据
*/
data: {
goodsNumber: 1
},
/**
* 组件的方法列表
*/
methods: {
noScroll() {},
setDefaultSku(skuData) {
let { isActivity } = this.data
let { specificationList } = skuData
let [specificationDetailList] = isActivity ? skuData.specificationExtraList : skuData.specificationDetailList
let defaultGoods = specificationDetailList.specificationData.split('&')
specificationList.map(e => {
defaultGoods.map(i => {
let [key, value] = i.split('-')
if (key == e.specificationName) {
e.specificationValueList.map(c => {
if (c.specificationValue == value) c.active = true
})
}
})
})
specificationDetailList.retailPrice = centsToyuan(specificationDetailList.retailPrice)
this.setData({
skuObj: skuData,
goodsInfo: specificationDetailList
})
},
choose(e) {
let { ind, index } = e.currentTarget.dataset
let {
skuObj: { specificationList, id, specificationExtraList },
isActivity
} = this.data
let activeList = []
if (specificationList[index].specificationValueList[ind].active) return
specificationList[index].specificationValueList.map(i => (i.active = false))
specificationList[index].specificationValueList[ind].active = true
specificationList.map(i => {
i.specificationValueList.map(c => {
if (c.active) activeList.push(`${i.specificationName}-${c.specificationValue}`)
})
})
let specificationData = activeList.join('&')
this.setData({
[`skuObj.specificationList[${index}]`]: specificationList[index]
})
if (isActivity) {
specificationExtraList.map((i, i_index) => {
if (i.specificationData == specificationData) {
let retailPrice = i.retailPrice
if (i_index != 0) retailPrice = centsToyuan(i.retailPrice)
this.setData({
goodsInfo: {
retailPrice,
stock: i.stock,
specificationData,
specificationKey: i.specificationKey
}
})
}
})
} else {
wx.p.api.shopmallApi
.getGoodsSpecificationExtra({
goodsId: id,
specificationData
})
.then(data => {
data.retailPrice = centsToyuan(data.retailPrice)
this.setData({
goodsInfo: data
})
console.log(this.data.goodsInfo)
})
}
this.setData({
goodsNumber: 1
})
const thisPage = wx.p.router.getPageInstance()
thisPage.setData({
activeSku: specificationData
})
},
changeCount(e) {
let goodsNumber = e.detail
this.setData({
goodsNumber
})
},
closeSku() {
let thisPage = wx.p.router.getPageInstance()
let { showName } = this.data
this.setData({
close: true
})
setTimeout(() => {
thisPage.setData({
[showName]: false
})
}, 0.5 * 1000)
},
click(e) {
let { type } = e.currentTarget.dataset
let {
goodsInfo: { goodsId, specificationKey, stock },
goodsNumber
} = this.data
if (stock === 0) return
this.triggerEvent(type, {
goodsId,
specificationKey,
goodsNumber,
stock
})
this.closeSku()
}
}
})
<view class="sku" catchtouchmove="noScroll" hidden="{{!show}}">
<view class="sku-bg" bindtap="closeSku"></view>
<view class="sku-box isFullSucreen {{close?'close':''}}">
<scroll-view class="sku-content" scroll-y>
<view class="view">
<view class="goods-box">
<view class="preview">
<image webp src="{{skuObj.goodsImage || skuObj.activityImg}}"></image>
</view>
<view class="goods-info">
<view class="price">
<text class="unit">¥</text>{{goodsInfo.retailPrice}}
</view>
<view class="count">
<block wx:if="{{goodsInfo.stock}}">
有货(库存{{goodsInfo.stock}})
</block>
<block wx:else>无货</block>
</view>
<view class="active text-hide">已选:{{goodsInfo.specificationData}}</view>
</view>
</view>
<view class="sku-list">
<block wx:for="{{skuObj.specificationList}}" wx:key="index">
<view class="sku-title">{{item.specificationName}}</view>
<view class="sku-item">
<block wx:for="{{item.specificationValueList}}" wx:key="ind" wx:for-index="ind" wx:for-item="i">
<view class="item text-center {{i.active?'active':''}} {{i.stock ===0?'disabled':''}}" bindtap="choose" data-index="{{index}}"
data-ind="{{ind}}">{{i.specificationValue}}</view>
</block>
</view>
</block>
<view class="sku-title">
数量
<stepper count="{{goodsNumber}}" max="{{goodsInfo.stock}}" bindchange="changeCount"></stepper>
</view>
<view class="sku-title">
发货
<view class="value">快递:{{skuObj.expressFee||'免运费(请以提交订单时为准)'}}</view>
</view>
</view>
</view>
</scroll-view>
<view class="sku-btn-box">
<view class="sku-btn">
<block wx:if="{{!isActivity}}">
<view class="join text-center {{goodsInfo.stock === 0?'disabled':''}}" bindtap="click" data-type="join">加入购物车</view>
</block>
<view class="pay text-center {{goodsInfo.stock === 0?'disabled':''}} " bindtap="click" data-type="pay">立即购买</view>
</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/Sku/Sku.wxss */
@import '/assets/style/common.wxss';
.sku {
position: fixed;
left: 0;
bottom: 0;
right: 0;
top: 0;
z-index: 9;
}
.sku-bg {
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
}
.sku-box {
position: absolute;
width: 100%;
height: 76%;
background: #FFFFFF;
border-radius: 16rpx 16rpx 0 0;
left: 0;
animation: show-sku-box .5s forwards;
z-index: 2;
}
.sku-box.close {
animation: hide-popup-box .5s forwards;
}
.sku-box.isFullSucreen {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
@keyframes show-sku-box {
0% {
bottom: -100%;
}
100% {
bottom: 0;
}
}
@keyframes hide-popup-box {
0% {
bottom: 0;
}
100% {
bottom: -100%;
}
}
.sku-content {
box-sizing: border-box;
height: calc(100% - 100rpx);
}
.sku-content .view {
padding: 0 40rpx;
}
.sku-content .goods-box {
display: flex;
align-items: center;
position: sticky;
background-color: #fff;
z-index: 2;
top: 0;
padding-bottom: 18rpx;
}
.sku-content .goods-box .preview {
width: 180rpx;
height: 180rpx;
border-radius: 4rpx;
margin-right: 40rpx;
overflow: hidden;
margin-top: 40rpx;
}
.sku-content .goods-box .goods-info {
width: calc(100% - 220rpx);
}
.sku-content .goods-box .price {
color: var(--btnColor);
font-size: 64rpx;
margin-bottom: 10rpx;
}
.sku-content .goods-box .price .unit {
font-size: 40rpx;
}
.sku-content .goods-box .count {
color: #B9BABB;
font-size: 20rpx;
margin-bottom: var(--borderRadius);
}
.sku-content .goods-box .active {
font-size: 20rpx;
color: #707071;
}
.sku-box .sku-list {
padding-bottom: 40rpx;
}
.sku-box .sku-title {
color: #2D2D2E;
font-weight: 500;
padding-top: var(--margin);
display: flex;
align-items: center;
justify-content: space-between;
}
.sku-title .value {
color: #565759;
font-weight: normal;
}
.sku-box .sku-item {
display: flex;
flex-wrap: wrap;
}
.sku-box .sku-item .item {
height: 52rpx;
background: #F9F7F7;
padding: 0 20rpx;
margin: 20rpx 20rpx 0 0;
font-size: 24rpx;
color: #656566;
border: 2rpx solid #F7F8FA;
box-sizing: border-box;
border-radius: 4rpx;
}
.sku-box .sku-item .item.active {
border-color: rgb(252, 91, 50);
color: rgb(252, 91, 50);
background-color: rgba(252, 91, 50, .06);
}
.sku-btn-box {
height: 100rpx;
padding: 10rpx var(--margin);
}
.sku-btn {
border-radius: var(--borderRadius);
display: flex;
overflow: hidden;
}
.sku-btn .join,
.sku-btn .pay {
flex: 1;
height: 80rpx;
color: #fff;
}
.sku-btn .join {
background-color: #FDC23E;
}
.sku-btn .pay {
background-color: var(--btnColor);
}
.disabled{
background-color: #B1B1B3 !important;
/* border-color: #B1B1B3 !important; */
color: #000000!important;
}
\ No newline at end of file \ No newline at end of file
// packageMall/pages/coupon/coupon.js
import {
wxqrcode as QR
} from "~/lib/index";
Page({
/**
* 页面的初始数据
*/
data: {
shareStaff: {},
discountType: {
1: '满减券',
2: '折扣券',
3: '代金券',
4: '兑换券',
5: '购车代金券',
6: '商品折扣券',
7: '会员服务券'
},
useMemberType: 0,
list: [],
pageNum: 1
},
unique(arr) {
let res = new Set()
return arr.filter(item => {
let id = JSON.stringify(item)
if (res.has(id)) {
return false
} else {
res.add(id)
return true
}
})
},
getCouponGoodsPage(res) {
wx.p.wxApi.showLoading()
let total = 0
let {
list,
pageNum
} = this.data
wx.p.api.shopmallApi
.getCouponGoodsPage({
pageNum,
couponId: res.couponId || res.id,
merchantId: res.merchantId
})
.then(data => {
console.log(data)
// let lists = this.unique([...list, ...data.list])
this.setData({
list: data.list,
total
})
wx.hideLoading()
})
},
jumpCommodity(e) {
let {
item
} = e.currentTarget.dataset
// console.log('item',item);
let {
id
} = item
let isActivity = false
wx.p.router.go('/packageMall/pages/detail/detail', {
id,
isActivity,
notIntercept: true
})
},
jump(e) {
let {
item
} = e.currentTarget.dataset
wx.openLocation({
latitude: item.lat,
longitude: item.lng,
name: item.merchantName,
address: item.merchantAddress
})
},
jumpMap() {
let {
couponDetail
} = this.data
wx.openLocation({
latitude: couponDetail.lat,
longitude: couponDetail.lng,
name: couponDetail.merchantName,
address: couponDetail.merchantAddress
})
},
jump() {
console.log()
let {
length
} = getCurrentPages()
if (length == 1) wx.p.router.redirectTo('/packageMine/pages/coupon/index/index')
else wx.p.router.back()
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
// 0616添加推荐人
if (options.shareStaffUuid) {
this.data.shareStaff = {
shareStaffUuid: options.shareStaffUuid,
shareStaffName: options.shareStaffName
}
options.item_type = 2
options.action_type = 1
options.item_id = options.couponId
this.data.recommandOptions = options
// wx.$util.reportData(options, false, false, true)
}
// console.log('options',options);
const {
userCouponId,
useMemberType,
detailInfo
} = options
wx.p.wxApi.showLoading('加载中...')
if (userCouponId) {
console.log(userCouponId)
this.setData({
useMemberType,
detailInfo
})
wx.p.api.couponsApi.getWWCoupon({
userCouponId
}).then(res => {
wx.hideLoading()
wx.nextTick(() => {
this.setCouponData(res)
})
let code = res.verificationCode.replace(/(.{4})/g, '$1 ')
this.setData({
qr: QR.createQrCodeImg(`t=2&c=${res.verificationCode}`),
verificationCode: code
})
})
}
if (options && options.couponId) {
console.log(options)
wx.p.wxApi.showLoading('加载中...')
this.checkCoupon(options)
if (options.activity_id) {
this.data.activiOptions = options
// wx.$util.reportData(options, true, false)
}
} else {
let {
isReceive
} = this.data
if (isReceive) this.confirm()
}
},
checkCoupon(options, callBack) {
wx.p.api.couponsApi.checkCoupon(options).then(couponInfo => {
console.log(couponInfo)
if (couponInfo) {
couponInfo.receiveEndTime = new Date(couponInfo.receiveEndTime).format('yyyy.MM.dd hh:mm:ss')
couponInfo.receiveStartTime = new Date(couponInfo.receiveStartTime).format('yyyy.MM.dd hh:mm:ss')
couponInfo.receiveTime = new Date(couponInfo.receiveTime).format('yyyy.MM.dd hh:mm:ss')
}
this.setData({
detailInfo: couponInfo
})
wx.p.api.couponsApi.getCouponInfo(options).then(res => {
this.setCouponData(res)
this.setData({
...options
})
if (couponInfo) {
let code = couponInfo.verificationCode.replace(/(.{4})/g, '$1 ')
console.log(couponInfo.verificationCode)
this.setData({
useMemberType: couponInfo.useMemberType,
qr: QR.createQrCodeImg(`t=2&c=${couponInfo.verificationCode}`),
verificationCode: code
})
} else {
if (callBack) callBack(couponInfo)
}
wx.hideLoading()
})
})
},
setCouponData(res) {
if (res.receiveStartTime) res.receiveStartTime = new Date(res.receiveStartTime).format('yyyy.MM.dd hh:mm:ss')
if (res.receiveEndTime) res.receiveEndTime = new Date(res.receiveEndTime).format('yyyy.MM.dd hh:mm:ss')
if (res.receiveTime) res.receiveTime = new Date(res.receiveTime).format('yyyy.MM.dd hh:mm:ss')
if (res.list) {
res.list.map(val => (val.verificationTime = new Date(val.verificationTime).format('yyyy.MM.dd hh:mm:ss')))
}
if (res.effectiveStartTime) res.effectiveStartTime = res.effectiveStartTime.replace(/-/g, '.')
if (res.effectiveEndTime) res.effectiveEndTime = res.effectiveEndTime.replace(/-/g, '.')
if (res.full) res.full = res.full / 100
if (res.discountType == 3 && res.useChannel == 1) {
this.getCouponGoodsPage(res)
}
console.log(res, '///////////')
this.setData({
couponDetail: res
})
// setTimeout(() => {
// this.setData({
// flag: true
// })
// }, 500)
},
confirm() {
let {
couponId,
issueName,
issueDate,
userCouponId,
merchantId,
shareSource
} = this.data
if (!couponId && !userCouponId) return
// wx.p.router.intercept().then(response => {
// if (response) {
// this.setData({
// isReceive: true
// })
// return
// }
// let obj = {
// ...this.data.shareStaff
// }
// if (userCouponId) obj.userCouponId = userCouponId
// if (couponId) obj.couponId = couponId
// if (issueName) obj.issueName = issueName
// if (issueDate) obj.issueDate = issueDate
// if (merchantId) obj.merchantId = merchantId
// if (shareSource) obj.shareSource = shareSource
// this.checkCoupon(obj, () => {
// wx.p.api.couponsApi.receiveCoupon(obj).then(({
// code,
// data,
// message
// }) => {
// if (code == '0') {
// // wx.$Track.setTrack({
// // data,
// // type: '领取优惠券'
// // },
// // 7
// // )
// console.log(data)
// if (data.discountType == 3) {
// this.jump()
// return
// }
// this.setData({
// qr: QR.createQrCodeImg(`t=2&c=${data.verificationCode}`),
// verificationCode: data.verificationCode
// })
// wx.p.wxApi.showToast('领取成功')
// this.checkCoupon(obj)
// if (this.data.activiOptions) {
// // wx.$util.reportData(this.data.activiOptions, false, true)
// }
// if (this.data.recommandOptions) {
// let options = this.data.recommandOptions
// options.item_type = 2
// options.action_type = 2
// options.item_id = options.couponId
// // wx.$util.reportData(options, false, false, true)
// }
// } else {
// wx.p.wxApi.showToast(message)
// }
// })
// })
// })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
// wx.$util.customerbehavior(2)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {}
})
\ No newline at end of file \ No newline at end of file
/* packageMall/pages/coupon/coupon.wxss */
.navigation-bar {
position: fixed;
top: 0;
left: 0;
z-index: 2;
}
.navigation {
width: 100%;
height: 100%;
position: relative;
}
.navigation .back {
width: 64rpx;
height: 64rpx;
background: rgba(255, 255, 255, 0.5);
border-radius: var(--margin);
position: absolute;
left: 20rpx;
}
.navigation .back .icon {
width: 36rpx;
height: 36rpx;
}
.navigation .text {
max-width: 50%;
font-size: 32rpx;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 500;
box-sizing: border-box;
text-align: center;
letter-spacing: 1rpx;
}
.layout {
padding: 32rpx;
}
.layout .box {
background: #ffffff;
box-shadow: 0px 8rpx 16rpx 0px rgba(224, 224, 224, 0.5);
border-radius: 8rpx;
}
.layout .qr-box {
padding: 32rpx 32rpx 20rpx 32rpx;
margin-bottom: 20rpx;
position: relative;
}
.layout .qr-box .type {
position: absolute;
right: 0;
top: 0;
width: 140rpx;
height: 120rpx;
background-color: var(--btnColor);
}
.layout .qr-box .type text {
color: #fff;
display: block;
transform: rotate(45deg);
font-size: 24rpx;
}
.layout .qr-box .top {
position: relative;
z-index: 2;
/* border-bottom: 2rpx solid #eeeeee;
padding-bottom: 32rpx; */
box-sizing: border-box;
}
.layout .qr-box .top .title {
font-weight: 600;
font-size: 36rpx;
color: #3a3a3a;
padding-bottom: 20rpx;
}
.layout .qr-box .top .title .coupon {
background-color: var(--btnColor);
margin-left: 20rpx;
font-size: 24rpx;
border-radius: 8rpx;
padding: 4rpx 20rpx;
color: #fff;
flex-shrink: 0;
}
.layout .qr-box .top .title .disabled {
background-color: #999999;
}
.layout .qr-box .top .time {
font-size: 24rpx;
color: #bebebe;
}
.layout .qr-box .bottom {
/* min-height: 506rpx; */
flex-direction: column;
}
.layout .qr-box .bottom .title {
padding: 22rpx 0 24rpx;
font-size: 32rpx;
}
.layout .qr-box .bottom .qr {
width: 280rpx;
height: 280rpx;
margin-bottom: 44rpx;
position: relative;
}
.layout .qr-box .bottom .qr .qr-text {
font-size: 24rpx;
color: #bebebe;
width: 200%;
text-align: center;
}
.layout .qr-box .bottom .qr .mask {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-size: 28rpx;
font-weight: 500;
line-height: 32rpx;
width: 181rpx;
height: 84rpx;
background: #000;
border-radius: 8rpx;
opacity: 0.7;
color: #FFFFFF;
}
.layout .qr-box .bottom .qr .mask.lose {
font-size: 28rpx;
color: #999999;
}
.layout .qr-box .btn-box {
height: 304rpx;
background: #FFF5F3;
border-radius: 8rpx;
padding: 32rpx;
}
.layout .qr-box .btn-box .text {
width: 100%;
text-align: center;
font-size: 20rpx;
color: #FC5B32;
line-height: 28px;
}
.layout .qr-box .btn {
/* animation: huxi 2.5s infinite; */
/* margin-bottom: 40rpx; */
font-size: 28rpx;
color: #FFFFFF;
margin-top: 38rpx;
width: 400rpx;
height: 68rpx;
background: #FC5B32;
box-shadow: 0px 4rpx 12rpx 4rpx rgba(252, 91, 50, 0.1);
border-radius: 34rpx;
}
/* @keyframes huxi {
0% {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
} */
.layout .qr-box .bottom .code {
font-size: 28rpx;
}
.layout .info {
padding: 32rpx;
line-height: 40rpx;
font-size: 28rpx;
color: #666666;
}
.layout .info .title {
color: #333333;
}
.layout .info .title .sprite-icon {
margin-right: 16rpx;
}
.icon-explain {
width: 32rpx;
height: 32rpx;
}
.layout .info .item {
margin-top: 24rpx;
word-break: break-all;
position: relative;
}
.layout .info .item .num {
position: absolute;
left: 0;
top: 0;
}
.bottom-box {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
z-index: 2;
background-color: #fff;
padding-top: 10rpx;
}
.default-btn {
margin: 0 auto 10rpx;
}
.isFullSucreen {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
.isFullSucreen-btn {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
.box-X {
border-radius: 8rpx;
background-color: #fff;
padding: 24rpx 24rpx 40rpx;
}
.associationBox .title {
font-size: 32rpx;
padding-bottom: 24rpx;
font-weight: 500;
}
.associationBox .goods {
margin-top: 24rpx;
display: flex;
align-items: center;
height: 160rpx;
}
.associationBox .goods .icon {
width: 160rpx;
height: 100%;
overflow: hidden;
border-radius: 8rpx;
margin-right: 20rpx;
}
.associationBox .goods .info {
width: calc(100% - 180rpx);
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.associationBox .goods .info .name {
font-size: 30rpx;
color: #333;
}
.associationBox .goods .info .price {
display: flex;
color: var(--btnColor);
font-weight: 500;
}
.associationBox .goods .info .price-X {
margin-top: -8rpx;
font-size: 36rpx;
font-family: DINAlternate-Bold, DINAlternate;
}
.top .title .title_text {
font-size: 36rpx;
font-weight: 600;
max-width: 510rpx;
}
.top .title .baseImage {
width: 140rpx;
height: 138rpx;
background-size: cover;
position: absolute;
right: -40rpx;
top: -41rpx;
}
.qrText {
color: #FC5B32;
}
.changeColor {
color: #333;
}
.lines {
height: 2rpx;
background: #EEE;
margin: 32rpx 0 0;
}
.title .discount {
font-size: 40rpx;
font-weight: 600;
}
.title .discount_text {
font-size: 24rpx;
padding-top: 8rpx;
}
.title .discount_text_x {
font-size: 32rpx;
padding-left: 10rpx;
}
.numberColor {
color: #B4B4B4;
}
.darkColor {
color: #666;
}
.box .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;
}
.qr-box .storeTitle {
font-size: 32rpx;
font-weight: 500;
color: #333;
margin-bottom: 32rpx;
}
.qr-box .store-box {
background: #F9F9F9;
border: 2rpx solid #E9E9E9;
border-radius: 8rpx;
padding: 16rpx 32rpx;
margin-bottom: 18rpx;
}
.qr-box .store-box:last-child {
margin-bottom: 0;
}
.qr-box .storeName {
font-size: 28rpx;
color: #333;
margin-top: -4rpx;
}
.qr-box .businessTime {
font-size: 24rpx;
color: #999;
margin-top: 4rpx;
padding-bottom: 18rpx;
}
.qr-box .line {
height: 2rpx;
background: #EEE;
}
.qr-box .addressBox {
padding-top: 20rpx;
font-size: 24rpx;
color: #666;
display: flex;
align-items: center;
}
.qr-box .addressBox .navigation-X {
width: 32rpx;
height: 32rpx;
}
.qr-box .couponBox-X {
max-width: 610rpx;
line-height: 48rpx;
}
.qr-box .couponBox-X .titleDay {
font-size: 28rpx;
font-weight: 500;
color: #333;
}
.titleDay_text {
font-size: 24rpx;
color: #666;
}
.darkColor {
color: #666;
}
.an_title_text {
font-size: 32rpx;
font-weight: 500;
color: #333;
margin-bottom: 20rpx;
}
.note_line {
box-sizing: border-box;
line-height: 48rpx;
}
.note_line .line_text_name {
font-size: 28rpx;
color: #333;
}
.note_line .line {
height: 2rpx;
background: #EEE;
margin: 16rpx 0 14rpx;
}
.line_text {
font-size: 24rpx;
color: #666;
}
.btn-box .title_text_X {
font-size: 36rpx;
font-weight: 600;
max-width: 510rpx;
}
.btn-box .baseImage{
width: 138rpx;
height: 138rpx;
background-size: cover;
position: absolute;
right: -9rpx;
top: -13rpx;
}
.btn-box .times {
font-size: 24rpx;
color: #D83C14;
margin: 20rpx 0 32rpx;
}
.qr-box .good {
display: flex;
padding-bottom: 12rpx;
}
.qr-box .good .icons {
width: 144rpx;
height: 144rpx;
}
.qr-box .good .infos {
margin-left: 32rpx;
}
.qr-box .good .infos .names {
font-size: 28rpx;
color: #282829;
}
.qr-box .good .infos .prices {
display: flex;
margin-top: 50rpx;
font-size: 36rpx;
font-weight: 600;
color: #FC5B32;
}
.qr-box .good .icons image {
border-radius: 8rpx;
}
.qr-box .good .infos .prices .prices-X {
margin-left: 10rpx;
}
.qr-box .liness {
height: 2rpx;
background: #EFF0F2;
margin: 20rpx 0 32rpx 0;
}
.coupon-X {
height: 203rpx;
margin: 0 -8rpx;
position: relative;
}
.coupon-X .left_box {
width: 230rpx;
height: 150rpx;
color: #FFFFFF;
font-size: 56rpx;
font-weight: 600;
text-align: center;
line-height: 150rpx;
}
.coupon-X .left_box .price_icon {
font-size: 24rpx;
font-weight: 500;
}
.coupon-X .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: #FC5B32;
}
.describeColor {
color: #D83C14;
}
.timeColor {
color: #999;
}
.bottom_box {
height: 42rpx;
line-height: 42rpx;
}
.coupon-X .bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.coupon-X .infoss {
position: relative;
z-index: 2;
display: flex;
width: 100%;
height: 100%;
right: 0;
top: 0;
}
\ No newline at end of file \ No newline at end of file
<navigation-bar custom page-title="卡券详情">
<view class="navigation">
<view class="back text-center y-center" bindtap="jump">
<glsx-image webp src="mall/back.png" class="icon"></glsx-image>
</view>
<view class="text box-center">
卡券详情
</view>
</view>
</navigation-bar>
<view class="layout isFullSucreen" wx:if="{{couponDetail.couponName}}" style="margin-top: {{navHeight}}px;">
<block wx:if="{{qr}}">
<block wx:if="{{couponDetail.discountType == 3 && couponDetail.useChannel == 1}}">
<view class="coupon-X">
<glsx-image webp src="mine/coupon/daijin.png" class="bg"></glsx-image>
<view class="infoss">
<view class="left_box">
<text class="price_icon">¥</text>
<text>{{couponDetail.denomination / 100}}</text>
</view>
<view class="right_box">
<view class="top_box">
<view class="voucherName brightColor">{{couponDetail.couponName}}</view>
<view wx:if="{{couponDetail.useBarriers==1}}" class="h4_text describeColor">无门槛</view>
<view wx:if="{{couponDetail.useBarriers==2}}" class="h4_text describeColor">满{{couponDetail.full}}元可用</view>
</view>
<view class="bottom_box">
<view wx:if="{{couponDetail.effectiveType==3}}" class="h4_text timeColor">永久有效</view>
<view wx:if="{{couponDetail.effectiveType==2}}" class="h4_text timeColor">{{detailInfo.receiveStartTime}}-{{detailInfo.receiveEndTime}}</view>
<view wx:if="{{couponDetail.effectiveType==1}}" class="h4_text timeColor">有效期至{{detailInfo.receiveEndTime}}</view>
</view>
</view>
</view>
</view>
<view style="height: 18rpx;"></view>
</block>
<block wx:else>
<view class="qr-box box">
<view class="top">
<view class="title flex">
<view class="title_text {{detailInfo.useMemberType == 0 || couponDetail.useMemberType == 0 ? 'qrText':'changeColor'}}">{{detailInfo.couponName || couponDetail.couponName}}</view>
<glsx-image webp class="baseImage" src="mine/coupon/{{useMemberType == 0 || couponDetail.useMemberType == 0 ?'':'un-'}}{{couponDetail.discountType}}.png"></glsx-image>
</view>
<view class="time">
<view wx:if="{{couponDetail.effectiveType==3}}">永久有效</view>
<view wx:if="{{couponDetail.effectiveType==2}}">{{detailInfo.receiveStartTime || couponDetail.receiveStartTime}}-{{detailInfo.receiveEndTime || couponDetail.receiveEndTime}}</view>
<view wx:if="{{couponDetail.effectiveType==1}}">有效期至{{detailInfo.receiveEndTime || couponDetail.receiveEndTime}}</view>
</view>
</view>
<view class="lines"></view>
<view class="bottom flex">
<view class="title {{detailInfo.useMemberType == 0 || couponDetail.useMemberType == 0 ? 'qrText':'changeColor'}}">
<view class="flex" wx:if="{{couponDetail.discountType == 2}}">
<view class="discount" wx:if="{{couponDetail.discountIntensity}}">{{couponDetail.discountIntensity / 100}}</view>
<view class="discount_text" wx:if="{{couponDetail.discountIntensity}}">折</view>
<view class="discount_text_x" wx:if="{{couponDetail.useBarriers == 1}}">无门槛</view>
<view class="discount_text_x" wx:if="{{couponDetail.useBarriers == 2 && (detailInfo.full || couponDetail.full)}}">满{{detailInfo.full || couponDetail.full}}元可用</view>
</view>
</view>
<view class="qr">
<glsx-image webp src="{{qr}}"></glsx-image>
<block wx:if="{{useMemberType != 0}}">
<view class="mask text-center">
{{useMemberType==1?'已使用':'已失效'}}
</view>
</block>
</view>
<view class="code {{detailInfo.useMemberType == 0 || couponDetail.useMemberType == 0 ? 'darkColor':'numberColor'}}">{{verificationCode}}</view>
</view>
<view class="lines" style="margin: 20rpx 0 18rpx;"></view>
<view class="process">
<glsx-image webp src="mine/{{useMemberType == 0?'arrows':'unArrow'}}.png"></glsx-image>
<text class="process_text">导航到店</text>
<glsx-image webp class="rightArrow" src="mine/rightArrow.png" />
<glsx-image webp src="mine/{{useMemberType == 0?'car':'unCar'}}.png"></glsx-image>
<text class="process_text">开始服务</text>
<glsx-image webp class="rightArrow" src="mine/rightArrow.png" />
<glsx-image webp src="mine/{{useMemberType == 0?'ticket':'unTicket'}}.png"></glsx-image>
<text class="process_text">出示核销码</text>
</view>
</view>
</block>
</block>
<block wx:else>
<view class="qr-box box" style="padding: 0;">
<view class="btn-box">
<view class="flex">
<view class="title_text_X qrText">{{couponDetail.couponName}}</view>
<glsx-image webp class="baseImage" src="mine/coupon/{{couponDetail.discountType}}.png"></glsx-image>
</view>
<view class="times">
<view wx:if="{{couponDetail.effectiveType==3}}">永久有效</view>
<view wx:if="{{couponDetail.effectiveType==2}}">{{couponDetail.effectiveStartTime}}-{{couponDetail.effectiveEndTime}}</view>
<view wx:if="{{couponDetail.effectiveType==1 && detailInfo}}">有效期至{{couponDetail.receiveEndTime}}</view>
<view wx:if="{{couponDetail.effectiveType==1 && !detailInfo}}">领取后{{couponDetail.effectiveDays}}天内有效</view>
</view>
<view class="btn default-btn" bindtap="confirm">领取</view>
<view class="text">请点击领取按钮获取核销码</view>
</view>
</view>
</block>
<view class="qr-box box" style="padding-bottom: 32rpx;">
<view class="couponBox-X" style="padding-bottom: 16rpx;">
<view class="titleDay">有效日期:</view>
<view wx:if="{{couponDetail.effectiveType==3}}" class="titleDay_text darkColor">永久有效</view>
<view wx:if="{{couponDetail.effectiveType==2}}" class="titleDay_text darkColor">{{couponDetail.effectiveStartTime || couponDetail.receiveStartTime}}-{{couponDetail.effectiveEndTime || couponDetail.receiveEndTime}}</view>
<view wx:if="{{couponDetail.effectiveType==1 && detailInfo}}" class="titleDay_text darkColor">有效期至{{detailInfo.receiveEndTime || couponDetail.receiveEndTime}}</view>
<view wx:if="{{couponDetail.effectiveType==1 && !detailInfo}}" class="titleDay_text darkColor">领取后{{couponDetail.effectiveDays}}天内有效</view>
</view>
<view class="couponBox-X" style="padding-bottom: 16rpx;" wx:if="{{detailInfo}}">
<view class="titleDay">获取日期:</view>
<view class="titleDay_text darkColor">{{detailInfo.receiveTime || couponDetail.receiveTime}}</view>
</view>
<view class="couponBox-X" style="line-height: 44rpx;">
<view class="titleDay">使用说明:</view>
<view class="titleDay_text darkColor" style="white-space:pre-wrap">{{couponDetail.useDescription || ''}}</view>
</view>
</view>
<view class="qr-box box" wx:if="{{couponDetail.list.length}}">
<view class="an_title_text">使用记录</view>
<view wx:for="{{couponDetail.list}}" wx:key="index" class="note_line">
<view class="line_text_name">{{item.verificationMerchantName}}</view>
<view class="line_text">{{item.verificationTime}}</view>
<view class="line" wx:if="{{index < couponDetail.list.length - 1}}"></view>
</view>
</view>
<view class="qr-box box" wx:if="{{list.length}}">
<view class="storeTitle">适用商品</view>
<block wx:for="{{list}}" wx:key="index">
<view class="good" catchtap="jumpCommodity" data-item="{{item}}">
<view class="icons">
<glsx-image webp src="{{item.goodsImage}}"></glsx-image>
</view>
<view class="infos">
<view class="names">{{item.goodsName}}</view>
<view class="prices">
¥<view class="prices-X">{{item.retailPrice / 100}}</view>
</view>
</view>
</view>
<view class="liness" wx:if="{{index < list.length - 1}}"></view>
</block>
</view>
<!-- <block wx:if="{{couponDetail.suitMerchantLists && couponDetail.suitMerchantLists.length}}">
<view class="qr-box box" style="margin-bottom: 32rpx;">
<view class="storeTitle">适用门店</view>
<view wx:for="{{couponDetail.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>
</block> -->
<!-- <block wx:else>
<view class="qr-box box" style="margin-bottom: 32rpx;">
<view class="storeTitle">适用门店</view>
<view class="storeName">{{couponDetail.merchantName}}</view>
<view wx:if="{{couponDetail.bussinessBegintime}}" class="businessTime">营业时间:{{couponDetail.bussinessBegintime}}-{{couponDetail.bussinessEndtime}}</view>
<view wx:else class="businessTime">营业时间:无</view>
<view class="line" wx:if="{{couponDetail.merchantAddress}}"></view>
<view class="addressBox" wx:if="{{couponDetail.merchantAddress}}">
<view style="width: 552rpx;padding-right: 24rpx;">{{couponDetail.merchantAddress}}</view>
<view class="navigation-X" catchtap="jumpMap">
<glsx-image webp src="mine/{{useMemberType == 0?'navigation':'unNavigation'}}.png"></glsx-image>
</view>
</view>
</view>
</block> -->
<view class="associationBox" wx:if="{{couponDetail.relatedGoodsId}}">
<view class="box-X">
<view class="title">关联商品</view>
<view class="goods">
<view class="icon">
<glsx-image webp src="{{couponDetail.relatedGoodsImage || ''}}"></glsx-image>
</view>
<view class="info">
<view>
<view class="name">{{couponDetail.relatedGoodsName || ''}}</view>
</view>
<view class="price">
¥<view class="price-X">{{couponDetail.relatedGoodsPrice || ''}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// packageMall/pages/detail/detail.js
import {
centsToyuan
} from '~/utils/format'
const navStyle = 'background-color: transparent;'
let navBarHeight = 38
import NP from 'number-precision'
import {
countdownMixin
} from '~/mixins/index'
Page({
behaviors: [countdownMixin],
/**
* 页面的初始数据
*/
data: {
navStyle,
bannerIndex: 0,
contactInfo: {},
couponData: [],
only: false,
isLoading: true
},
save() {
let {
posterUrl
} = this.data
wx.getImageInfo({
src: posterUrl
})
.then(res => {
wx.saveImageToPhotosAlbum({
filePath: res.path,
success() {
wx.p.wxApi.showToast('保存成功')
},
fail(err) {
if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
wx.showModal({
title: '提示',
content: '需要您授权保存相册',
showCancel: false,
success() {
wx.openSetting({
success(settingdata) {
if (settingdata.authSetting['scope.writePhotosAlbum']) {
wx.showModal({
title: '提示',
content: '获取权限成功,再次保存图片即可成功',
showCancel: false
})
} else {
wx.showModal({
title: '提示',
content: '获取权限失败,无法保存到相册',
showCancel: false
})
}
}
})
}
})
}
}
})
})
.catch(() => {
wx.hideLoading()
wx.p.wxApi.showToast('图片保存失败,请重试')
})
},
previewImage(e) {
let {
current,
item
} = e.currentTarget.dataset
let urls = []
item.map(i => {
if (i.resType == 1) urls.push(i.content)
})
wx.p.wxApi.previewImage({
current,
urls
})
},
previewCommentImage(e) {
let {
current,
item
} = e.currentTarget.dataset
let urls = []
item.map(i => {
urls.push(i)
})
wx.p.wxApi.previewImage({
current,
urls
})
},
jump(e) {
let {
url,
isChooseAddress
} = e.currentTarget.dataset
wx.p.router.go(url, {
isChooseAddress
})
},
navbarReady(e) {
navBarHeight = e.detail.height
},
onPageScroll(e) {
this.setData({
navStyle: e.scrollTop >= navBarHeight ? '' : navStyle
})
},
showSkuFun() {
this.setData({
showSku: true
})
},
showCouponFun() {
this.setData({
showCoupon: !this.data.showCoupon
})
},
goodsActionClick(e) {
let type = e.detail,
{
activeSku,
isActivity,
goodsInfo: {
activityStatus,
goodsStock,
buyFlag
}
} = this.data
if (activeSku) return this.showSkuFun()
if (isActivity && activityStatus != 2) return
if (goodsStock == 0) return
if (buyFlag == 2) return
if (type == 'pay') this.pay()
else this.join()
},
async pay(e) {
const loginStatus = !wx.p.isLogin
if (loginStatus) return
let {
isActivity,
isLive,
contactInfo,
goodsInfo,
activeSku,
isDefault
} = this.data
let stock
let params = {
orderSource: 1
}
let orderGoodsList = {}
let goodsList = {}
if (e && e.detail) {
orderGoodsList = e.detail
goodsList = e.detail
stock = e.detail.stock
} else {
orderGoodsList = {
goodsNumber: 1,
goodsId: goodsInfo.id
}
goodsList = {
goodsNumber: 1
}
}
if (isLive) {
params.orderSource = 2
params.roomId = ''
}
goodsList = {
...goodsList,
merchantName: goodsInfo.merchantName,
goodsImage: goodsInfo.goodsImage,
goodsName: goodsInfo.goodsName,
retailPrice: goodsInfo.retailPrice,
stock: goodsInfo.goodsStock,
id: goodsInfo.id,
unit: goodsInfo.unit
}
if (activeSku) {
let list = isActivity ? goodsInfo.specificationExtraList : goodsInfo.specificationDetailList
list.map(e => {
if (e.specificationData == activeSku) {
goodsList.retailPrice = centsToyuan(e.retailPrice)
stock ? (goodsList.stock = stock) : (goodsList.stock = e.stock)
}
})
goodsList.specificationData = activeSku
}
if (isActivity) {
params.orderSource = 3
params.activityId = goodsInfo.id
orderGoodsList.goodsId = goodsInfo.goodsId
orderGoodsList.activityPrice = NP.times(goodsInfo.retailPrice, 100)
// goodsList.goodsImage = goodsInfo.activityImg
// goodsList.goodsName = goodsInfo.activityName
;
(goodsList.goodsId = goodsInfo.goodsId), (goodsList.stock = goodsInfo.goodsStock), (goodsList.id = goodsInfo.id)
}
params.orderGoodsList = [orderGoodsList]
goodsList.expressFee = goodsInfo.expressFee
if (!contactInfo.contactAddress && goodsInfo.deliveryType != 1) {
wx.p.wxApi.showToast('请填写收货地址')
return
}
wx.p.router.go('/packageMall/pages/pay/pay', {
isPay: true,
isActivity,
contactInfo,
goodsList,
isDefault,
params,
goodsInfo
})
},
async join(e) {
const loginStatus = !wx.p.isLogin
if (loginStatus) return
let params = e && e.detail
if (!params) {
params = {
goodsId: this.data.goodsInfo.id,
goodsNumber: 1
}
}
wx.p.wxApi.showLoading('请稍后...')
try {
const res = await wx.p.api.shopmallApi.addShoppingcart(params)
if (res) wx.p.wxApi.showToast('添加成功!在购物车等亲~')
} catch (error) {
wx.p.wxApi.showToast('操作失败')
}
},
back() {
wx.p.router.back()
},
changeBanner(e) {
this.setData({
bannerIndex: e.detail.current
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options && options.id) {
this.setData(options)
this.getGoodsDetail(options.id)
if (!options.isActivity) this.getGoodscouponList(options.id)
}
// 推荐人+推荐人埋点
if (options.shareStaffUuid) {
let shareStaff = {
shareStaffUuid: options.shareStaffUuid,
shareStaffName: options.shareStaffName
}
options.item_type = options.isActivity ? 3 : 1
options.action_type = 1
options.item_id = options.id
wx.p.util.reportData(options, false, false, true)
wx.p.storage.set('shareStaff', JSON.stringify(shareStaff))
wx.p.storage.set('shareStaffTracker', JSON.stringify(options))
}
// 埋点
if (options.activity_id) {
this.data.options = options
wx.p.storage.set('miaoshatrack', encodeURIComponent(JSON.stringify(options)))
wx.p.util.reportData(options, true, false)
}
},
getGoodsDetail(id) {
let {
isActivity,
} = this.data
let target = isActivity ? 'getActivityDetail' : 'getGoodsDetail'
wx.p.wxApi.showLoading('加载中...')
wx.p.api.shopmallApi[target](id).then(({
code,
data,
message
}) => {
if (code == '0') {
let trackobj = isActivity ? {
...data,
activityId: data.id
} : {
...data,
goodsId: data.id
}
// wx.$Track.setTrack(trackobj, 6)
//设置分享
let shareQuery = `id=${data.id}`,
shareTitle = data.goodsName,
shareImage = ''
data.goodsDetailImageList.map(e => {
if (e.resType == 1) shareImage = e.content
})
if (isActivity) {
shareTitle = data.activityName
shareQuery += '&isActivity=true'
}
this.shareQuery = shareQuery
this.shareTitle = shareTitle
this.shareImage = shareImage
let activeSku = null
if (data.expressFee != null) data.expressFee = centsToyuan(data.expressFee)
if (isActivity) {
if (data.specificationExtraList && data.specificationExtraList.length) {
activeSku = data.specificationExtraList[0].specificationData
data.skuPrice = centsToyuan(data.specificationExtraList[0].retailPrice)
}
if (data.priceReduce != null) {
data.priceReduce = centsToyuan(data.priceReduce)
let minus = data.priceReduce < 0 ? '-' : ''
if (Math.abs(data.priceReduce) >= 10000) {
let [one, two] = `${Math.abs(data.priceReduce) / 10000}`.split('.')
two = two ? two.substring(0, 2) : '00'
data.priceReduce = `${minus}${one}.${two}万`
}
}
if (data.goodsDetailImageList && data.goodsDetailImageList.length > 1) {
let video = {}
data.goodsDetailImageList.map((e, index) => {
console.log(e)
if (e.resType == 3) {
video = e
data.goodsDetailImageList.splice(index, 1)
data.goodsDetailImageList.unshift(video)
}
})
// data.goodsDetailImageList.unshift(video)
}
} else {
if (data.goodsVideo)
data.goodsDetailImageList = [{
resType: 3,
content: data.goodsVideo
},
...data.goodsDetailImageList
]
if (data.originalPrice != null) data.originalPrice = centsToyuan(data.originalPrice)
// for(let i=0; i<data.specificationList&&data.specificationList.length;i++ ){
// if(data.specificationDetailList[i].stock!=0){
// activeSku = data.specificationDetailList[i].specificationData
// data.skuPrice = centsToyuan(data.specificationDetailList[i].retailPrice)
// }
// }
if (data.specificationList && data.specificationList.length) {
activeSku = data.specificationDetailList[0].specificationData
data.skuPrice = centsToyuan(data.specificationDetailList[0].retailPrice)
}
}
if (data.retailPrice != null) {
data.retailPrice = centsToyuan(data.retailPrice)
if (data.retailPrice >= 10000) {
data.retailPrice = Number(data.retailPrice / 10000).toFixed(2)
data.unit = '万'
}
data.retailPrice = Number(data.retailPrice).toFixed(2)
}
if (data.goodsDescList && data.goodsDescList.length) {
this.setMediaInfo(data.goodsDescList)
}
this.setData({
goodsInfo: data,
goodsFlag: true,
activeSku
})
if (isActivity) this.countDown({
timer: [data.startTime, data.endTime],
targetObject: {
name: 'goodsInfo',
key: 'activityStatus'
}
})
this.getUserAddressDefault()
wx.hideLoading()
} else {
wx.hideLoading()
this.setData({
isLoading: false
})
}
})
},
async getGoodscouponList(id) {
const res = !wx.p.isLogin,
{
merchantId
} = wx.p.storage.get('merchant_info')
if (res) return
id = id ? id : this.data.id
wx.p.api.shopmallApi.getGoodscouponList({
goodsId: id,
merchantId
}).then(({
code,
data,
message
}) => {
let list = data && data.map(item => {
if (item.effectiveEndTime || item.effectiveStartTime) {
item.effectiveEndTime = new Date(item.effectiveEndTime).format('yyyy.MM.dd')
item.effectiveStartTime = new Date(item.effectiveStartTime).format('yyyy.MM.dd')
}
return item
})
this.setData({
couponData: list
})
})
},
setMediaInfo(goodsDescList) {
wx.p.wxApi.getSystemInfo(({
windowWidth
}) => {
goodsDescList.map((e, index) => {
if (e.resType == 3) {
wx.getVideoInfo({
src: e.content
}).then(res => {
let ratio = (windowWidth - 40) / res.width
this.setData({
[`goodsInfo.goodsDescList[${index}].height`]: res.height * ratio
})
})
}
})
})
},
async getUserAddressList() {
const res = !wx.p.isLogin
if (res) return
wx.p.api.mineApi.getUserAddressList().then(data => {
if (!data.length) {
this.setData({
contactAddress: '',
contactInfo: {
contactAddress: '',
contactName: '',
contactPhone: ''
},
isDefault: false
})
}
})
},
async getUserAddressDefault() {
const res = !wx.p.isLogin
if (res) this.setData({
addressFlag: true
})
else wx.p.api.mineApi.getUserAddressDefault().then(({
code,
data
}) => {
if (code == '0') {
let contactAddress = `${data.province}${data.city}${data.area}${data.address}`
this.setData({
contactAddress,
contactInfo: {
contactAddress,
contactName: data.receiveName,
contactPhone: data.phoneNumber
},
isDefault: data.isDefault == 1
})
}
this.setData({
addressFlag: true
})
})
},
//分享海报
sharePoster(e) {
const {
isActivity,
posterUrl,
id
} = this.data, target = isActivity ? 'getActivitylink' : 'getGoodslink'
if (!posterUrl) {
wx.p.wxApi.showLoading('加载中...')
wx.p.api.shopmallApi[target](id).then(data => {
if (data) {
this.setData({
posterUrl: data.posterUrl
})
}
wx.hideLoading()
})
}
this.setData({
showPoster: true
})
},
hidden() {
this.setData({
showPoster: false
})
},
/**
* 生命周期函数--监听登录成功后回调
*/
onLoginSuccess() {
this.getUserAddressDefault()
this.getGoodscouponList()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getUserAddressList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
// wx.p.util.customerbehavior(2)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
noScroll() {}
})
\ No newline at end of file \ No newline at end of file
{
"navigationStyle": "custom",
"usingComponents": {
"coupon-goods": "../../components/CouponGoods/CouponGoods",
"sku": "../../components/Sku/Sku"
}
}
\ No newline at end of file \ No newline at end of file
/* packageMall/pages/detail/detail.wxss */
.flex {
display: flex;
align-items: center;
position: relative;
}
.layout{
padding-bottom: calc(140rpx + var(--constantSafeAreaInsetBottom));
padding-bottom: calc(140rpx + var(--envSafeAreaInsetBottom));
animation: show-box-opacity .5s forwards;
}
.navigation-bar {
position: fixed;
top: 0;
left: 0;
z-index: 2;
}
.empty-page {
box-sizing: border-box;
width: 100%;
height: calc(100vh - 128rpx);
padding-top: 128rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 28rpx;
color: #ACACAC;
}
.empty-img {
width: 446rpx;
height: 240rpx;
margin-bottom: 60rpx;
}
.navigation {
width: 100%;
height: 100%;
position: relative;
}
.navigation .back {
width: 64rpx;
height: 64rpx;
background: #F9F7F7;
border-radius: var(--margin);
position: absolute;
left: 10rpx;
}
.navigation .back .icon {
width: 36rpx;
height: 36rpx;
}
.navigation .text {
max-width: 50%;
font-size: 32rpx;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 500;
box-sizing: border-box;
text-align: center;
letter-spacing: 1rpx;
}
.box {
margin-bottom: 16rpx;
background-color: #fff;
}
.banner-box {
height: 750rpx;
position: relative;
}
.banner {
height: 100%;
}
.dot-box {
position: absolute;
bottom: 24rpx;
border-radius: 2rpx;
overflow: hidden;
display: flex;
}
.banner video {
width: 100%;
height: 100%;
}
.dot {
width: 20rpx;
height: var(--borderRadius);
background: rgba(255, 255, 255, 0.3);
transition: all .5s;
}
.dot.active {
background-color: #fff;
}
.activity-box {
height: 100rpx;
position: relative;
}
.activity-box .activity-bg {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
.activity-box .activity-info {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 2;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 0 23rpx 0 15rpx;
color: #fff;
}
.activity-box .activity-info .price,
.activity-box .activity-info .now,
.activity-box .activity-info .text {
display: flex;
font-size: 24rpx;
}
.activity-box .activity-info .price {
align-items: baseline;
}
.activity-box .activity-info .text {
align-items: center;
}
.activity-box .activity-info .now {
font-size: 40rpx;
align-items: baseline;
margin-left: var(--borderRadius);
}
.activity-box .activity-info .now .num {
font-size: 60rpx;
line-height: 60rpx;
letter-spacing: -2rpx;
}
.activity-box .activity-info .activity-unit {
font-size: 40rpx;
margin-left: 6rpx;
transform: translateY(-5rpx);
}
.activity-box .activity-info .count {
opacity: .5;
font-size: 20rpx;
transform: translateY(-5rpx);
}
.activity-box .activity-info .text .old {
padding: 0 12rpx;
height: 28rpx;
background: #FFEAD1;
border-radius: 14rpx;
font-size: 20rpx;
color: var(--themeColor);
flex-direction: column;
margin-left: 6rpx;
}
.activity-box .activity-info .activity-time {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 20rpx;
color: var(--themeColor);
animation: show-activity-time .5s forwards;
}
@keyframes show-activity-time {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.activity-box .activity-info .activity-time .time {
font-size: 24rpx;
display: flex;
align-items: center;
justify-content: flex-end;
color: var(--themeColor);
margin-top: 10rpx;
}
.activity-box .activity-info .activity-time .day {
margin-right: var(--borderRadius);
}
.activity-box .activity-info .time-box {
background: var(--themeColor);
border-radius: 4rpx;
width: 36rpx;
height: 36rpx;
color: #fff;
}
.activity-box .activity-info .unit {
text-align: center;
width: 16rpx;
}
.activity-time .finished {
font-size: 32rpx;
}
.goods-info {
padding: 28rpx 40rpx 32rpx;
}
.goods-info .price {
margin-bottom: 2rpx;
}
.goods-info .price,
.goods-info .price .now {
display: flex;
align-items: baseline;
}
.goods-info .price .now {
font-size: 64rpx;
color: var(--btnColor);
margin-right: 8rpx;
line-height: 64rpx;
}
.goods-info .price .now .unit {
font-size: 40rpx;
}
.goods-info .price .now .up {
transform: translateY(-2rpx);
}
.goods-info .price .old {
color: #B1B1B3;
text-decoration: line-through;
}
.goods-info .name {
font-size: 36rpx;
font-weight: 500;
position: relative;
width: 85%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.goods-info .count {
margin-top: 20rpx;
font-size: 24rpx;
color: #B1B1B3;
display: flex;
position: relative;
}
.goods-info .count view:nth-child(2) {
margin-left: 100rpx;
}
.goods-param {
padding: 0 40rpx;
}
.goods-param .item {
position: relative;
height: 98rpx;
border-bottom: 2rpx solid #EFF0F2;
display: flex;
align-items: center;
font-size: 24rpx;
}
.goods-param .item:last-child {
border-bottom: none;
}
.goods-param .item .label {
width: 136rpx;
color: #656566;
}
.goods-param .item .value {
width: 490rpx;
color: #3B3B3D;
}
.goods-param .item .coupon {
font-size: 24rpx;
padding: 0 20rpx;
font-weight: 500;
color: var(--btnColor);
line-height: 40rpx;
height: 40rpx;
width: auto;
background: rgba(252, 91, 50, 0.12);
border-radius: 4rpx;
box-sizing: border-box;
}
.goods-param .address {
height: 134rpx;
align-items: flex-start;
box-sizing: border-box;
padding: var(--margin) 0;
position: relative;
}
.goods-param .address .tips {
position: absolute;
color: #B1B1B3;
left: 136rpx;
bottom: var(--margin);
}
.goods-param .item .icon-mine-arrow {
margin-left: auto;
transform: scale(1.3) translateY(9rpx);
}
.goods-param .address .icon-mine-arrow {
position: absolute;
right: 0;
top: 50%;
transform: scale(1.3) translateY(0);
}
.activity-detail {
background-color: #fff;
}
.activity-detail .title {
display: flex;
align-items: center;
padding: 0 40rpx 20rpx;
}
.activity-detail .title .icon {
width: 32rpx;
height: 32rpx;
margin-right: var(--borderRadius);
}
.detail-time {
margin-bottom: 20rpx;
}
.content {
font-size: 24rpx;
background-color: #fff;
padding: 0 40rpx;
}
.content:first-of-type,
.activity-detail .title:first-of-type {
padding-top: 40rpx;
}
.content:last-of-type {
padding-bottom: 40rpx;
}
.goods-comment {
padding: 40rpx 32rpx;
}
.goods-comment .comment-head {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 12rpx;
}
.goods-comment .comment-content {
font-size: 28rpx;
font-weight: 400;
color: #282829;
line-height: 40rpx;
padding: 0 0 20rpx 0;
white-space: normal;
word-break: break-all;
}
.goods-comment .comment-head .comment-total {
font-size: 32rpx;
font-weight: 500;
color: #282829;
line-height: 44rpx;
}
.comment-all {
font-size: 24rpx;
font-weight: 400;
color: #3B3B3D;
line-height: 34rpx;
display: flex;
align-items: center;
}
.comment-all .icon-mine-arrow {
margin-left: 12rpx;
}
.comment-user {
padding: 16rpx 0 20rpx 0;
display: flex;
align-items: center;
}
.comment-user .user-portrait {
width: 72rpx;
height: 72rpx;
margin-right: 16rpx;
background-color: #333333;
border-radius: 50%;
}
.user-portrait image {
border-radius: 50%;
}
.comment-user .user-info .name {
font-size: 32rpx;
font-weight: 600;
color: #282829;
line-height: 44rpx;
}
.comment-user .user-info .comment-time {
font-size: 20rpx;
font-weight: 400;
color: #B1B1B3;
line-height: 28rpx;
}
.goods-comment .comment-images {
display: flex;
align-items: center;
flex-wrap: wrap;
margin-right: -40rpx;
}
.goods-comment .comment-images .icon {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
box-sizing: border-box;
margin-right: 16rpx;
background-color: #e7e7e7;
margin-bottom: 10rpx;
}
.goods-comment .comment-images .icon image {
border-radius: 8rpx;
}
.share {
width: 108rpx;
height: 44rpx;
background: #EFDEE0;
border-radius: 22rpx;
font-size: 24rpx;
color: var(--btnColor);
display: flex;
align-items: center;
position: absolute;
right: 0;
padding-left: 16rpx;
box-sizing: border-box;
&-icon {
width: 20rpx;
height: 22rpx;
margin-left: 8rpx;
}
}
.share text {
flex-shrink: 0;
}
.model {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 999999;
display: flex;
align-items: center;
justify-content: center;
&-bg{
position: absolute;
left: 0;
top: 0;
z-index: -1;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
}
}
.poster {
width: 540rpx;
height: 924rpx;
animation: show-box-inset .5s forwards;
}
.goods-param .items {
min-height: 34rpx;
display: flex;
font-size: 24rpx;
padding: 32rpx 0;
}
.goods-param .items .labels {
width: 136rpx;
color: #656566;
}
.goods-param .items .values {
width: 490rpx;
color: #3B3B3D;
}
.tab-widget {
width: 100%;
height: 88rpx;
background: white;
position: fixed;
left: 0;
top: 88rpx;
right: 0;
z-index: 999;
}
.tab-widget .tab-item {
width: 50%;
height: 100%;
position: relative;
}
.tab-widget .tab-item .text {
font-size: 28rpx;
color: #656566;
line-height: 40rpx;
}
.tab-widget .tab-item .text-ative {
font-weight: 500;
font-size: 28rpx;
color: #2C2C2C;
}
.tab-widget .tab-item .line {
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 66rpx;
height: 6rpx;
background: var(--btnColor);
border-radius: 2rpx;
}
\ No newline at end of file \ No newline at end of file
<view class="navigation-bar">
<navigation-bar custom navStyle="{{navStyle}}" bindnavbarReady="navbarReady" page-title="{{isActivity?goodsInfo.activityName:goodsInfo.goodsName}}">
<view class="navigation">
<view class="back text-center y-center" bindtap="back">
<glsx-image webp src="mall/{{showHomeBtn?'home':'back'}}.png" class="icon"></glsx-image>
</view>
</view>
</navigation-bar>
</view>
<view class="empty-page" wx:if="{{!goodsFlag && !isLoading}}">
<glsx-image webp class="empty-img" src="mall/active-empty.png" />
活动重新配置中,请稍后重试
</view>
<block wx:if="{{goodsFlag}}">
<view class="layout">
<view class="banner-box">
<swiper class="banner" bindchange="changeBanner">
<block wx:for="{{goodsInfo.goodsDetailImageList}}" wx:key="index">
<swiper-item>
<block wx:if="{{item.resType == 1}}">
<image webp src="{{item.content}}" bindtap="previewImage" data-current="{{item.content}}" data-item="{{goodsInfo.goodsDetailImageList}}"></image>
</block>
<block wx:elif="{{item.resType == 3}}">
<video src="{{item.content}}"></video>
</block>
</swiper-item>
</block>
</swiper>
<block wx:if="{{goodsInfo.goodsDetailImageList.length > 1}}">
<view class="dot-box x-center">
<block wx:for="{{goodsInfo.goodsDetailImageList}}" wx:key="index">
<view class="dot {{bannerIndex == index ? 'active':''}}">
</view>
</block>
</view>
</block>
</view>
<block wx:if="{{isActivity}}">
<view class="activity-box">
<view class="activity-info">
<view class="price-info">
<view class="price">
<text>秒杀价</text>
<view class="text">
<view class="now">
<text>¥</text>
<view class="num">{{goodsInfo.retailPrice}}</view>
<block wx:if="{{goodsInfo.unit}}">
<view class="activity-unit">{{goodsInfo.unit}}</view>
</block>
</view>
<view class="old text-center">
限时直降{{goodsInfo.priceReduce}}
</view>
</view>
</view>
<view class="count">已售出{{goodsInfo.saleAmount || 0}}件</view>
</view>
<!-- activityStatus:1:未开始,2进行中,3已结束 -->
<block wx:if="{{goodsInfo.activityStatus != 3}}">
<view class="activity-time" wx:if="{{timeFlag}}">
<view class="title">{{activityTime.type}}还剩:</view>
<view class="time">
<view class="day">{{activityTime.day || ''}}</view>
<block wx:for="{{activityTime.dayList}}" wx:key="index">
<view class="time-box text-center">
{{item}}
</view>
<view class="unit" wx:if="{{index < 2}}"> :</view>
</block>
</view>
</view>
</block>
<block wx:else>
<view class="activity-time">
<view class="finished">{{finished}}</view>
</view>
</block>
</view>
<view class="activity-bg">
<glsx-image webp src="mall/activity.png"></glsx-image>
</view>
</view>
</block>
<view class="goods-info box">
<block wx:if="{{!isActivity}}">
<view class="price">
<view class="now">
<text class="unit">¥</text>
<block wx:if="{{activeSku}}">
{{goodsInfo.skuPrice}}
<text class="unit up">起</text>
</block>
<block wx:else>
{{goodsInfo.retailPrice}}
<block wx:if="{{goodsInfo.unit}}">
<text class="unit">{{goodsInfo.unit}}</text>
</block>
</block>
</view>
<view class="old">¥{{goodsInfo.originalPrice}}</view>
</view>
</block>
<view class="flex">
<view class="name"> {{isActivity?goodsInfo.activityName:goodsInfo.goodsName}}
</view>
<view class="share" bindtap="sharePoster">
<text>分享</text>
<view class="share-icon">
<glsx-image src="mall/share.png"></glsx-image>
</view>
</view>
</view>
<block wx:if="{{!isActivity}}">
<view class="count">
<view>剩余: {{goodsInfo.goodsStock || goodsInfo.specificationDetailList[0].stock || 0}}</view>
<view>销售: {{goodsInfo.goodsStatistics.saleAmount || 0}}</view>
</view>
</block>
</view>
<view class="goods-param box">
<block wx:if="{{!isActivity}}">
<block wx:if="{{couponData.length>0}}">
<view class="item" bindtap="showCouponFun">
<view class="label">优惠</view>
<view class="value coupon">优惠券</view>
<view class="sprite-icon icon-mine-arrow"></view>
</view>
</block>
</block>
<block wx:if="{{activeSku}}">
<view class="item" bindtap="showSkuFun">
<view class="label">已选</view>
<view class="value text-hide">{{activeSku}}</view>
<view class="sprite-icon icon-mine-arrow"></view>
</view>
</block>
<block wx:if="{{goodsInfo.deliveryType != 1}}">
<view class="item address" bindtap="jump" data-url="/packageMine/pages/address/index/index" data-is-choose-address>
<view class="label">配送</view>
<view class="value text-hide">
<block wx:if="{{addressFlag}}">
{{contactAddress||'填写地址'}}
</block>
</view>
<view class="tips">支付后,预计48小时内发货</view>
<view class="sprite-icon icon-mine-arrow"></view>
</view>
</block>
<block wx:if="{{goodsInfo.deliveryType != 1}}">
<view class="item">
<view class="label">运费</view>
<view class="value text-hide">
<block wx:if="{{goodsInfo.expressFee}}">{{goodsInfo.expressFee}}元</block>
<block wx:else>免运费(请以提交订单时为准)</block>
</view>
</view>
</block>
<block wx:if="{{isActivity && goodsInfo.limitPurchaseFlag == 2}}">
<view class="item">
<view class="label">说明</view>
<view class="value text-hide">
<text>此商品活动期间每人限购{{goodsInfo.limitPurchaseNumber}}件</text>
</view>
</view>
</block>
<block wx:if="{{goodsInfo.serviceDesc}}">
<view class="items">
<view class="labels">服务说明</view>
<view class="values">
<text>{{goodsInfo.serviceDesc}}</text>
</view>
</view>
</block>
</view>
<view class="activity-detail">
<block wx:if="{{isActivity}}">
<view class="title">
<view class="sprite-icon icon-goods-time"></view>
活动时间
</view>
<view class="content detail-time">
{{goodsInfo.startTime}} - {{goodsInfo.endTime}}
</view>
<view class="title">
<view class="sprite-icon icon-goods-text"></view>
活动详情
</view>
</block>
<block wx:for="{{goodsInfo.goodsDescList}}" wx:key="index">
<view class="content">
<block wx:if="{{item.resType == 1}}">
<image webp src="{{item.content}}" mode="widthFix" bindtap="previewImage" data-current="{{item.content}}" data-item="{{goodsInfo.goodsDescList}}" lazy-load></image>
</block>
<block wx:elif="{{item.resType == 2}}">
{{item.content}}
</block>
<block wx:else>
<video src="{{item.content}}" style="height:{{item.height}}px;"></video>
</block>
</view>
</block>
</view>
</view>
</block>
<coupon-goods show="{{showCoupon}}" only="{{only}}" couponData="{{couponData}}" bindclick="showCouponFun"></coupon-goods>
<block wx:if="{{navHeight && goodsFlag}}">
<goods-action pay-disabled="{{goodsInfo.activityStatus != 2 }}" stock="{{goodsInfo.goodsStock === 0}}" buyFlag="{{goodsInfo.buyFlag == 2}}" bindclick="goodsActionClick" hideShop="{{isActivity}}"></goods-action>
<block wx:if="{{activeSku}}">
<sku show="{{showSku}}" showName="showSku" isActivity="{{isActivity}}" skuData="{{goodsInfo}}" bindpay="pay" bindjoin="join"></sku>
</block>
</block>
<block wx:if="{{showPoster && posterUrl}}">
<view class="model" catchtouchmove="noScroll">
<view class="model-bg" bindtap="hidden"></view>
<view class="poster" bindlongpress='save'>
<image webp src="{{posterUrl}}"></image>
</view>
</view>
</block>
<glsx-privacy appletName="海马刀"></glsx-privacy>
\ No newline at end of file \ No newline at end of file
// packageMall/pages/pay/pay.js
Page({
/**
* 页面的初始数据
*/
data: {
contactInfo: {},
orderCouponDTO: '', //最大优惠券
userCouponDTOS: [], //优惠券列表,
couponCost: 0,
goodsNumber: 1,
isPay: false,
isCoupon: true,
shopFlag: true,
shopCartFlag: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.isPay) {
//单个商品进来
let {
isActivity,
params,
contactInfo,
goodsList,
goodsInfo
} = options
if (goodsList.unit && goodsList.unit == '万') goodsList.retailPrice = goodsList.retailPrice * 10000
this.setData({
merchantName: goodsList.merchantName,
goodsInfo: goodsInfo,
goodsList: [goodsList],
orderParams: params,
addressFlag: true,
isPay: true,
contactInfo,
isDefault: options.isDefault,
isActivity
})
let orderGoods = this.data.orderParams.orderGoodsList
this.getMaxCoupon(orderGoods)
if (goodsInfo.deliveryType == 1) {
this.setData({
shopFlag: false
})
}
if (goodsInfo.deliveryType == 2) {
this.setData({
shopCartFlag: true
})
}
} else {
//购物车过来
let orderGoods = []
this.getUserAddressDefault()
options.goodsList.map(e => {
orderGoods.push({
goodsId: e.goodsId,
goodsNumber: e.goodsNumber
})
if (e.deliveryType == 2) {
this.setData({
shopCartFlag: true
})
}
})
this.setData({
...options
})
this.getMaxCoupon(orderGoods)
}
},
changeCount(e) {
console.log(e)
let {
index,
id
} = e.currentTarget.dataset
let goodsNumber = e.detail
let {
orderParams,
goodsList
} = this.data
goodsList[index].goodsNumber = goodsNumber
for (let i = 0; i < orderParams.orderGoodsList.length; i++) {
console.log(orderParams.orderGoodsList[i].goodsId == id)
if (orderParams.orderGoodsList && orderParams.orderGoodsList[i].goodsId == id) {
orderParams.orderGoodsList[i].goodsNumber = goodsNumber
this.setData({
orderParams
})
}
}
let orderGoods = this.data.orderParams.orderGoodsList
this.getMaxCoupon(orderGoods)
this.setData({
orderParams,
goodsList
})
},
getMoney() {
let {
isActivity,
goodsList,
couponCost,
isPay
} = this.data
let expressFeeArray = []
if (isActivity) {
couponCost = 0
}
let retailPrice = 0
let expressFee = 0
let goodsNumber = 0
let sum = 0
if (isPay) {
retailPrice = Number(goodsList[0].retailPrice)
expressFee = Number(goodsList[0].expressFee)
goodsNumber = Number(goodsList[0].goodsNumber)
sum = Number(retailPrice * goodsNumber + expressFee).toFixed(2)
} else {
goodsList.map(e => {
expressFeeArray.push(e.expressFee)
// expressFee += e.expressFee
goodsNumber += e.goodsNumber
sum += e.retailPrice * e.goodsNumber
})
//取运费最大值
expressFeeArray.sort((a, b) => {
return b - a
})
expressFee = expressFeeArray[0]
sum = sum + expressFee
}
let money = (parseFloat(sum) - parseFloat(couponCost)).toFixed(2)
this.setData({
sum: sum,
expressFee,
goodsNumber,
money: money < 0 ? 0 : money
})
},
//获取最大优惠券
getMaxCoupon(orderGoods) {
this.data.orderCouponDTO = ''
if (this.data.isCoupon && !this.data.isActivity) {
wx.p.api.shopmallApi.getMaxCoupon(orderGoods).then(res => {
if (res.code == 0 && res.data && res.data.orderCouponDTO && res.data.userCouponDTOS.length > 0) {
let {
orderCouponDTO,
userCouponDTOS
} = res.data
orderCouponDTO.isChecked = true
userCouponDTOS.forEach(item => {
item.id == orderCouponDTO.userCouponId ? (item.isChecked = true) : (item.isChecked = false)
})
if (orderCouponDTO && orderCouponDTO.denomination) {
this.data.couponCost = Number(orderCouponDTO.denomination / 100)
} else {
this.data.couponCost = 0
}
this.setData({
couponCost: this.data.couponCost,
orderCouponDTO: orderCouponDTO,
userCouponDTOS: userCouponDTOS
})
} else {
this.setData({
couponCost: 0,
orderCouponDTO: '',
userCouponDTOS: []
})
}
this.getMoney()
})
} else {
this.setData({
couponCost: 0
})
this.getMoney()
}
},
changeCoupon(e) {
if (e.detail) {
let userCouponDTOS = e.detail
let {
isCoupon,
couponCost
} = this.data
let orderCouponDTO = {}
if (userCouponDTOS.some(item => item.isChecked)) {
isCoupon = true
userCouponDTOS.forEach(item => {
if (item.isChecked) {
orderCouponDTO = {
goodIds: item.goodIds,
userCouponId: item.id,
couponName: item.couponName,
denomination: item.denomination,
full: item.full,
isChecked: true
}
}
})
} else {
orderCouponDTO.isChecked = false
isCoupon = false
}
if (orderCouponDTO && orderCouponDTO.denomination) {
couponCost = orderCouponDTO.denomination / 100
} else {
couponCost = 0
}
this.setData({
isCoupon: isCoupon,
couponCost: couponCost,
userCouponDTOS: userCouponDTOS,
orderCouponDTO: orderCouponDTO,
showCoupon: false
})
this.getMoney()
} else {
this.setData({
showCoupon: false
})
}
},
showCouponFun() {
this.setData({
showCoupon: true,
userCouponDTOS: this.data.userCouponDTOS
})
},
checkOut() {
try {
/**购物车 */
let ids = []
let {
contactInfo,
orderParams,
orderCouponDTO,
goodsList,
isPay,
goodsInfo,
shopCartFlag
} = this.data
goodsList.map(e => ids.push(e.id))
if (!isPay) {
//购物车结算
if (!contactInfo.contactAddress && shopCartFlag) {
wx.p.wxApi.showToast('请填写收货地址')
return
}
if (orderCouponDTO.isChecked) {
if (!shopCartFlag) {
orderParams = {
contactAddress: ' ',
contactName: ' ',
contactPhone: ' ',
orderCouponDTO
}
} else {
orderParams = {
...contactInfo,
orderCouponDTO
}
}
} else {
if (!shopCartFlag) {
orderParams = {
contactAddress: ' ',
contactName: ' ',
contactPhone: ' '
}
} else {
orderParams = {
...contactInfo
}
}
}
wx.p.wxApi.showLoading()
wx.p.api.shopmallApi
.settlementShoppingcart({
...orderParams,
ids
})
.then(data => {
this.pay(data[0].orderCode)
})
} else {
//立即购买
if (orderCouponDTO.isChecked) {
if (goodsInfo.deliveryType == 1) {
orderParams = {
contactAddress: ' ',
contactName: ' ',
contactPhone: ' ',
...orderParams,
orderCouponDTO
}
} else {
orderParams = {
...contactInfo,
...orderParams,
orderCouponDTO
}
}
} else {
if (goodsInfo.deliveryType == 1) {
orderParams = {
contactAddress: ' ',
contactName: ' ',
contactPhone: ' ',
...orderParams
}
} else {
orderParams = {
...contactInfo,
...orderParams
}
}
}
wx.p.wxApi.showLoading()
wx.p.api.shopmallApi.createOrder(orderParams).then(data => {
this.pay(data.orderCode)
})
}
} catch (error) {
wx.hideLoading()
}
},
goodsActionReady(e) {
this.setData({
padding_bottom: e.detail
})
},
jump() {
wx.p.router.go('/packageMine/pages/address/index/index', {
isChooseAddress: true,
})
},
pay(orderCode) {
let _this = this
let {
isPay,
goodsList
} = this.data
wx.p.wxApi.showLoading('结算中...')
wx.p.api.shopmallApi
.payOrder({
orderCode
})
.then(({
needPay,
payParams
}) => {
wx.hideLoading()
// wx.$Track.setTrack({
// goodsList
// },
// 7
// )
if (needPay) {
let params = {
nonceStr: payParams.nonceStr,
paySign: payParams.paySign,
signType: payParams.signType,
timeStamp: payParams.timeStamp,
package: payParams.packages
}
wx.requestPayment({
...params,
success(res) {
_this.requestSubscribeMessage()
},
fail(res) {
if (res.errMsg == 'requestPayment:fail cancel') {
wx.p.router.back(() => {}, isPay ? 1 : 2)
} else {
wx.p.router.reLaunch('/packageMine/pages/order/complete/complete', {
params
})
}
}
})
} else {
this.setData({
showSuccessModal: true
})
// _this.requestSubscribeMessage()
}
})
},
requestSubscribeMessage() {
wx.p.router.reLaunch('/packageMine/pages/order/complete/complete', {
success: true
})
return
let systemInfo = wx.p.storage.get('system_info')
if (systemInfo && systemInfo.environment != 'wxwork') {
wx.p.router.reLaunch('/packageShopmall/packageMine/pages/order/complete/complete', {
success: true
})
return
}
let tmplIds
wx.p.api.shopmallApi.requestSubscribeMessage().then(res => {
tmplIds = res.data
wx.requestSubscribeMessage({
tmplIds: tmplIds,
success(res) {
console.log(res)
wx.p.router.reLaunch('/packageShopmall/packageMine/pages/order/complete/complete', {
success: true
})
}
})
})
},
getUserAddressList() {
if (this.platformShop) {
return
}
wx.p.api.mineApi.getUserAddressList().then(data => {
if (data && data.length < 1) {
this.setData({
contactInfo: {}
})
}
})
},
getUserAddressDefault() {
wx.p.api.mineApi.getUserAddressDefault().then(({
code,
data
}) => {
console.log(data)
if (code == '0') {
let contactAddress = data.address ? `${data.province}${data.city}${data.area}${data.address}` : ''
this.setData({
contactInfo: {
contactAddress,
contactName: data.receiveName,
contactPhone: data.phoneNumber
},
isDefault: data.isDefault == 1
})
}
this.setData({
addressFlag: true
})
})
},
closeSuccessModal() {
this.requestSubscribeMessage()
this.setData({
showSuccessModal: false
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (!this.data.orderCode) this.getUserAddressList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {}
})
\ No newline at end of file \ No newline at end of file
{
"navigationBarTitleText": "确认订单",
"usingComponents": {
"stepper": "../shoppingCart/components/Stepper/Stepper"
}
}
\ No newline at end of file \ No newline at end of file
/* packageMall/pages/pay/pay.wxss */
@import "../shoppingCart/shoppingCart.scss";
.address-box {
padding: var(--margin) 20rpx;
height: 164rpx;
background-color: #fff;
border-radius: var(--borderRadius);
box-sizing: border-box;
margin-bottom: 24rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.address-box .left {
width: 580rpx;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
padding-left: 8rpx;
}
.address-box .left .top {
display: flex;
align-items: center;
}
.address-box .default {
width: 120rpx;
height: 40rpx;
font-size: 24rpx;
color: #fff;
background-color: var(--themeColor);
border-radius: 4rpx;
margin: 0 20rpx;
flex-shrink: 0;
}
.address-box .bottom{
color: #B1B1B3;
}
.address-box .phone {
margin-left: auto;
}
.address-box .right {
width: calc(100% - 580rpx);
justify-content: flex-end;
}
.address-box .right .icon {
width: 28rpx;
height: 28rpx;
}
.content-box{
padding-left: 24rpx;
background-color: #fff;
border-radius: 8px;
}
.merchantName{
display: flex;
height: 82rpx;
align-items: center;
padding-right: 24rpx;
border-bottom: 2rpx solid #EFF0F2;
}
.box .item .content .goods-info {
width: 100%;
}
.text .description {
font-size: 24rpx;
margin-top: 4rpx;
color: #B1B1B3;
}
.tips {
box-sizing: border-box;
height: 100rpx;
padding: 0 var(--margin);
border-radius: var(--borderRadius);
display: flex;
align-items: center;
justify-content: space-between;
font-size: 24rpx;
color: #666;
background-color: #fff;
}
.tips .price {
font-size: 36rpx;
color: var(--btnColor);
font-weight: 500;
}
.goods-action .left {
display: flex;
align-items: center;
justify-content: space-between;
width: calc(100% - 360rpx);
font-size: 24rpx;
}
.goods-action .left .total{
width: auto;
}
.discounts {
margin-top: 24rpx;
position:relative;
}
.discounts .selected {
height: 40rpx;
background: rgba(252, 91, 50, 0.12);
border-radius: 4rpx;
font-size: 24rpx;
font-weight: 500;
color: #8A303A;
line-height: 40rpx;
padding:0 20rpx;
position:absolute;
left:104rpx;
top: 50%;
transform: translate(0, -50%);
}
/*支付成功*/
.modal-container{
background: rgba(0,0,0,0.8000);
z-index: 9999;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.modal-body{
width: 83%;
height: 364rpx;
background: #FFFFFF;
border-radius: 16rpx;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.modal-body .icon{
width: 100rpx;
height: 100rpx;
margin-top: 48rpx;
}
.modal-body .text{
font-size: 32rpx;
font-weight: 500;
color: #2D2D2E;
margin-top: 24rpx;
}
.modal-body .btn{
position: absolute;
left: 0;
bottom: 0;
right: 0;
height: 1rpx;
border-top: 1rpx solid #e5e5e5;
height: 98rpx;
font-size: 32rpx;
font-weight: 500;
color: #8A303A;
}
.flex_ccc{
display: flex;
align-items: center;
justify-content: center;
}
\ No newline at end of file \ No newline at end of file
<view class="layout" style="padding-bottom:{{padding_bottom }}px">
<view class="box">
<block wx:if="{{addressFlag}}">
<block wx:if="{{shopFlag && shopCartFlag}}">
<view class="address-box" bindtap="jump">
<block wx:if="{{contactInfo.contactAddress}}">
<view class="left">
<view class="top">
<view class="name text-hide">{{contactInfo.contactName}}</view>
<block wx:if="{{isDefault}}">
<view class="default text-center">默认地址</view>
</block>
<view class="phone">{{contactInfo.contactPhone}}</view>
</view>
<view class="bottom text-hide">{{contactInfo.contactAddress}}</view>
</view>
</block>
<block wx:else>
选择收货地址
</block>
<view class="right text-center">
<view class="icon">
<glsx-image src="mine/mine-arrow.png"></glsx-image>
</view>
</view>
</view>
</block>
</block>
<view class="content-box">
<view class="merchantName text-hide">
{{merchantName}}
</view>
<block wx:for="{{goodsList}}" wx:key="index">
<view class="item">
<view class="content">
<view class="goods-info">
<view class="preview">
<image webp src="{{item.goodsImage}}"></image>
</view>
<view class="text">
<view class="name">
<view class="text-hide">
{{item.goodsName}}
</view>
<view class="text-hide description">{{item.specificationData || ''}}</view>
</view>
<view class="price-box">
<view class="price">
<text class="unit">¥</text>{{item.retailPrice}}
</view>
<view wx:if="{{!isPay}}">
x{{item.goodsNumber}}
</view>
<stepper wx:if="{{isPay}}" count="{{item.goodsNumber}}" max="{{item.stock}}" data-id="{{isActivity?item.goodsId:item.id}}" bindchange="changeCount" data-index="{{index}}"></stepper>
</view>
</view>
</view>
</view>
</view>
</block>
</view>
<block wx:if="{{expressFee != null}}">
<view class="tips" wx:if="{{shopFlag}}">
运费:
<view class="price">¥{{expressFee}}</view>
</view>
</block>
<block wx:if="{{!isActivity}}">
<block wx:if="{{orderCouponDTO}}">
<view class="tips discounts" bindtap="showCouponFun">
优惠:
<block wx:if="{{orderCouponDTO.isChecked}}">
<view class="selected">已选一张</view>
<view class="price">-¥{{(orderCouponDTO.denomination)/100}}</view>
</block>
<block wx:else>
<view>不使用优惠券</view>
</block>
</view>
</block>
</block>
</view>
</view>
<coupon-goods show="{{showCoupon}}" order="{{1}}" couponData="{{userCouponDTOS}}" bindclick="changeCoupon"></coupon-goods>
<block wx:if="{{addressFlag}}">
<goods-action bindready="goodsActionReady" custom>
<view class="goods-action">
<view class="left">
<view class="radio">
共{{goodsNumber}}件,合计:
</view>
<view class="total">
<view class="price">
<text class="unit">¥</text>{{money|| 0}}
</view>
</view>
</view>
<view class="btn text-center" bindtap="checkOut">结算({{goodsList.length}})</view>
</view>
</goods-action>
</block>
<!-- 支付成功 -->
<view wx:if="{{showSuccessModal}}" class="modal-container flex_ccc">
<view class="modal-body">
<view class="icon">
<glsx-image webp src="equity/return_success.png"></glsx-image>
</view>
<view class="text">支付成功</view>
<view class="btn flex_ccc" catch:tap="closeSuccessModal">我知道了</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {
"search-box": "/pages/tab/mall/components/SearchBox/SearchBox",
"goods": "/pages/tab/mall/components/Goods/Goods"
},
"navigationBarTitleText": "商城"
}
\ No newline at end of file \ No newline at end of file
/* packageMall/pages/search/search.wxss */
.box{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: var(--margin) 60rpx;
}
.goods{
width: 252rpx;
padding: 18rpx;
margin-bottom: 18rpx;
background-color: #fff;
}
\ No newline at end of file \ No newline at end of file
<view class="layout">
<view class="sticky">
<search-box bindsearch="search" search-type="2" value="{{value}}"></search-box>
</view>
<view class="box">
<block wx:if="{{flag}}">
<block wx:if="{{searchList.length}}">
<block wx:key="index" wx:for="{{searchList}}">
<view class="goods">
<goods item="{{item}}"></goods>
</view>
</block>
</block>
<block wx:else>
<view class="list-nothing ">
<view class="list-not">没找到相关商品</view>
</view>
</block>
</block>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// components/Stepper/Stepper.js
Component({
/**
* 组件的属性列表
*/
properties: {
count: Number,
min: {
type: Number,
value: 1
},
max: {
type: Number,
value: 99,
observer(n) {
if (n && this.data.count > n) {
this.setData({ count: n })
this.triggerEvent('change', Number(n))
}
}
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
input(e) {
let { value } = e.detail
let {
max,
} = this.data
if (value > max) value = max
this.setData({ count: value })
},
tap() { },
blur(e) {
let { value } = e.detail
let {
min,
} = this.data
if (value < min) value = min
this.setData({ count: value })
this.triggerEvent('change', Number(value))
},
change(e) {
let {
add
} = e.currentTarget.dataset
let num = add ? 1 : -1
let {
count,
min,
max
} = this.data
if (count == min && !add) return
if (count == max && add) return
count += num
this.triggerEvent('change', Number(count))
}
}
})
\ No newline at end of file \ No newline at end of file
<view class="stepper-box">
<view class="minus count-box text-center {{count == min?'opacity':''}}" catchtap="change"></view>
<input class="num count-box text-center" type="number" catchinput="input" value="{{count}}" catchblur="blur" catchtap="tap" />
<view class="add count-box text-center {{count == max?'opacity':''}}" catchtap="change" data-add>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* components/Stepper/Stepper.wxss */
@import "/assets/style/common.wxss";
.stepper-box {
display: flex;
align-items: center;
}
.stepper-box .count-box {
width: 52rpx;
height: 52rpx;
background: #F0F0F0;
margin-left: 7rpx;
font-size: 26rpx;
text-align: center;
color: #323233;
font-weight: normal;
position: relative;
}
.stepper-box .count-box.opacity::after ,.stepper-box .count-box.opacity::before{
opacity: .25;
}
.stepper-box .minus {
border-radius: 7rpx 0 0 7rpx;
background: transparent;
}
.stepper-box .num {
width: 59rpx;
}
.stepper-box .add {
border-radius: 0 7rpx 7rpx 0;
background: transparent;
}
.stepper-box .add::before,
.stepper-box .add::after,
.stepper-box .minus::after {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
content: '';
background-color: #2C2C2C;
border-radius: 2rpx;
}
.stepper-box .add::before,.stepper-box .minus::after {
width: 25rpx;
height: 2rpx;
}
.stepper-box .add::after{
width: 2rpx;
height: 25rpx;
}
\ No newline at end of file \ No newline at end of file
Page({
/**
* 页面的初始数据
*/
data: {
goodsList: [],
chooseIndex: null
},
goodsActionReady(e) {
this.setData({
padding_bottom: e.detail
})
},
jump() {
wx.p.router.switchTab('/pages/tab/mall/index')
},
changeCount(e) {
console.log(e)
let count = e.detail
let {
index,
item,
ind
} = e.currentTarget.dataset
if (item.goodsNumber == count) return
let {
chooseIndex
} = this.data
this.setData({
[`goodsList[${index}].list[${ind}].goodsNumber`]: count
})
if (chooseIndex == index) this.cheackAll(index)
wx.p.wxApi.showLoading('正在加载...')
let params = {
id: item.id,
goodsId: item.goodsId,
goodsNumber: count
}
if (item.specificationKey) params.specificationKey = item.specificationKey
wx.p.api.shopmallApi.updateShoppingcart(params).then(res => {
wx.hideLoading()
})
},
choose(e) {
let {
index,
ind
} = e.currentTarget.dataset
let {
goodsList,
chooseIndex
} = this.data
if (chooseIndex != null && chooseIndex != index) return
if (goodsList[index].list[ind].showDel) {
this.hide(e)
return
}
this.setData({
[`goodsList[${index}].list[${ind}].active`]: !goodsList[index].list[ind].active
})
this.cheackAll(index)
},
cheackAll(index) {
let count = 0
let sum = 0
let {
goodsList
} = this.data
let allActive = true
try {
goodsList[index].list.map(e => {
if (!e.active) throw false
})
} catch (error) {
allActive = error
}
goodsList[index].list.map(e => {
if (e.active) {
count += e.goodsNumber
sum += e.retailPrice * e.goodsNumber
}
})
this.setData({
[`goodsList[${index}].active`]: allActive,
count,
sum: sum == 0 ? 0 : Number(sum).toFixed(2),
chooseIndex: count == 0 ? null : index
})
},
chooseAll(e) {
let {
index
} = e.currentTarget.dataset
let {
goodsList,
chooseIndex
} = this.data
if (chooseIndex != null && chooseIndex != index) return
let all = true
try {
goodsList[index].list.map(i => {
if (!i.active) throw false
})
} catch (error) {
goodsList[index].list.map(i => (i.active = true))
all = error
}
if (all) goodsList[index].list.map(i => (i.active = false))
this.setData({
goodsList
})
this.cheackAll(index)
},
checkOut() {
let {
chooseIndex,
goodsList
} = this.data
let {
list,
payeeMerchantName,
} = goodsList[chooseIndex]
let data = []
list.map(e => (e.active ? data.push(e) : ''))
wx.p.router.go('/packageMall/pages/pay/pay', {
goodsList: data,
merchantName: payeeMerchantName
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getShoppingcartList()
},
getShoppingcartList() {
wx.p.wxApi.showLoading('加载中...')
let para = {
cartType: 1
}
wx.p.api.shopmallApi
.getShoppingcartList(para)
.then(data => {
data.map(e => {
e.list.map(i => (i.retailPrice = Number(i.retailPrice).toFixed(2)))
})
this.setData({
goodsList: data,
shoppingcartFlag: true,
count: 0,
sum: 0,
chooseIndex: null
})
wx.hideLoading()
})
.catch(() => {
this.setData({
shoppingcartFlag: true
})
})
},
del(e) {
wx.p.wxApi.showLoading('请稍后...')
let {
id
} = e.target.dataset
let para = {
cartType: 1,
id
}
wx.p.api.shopmallApi.delShoppingcart(para).then(res => {
wx.p.wxApi.showToast('删除成功')
// wx.$Track.setTrack({
// id,
// type: '购物车移除商品'
// },
// 7
// )
setTimeout(() => {
this.getShoppingcartList()
}, 1.5 * 1000)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
hide(e) {
let {
goodsList
} = this.data
let {
index,
ind
} = e.currentTarget.dataset
if (goodsList[index].list[ind].showDel)
this.setData({
[`goodsList[${index}].list[${ind}].showDel`]: false
})
},
start(e) {
let cell = e.changedTouches[0]
this.startX = cell.clientX
this.startY = cell.clientY
},
move(e) {
let {
startX,
startY
} = this
let {
index,
ind
} = e.currentTarget.dataset
let {
clientX,
clientY
} = e.changedTouches[0]
let X = clientX - startX
let Y = clientY - startY
let angle = (360 * Math.atan(Y / X)) / (2 * Math.PI)
let result = clientX < startX
if (Math.abs(angle) > 30) return
this.setData({
[`goodsList[${index}].list[${ind}].showDel`]: result
})
}
})
\ No newline at end of file \ No newline at end of file
{
"navigationBarTitleText": "购物车",
"usingComponents": {
"stepper": "./components/Stepper/Stepper"
}
}
\ No newline at end of file \ No newline at end of file
/* packageMall/pages/shoppingCart/shoppingCart.wxss */
.nothing-box {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
background-color: #fff;
}
.nothing {
padding-top: 140rpx;
text-align: center;
color: #B1B1B3;
}
.nothing .icon {
margin: 0 auto 8rpx;
width: 322rpx;
height: 320rpx;
}
.nothing .btn {
margin: 64rpx auto 0;
width: 332rpx;
height: 88rpx;
border-radius: 8rpx;
border: 2rpx solid #B1B1B3;
color: #656566;
font-size: 32rpx;
}
.box {
padding: 24rpx var(--margin);
}
.item-box {
margin-bottom: 24rpx;
background: #FFFFFF;
border-radius: 8rpx;
padding-left: 24rpx;
}
.item-box.disabled {
opacity: .5;
}
.item-box .top {
height: 80rpx;
display: flex;
align-items: center;
padding-right: 24rpx;
}
.item-box .top .icon {
margin-right: 18rpx;
}
.item-box .top .name {
width: calc(100% - 50rpx);
}
.item-box .list {
border-top: 2rpx solid #EFF0F2;
}
.box .item {
width: 100%;
height: 208rpx;
background: #FFFFFF;
border-radius: 8rpx;
margin-bottom: 24rpx;
overflow: hidden;
display: flex;
justify-content: space-between;
position: relative;
}
.box .item .content {
width: 100%;
padding-right: 24rpx;
box-sizing: border-box;
transition: all .5s;
transform: translateX(112rpx);
margin-left: -112rpx;
position: relative;
display: flex;
align-items: center;
}
.box .item .content .icon,
.box .item .content .goods-info .preview {
margin-right: 20rpx;
}
.box .item .content .goods-info {
width: calc(100% - 60rpx);
display: flex;
align-items: center;
}
.box .item .content .goods-info .preview {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
overflow: hidden;
}
.box .item .content .goods-info .text {
width: calc(100% - 180rpx);
height: 160rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.box .item .content .goods-info .text .price-box {
display: flex;
align-items: baseline;
justify-content: space-between;
}
.box .item .content .goods-info .text .price-box .price {
color: var(--btnColor);
font-size: 36rpx;
display: flex;
align-items: baseline;
font-weight: 500;
}
.box .item .content .goods-info .text .price-box .price .unit {
font-size: 24rpx;
}
.box .item .del {
width: 112rpx;
height: 100%;
background: var(--themeColor);
transform: translateX(112rpx);
transition: all .5s;
color: #fff;
}
.box .touch-move-active .content,
.box .touch-move-active .del {
transform: translateX(0);
}
.goods-action {
padding: 10rpx var(--margin);
box-sizing: border-box;
height: 100rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.goods-action .btn {
width: 332rpx;
height: 80rpx;
color: #FFFFFF;
background: var(--btnColor);
border-radius: var(--borderRadius);
font-weight: 500;
padding: 0 !important;
margin: 0 !important;
font-size: 28rpx;
&[disabled]:not([type]) {
background: #CCCED1 !important;
border-color: #CCCED1 !important;
color: #fff !important;
box-shadow: none;
}
}
.goods-action .total {
width: calc(100% - 360rpx);
font-size: 24rpx;
display: flex;
align-items: baseline;
}
.goods-action .total .price {
color: var(--btnColor);
font-size: 40rpx;
display: flex;
align-items: baseline;
font-weight: 500;
}
.goods-action .total .price .unit {
font-size: 24rpx;
}
.specification {
font-size: 24rpx;
color: #B1B1B3;
}
\ No newline at end of file \ No newline at end of file
<view class="layout" style="padding-bottom:{{padding_bottom }}px">
<block wx:if="{{shoppingcartFlag}}">
<block wx:if="{{!goodsList.length}}">
<view class="nothing-box">
<view class="nothing">
<view class="icon">
<glsx-image webp src="mall/shoppingcart.png" />
</view>
购物车还是空的
<view class="btn text-center" bindtap="jump">随便看看</view>
</view>
</view>
</block>
<block wx:else>
<view class="box">
<block wx:for="{{goodsList}}" wx:key="index">
<view class="item-box {{chooseIndex != null && chooseIndex != index?'disabled':''}}">
<view class="top" catchtap="chooseAll" data-index="{{index}}" >
<view class="icon text-center">
<icon type="{{item.active?'success':'circle'}}" color="{{item.active?'#8A303A':'#B1B1B3'}}" size="20">
</icon>
</view>
<view class="name text-hide">
{{item.payeeMerchantName}}
</view>
</view>
<view class="list">
<block wx:for="{{item.list}}" wx:for-item="i" wx:for-index="ind" wx:key="ind">
<view class="item {{i.showDel?'touch-move-active':''}}" data-index="{{index}}" data-ind="{{ind}}"
bindtouchstart="start" bindtouchmove="move">
<view class="content" catchtap="choose" data-index="{{index}}" data-ind="{{ind}}">
<view class="icon">
<icon type="{{i.active?'success':'circle'}}" color="{{i.active?'#8A303A':'#B1B1B3'}}" size="20">
</icon>
</view>
<view class="goods-info">
<view class="preview">
<image webp src="{{i.goodsImage}}"></image>
</view>
<view class="text">
<view class="text-hide">{{i.goodsName}}</view>
<view class="specification" wx:if="{{i.specificationData}}">{{i.specificationData}}</view>
<view class="price-box">
<view class="price">
<text class="unit">¥</text>{{i.retailPrice || 0}}
</view>
<stepper count="{{i.goodsNumber}}" max="{{i.goodsStock}}" catchchange="changeCount"
data-index="{{index}}" data-ind="{{ind}}" data-item="{{i}}"></stepper>
</view>
</view>
</view>
</view>
<view class="del text-center" catchtap="del" data-id="{{i.id}}">删除</view>
</view>
</block>
</view>
</view>
</block>
</view>
</block>
</block>
</view>
<block wx:if="{{goodsList.length}}">
<goods-action bindready="goodsActionReady" custom>
<view class="goods-action">
<view class="total">合计:
<view class="price">
<text class="unit">¥</text>{{sum||0}}
</view>
</view>
<button class="btn text-center" bindtap="checkOut" disabled="{{count<1}}">结算({{count||0}})</button>
</view>
</goods-action>
</block>
\ No newline at end of file \ No newline at end of file
// packageMine/pages/order/afterSaleDetail/afterSaleDetail.js import {
RefundStatus,
ExpressList,
AfterSaleObj,
AddressInfo,
} from "~/constants/mine.js";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
refundStatus: {
1: '待处理',
2: '待发货',
3: '待确认收到退货',
4: '退款中',
5: '已退款',
6: '退款失败',
7: '审核不通过'
},
// 退款状态1:待处理,2待发货,3待确认收到退货,4:退款中,5:已退款,6:退款失败,7:审核不通过 // 退款状态1:待处理,2待发货,3待确认收到退货,4:退款中,5:已退款,6:退款失败,7:审核不通过
afterSaleObj: [ afterSaleObj: Object.freeze(AfterSaleObj),
{ address: Object.freeze(AddressInfo),
title: '售后类型', addressObject: {
key: 'refundType', name: "张三",
enum: { phone: "12345678901",
1: '我要退款退货', address: "广东省深圳市南山区",
2: '我要退款(无需退货)' },
} expressList: Object.freeze(ExpressList),
}, // Mock数据用于页面展示
{ orderInfo: {
title: '售后商品', refundStatus: 1, // 1:待处理
isArray: true, orderClassify: 1,
key: 'goodsNames' orderSource: 5,
}, orderStatus: 9,
{ activityBigImg: "https://picsum.photos/200/200",
title: '申请金额', activityName: "洗车服务券",
key: 'refundPrice' orderGoods: [
}, {
{ id: "106",
title: '申请时间', goodsImage: "https://picsum.photos/200/200",
key: 'time' goodsName: "洗车服务券",
}, specificationData: "1次洗车服务",
{ retailPrice: "299",
title: '申请描述', activityPrice: null,
key: 'remark' goodsNumber: 1,
}, warrantyDate: "2024-09-01 11:30:00",
{ },
title: '订单编号', ],
key: 'orderCode' refundType: 1, // 1:我要退款退货
} goodsName: ["商品名称1", "商品名称2"],
] refundPrice: "1000积分",
time: "2023-05-20 12:00:00",
remark: "商品质量有问题,申请退款退货",
orderCode: "2023052012000001",
deliveryCompany: "顺丰快递",
goodsNumber: 1,
deliveryNumber: "SF1234567890",
imgUrls: [
"https://picsum.photos/200/200",
"https://picsum.photos/200/200",
"https://picsum.photos/200/200",
],
createdDate: "2023-05-20T12:00:00",
},
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.getOrderRefundDetail(options.orderCode) // this.getOrderRefundDetail(options.orderCode)
this.setData({
refund: RefundStatus.find(
(item) => item.status == this.data.orderInfo.refundStatus
),
});
},
showExpressSelector() {
this.setData({
isShowExpressSelector: true,
});
},
selectExpress(e) {
this.setData({
isShowExpressSelector: false,
});
const expressList = this.data.expressList.map((item) => {
if (item.value == e.detail.value) {
item.type = "warn";
this.setData({
express: item,
});
} else {
item.type = "";
}
return item;
});
this.setData({
expressList,
});
}, },
getOrderRefundDetail(orderCode) { getOrderRefundDetail(orderCode) {
wx.p.wxApi.showLoading('加载中...') wx.p.wxApi.showLoading("加载中...");
wx.p.api.shopmallApi.getOrderRefundDetail(orderCode).then(data => { wx.p.api.shopmallApi.getOrderRefundDetail(orderCode).then((data) => {
wx.hideLoading() wx.hideLoading();
console.log(data)
if (data.refundStatus == 2 && data.refundType == 1) { if (data.refundStatus == 2 && data.refundType == 1) {
wx.p.router.redirectTo('/packageMine/pages/order/afterSale_step_three/afterSale_step_three', data) wx.p.router.redirectTo(
return "/packageMine/pages/order/afterSale_step_three/afterSale_step_three",
data
);
return;
} }
data.time = new Date(data.createdDate).format('yyyy-MM-dd hh:mm:ss') data.time = new Date(data.createdDate).format("yyyy-MM-dd hh:mm:ss");
this.setData({ this.setData({
orderInfo: data orderInfo: data,
}) });
}) });
}, },
confirm() { confirm() {
let { orderInfo } = this.data let { orderInfo } = this.data;
console.log(orderInfo) console.log(orderInfo);
wx.p.router.go('/packageMine/pages/order/afterSale_step_two/afterSale_step_two', orderInfo) wx.p.router.go(
"/packageMine/pages/order/afterSale_step_two/afterSale_step_two",
orderInfo
);
}, },
previewImage(e) { previewImage(e) {
let params = e.currentTarget.dataset let params = e.currentTarget.dataset;
wx.p.wxApi.previewImage(params) wx.p.wxApi.previewImage(params);
}, },
/** });
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {}
})
{ {
"navigationBarTitleText": "售后详情" "navigationBarTitleText": "售后详情",
"usingComponents": {
"content": "../index/components/Content/Content",
"mp-icon": "weui-miniprogram/icon/icon",
"mp-actionSheet": "weui-miniprogram/actionsheet/actionsheet"
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -3,47 +3,154 @@ ...@@ -3,47 +3,154 @@
} }
.status-box { .status-box {
text-align: center; display: flex;
justify-content: flex-start;
align-items: center;
gap: 24rpx;
.icon {
width: 80rpx;
height: 80rpx;
}
.box-info {
.title {
font-size: 40rpx;
font-weight: 500;
color: #282829;
}
.tips {
font-size: 28rpx;
font-weight: 400;
color: #656566;
}
}
margin-bottom: 32rpx;
} }
.status-box .icon { .box {
margin: 80rpx auto 84rpx; border-radius: 16rpx;
width: 140rpx; background-color: #fff;
height: 140rpx; }
.mb {
margin-bottom: 24rpx;
} }
.status-box .title { // .section {
// font-size: 32rpx;
// font-weight: 400;
// color: #323233;
// height: 104rpx;
// line-height: 104rpx;
// text-align: center;
// &.active {
// color: var(--btnColor);
// background: #fff9f5;
// }
// }
font-size: 40rpx; .weui-actionsheet__title-text {
font-size: 32rpx;
color: #323233;
font-weight: 500; font-weight: 500;
} }
.weui-actionsheet__cell {
.status-box .tips { &::before {
margin: 20rpx 0 59rpx; display: none;
color: #656566; }
} }
.weui-actionsheet__cell_warn {
.box { color: var(--btnColor);
background: #fff9f5;
border-radius: 8rpx;
background-color: #fff;
} }
.text-box { .text-box {
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
border-bottom: 2rpx solid #EFF0F2; border-bottom: 2rpx solid #eff0f2;
.title {
font-weight: 600;
font-size: 32rpx;
color: #282829;
}
.form {
margin-top: 24rpx;
background: #f7f8fa;
border-radius: 12rpx;
padding: 0 32rpx;
.item {
height: 104rpx;
line-height: 104rpx;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 0;
.label {
margin-right: 12rpx;
font-size: 28rpx;
color: #282829;
}
&:first-child {
border-bottom: 2rpx solid #eff0f2;
}
}
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16rpx;
.copy {
background: #e8e8ea;
border-radius: 18rpx;
font-weight: 400;
font-size: 22rpx;
color: #707071;
padding: 4rpx 18rpx;
}
}
.btn-box{
display: flex;
justify-content: center;
align-items: center;
margin-top: 24rpx;
.btn {
display: flex;
align-items: center;
justify-content: center;
width: 336rpx;
height: 80rpx;
border-radius: 20rpx;
border: 2rpx solid #dcdfe6;
font-size: 24rpx;
}
.submit-btn {
border-color: var(--btnColor);
color: var(--btnColor);
font-weight: 500;
}
}
} }
.text-box .item{ .text-box .item {
margin-bottom: 12rpx; margin-bottom: 12rpx;
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
} }
.text-box .item .label{ .text-box .item .label {
width: 140rpx; width: 140rpx;
} }
.text-box .item .value{ .text-box .item .value {
color: #656566; color: #656566;
width: calc(100% - 150rpx); width: calc(100% - 150rpx);
.arrow {
margin-left: 16rpx;
width: 20rpx;
height: 20rpx;
transform: translateY(1rpx);
}
&.icon {
display: flex;
align-items: center;
justify-content: space-between;
}
} }
.photo-box { .photo-box {
...@@ -55,6 +162,6 @@ ...@@ -55,6 +162,6 @@
.photo-box .item { .photo-box .item {
width: 200rpx; width: 200rpx;
height: 200rpx; height: 200rpx;
background: #D8D8D8; background: #d8d8d8;
margin: 0 20rpx 20rpx 0; margin: 0 20rpx 20rpx 0;
}
\ No newline at end of file \ No newline at end of file
}
...@@ -3,55 +3,66 @@ ...@@ -3,55 +3,66 @@
<view class="status-box"> <view class="status-box">
<!-- 退款状态1:待处理,2待发货,3待确认收到退货,4:退款中,5:已退款,6:退款失败,7:审核不通过 --> <!-- 退款状态1:待处理,2待发货,3待确认收到退货,4:退款中,5:已退款,6:退款失败,7:审核不通过 -->
<view class="icon"> <view class="icon">
<block wx:if="{{orderInfo.refundStatus == 5}}"> <glsx-image webp src="{{refund.image}}"></glsx-image>
<glsx-image webp src="mine/order/success.png"></glsx-image> </view>
</block> <view class="box-info">
<block wx:elif="{{orderInfo.refundStatus <5}}"> <view class="title">{{refund.title}}</view>
<glsx-image webp src="mine/order/wait.png"></glsx-image> <view class="tips">{{refund.tips}}</view>
</block>
<block wx:else>
<glsx-image webp src="mine/order/error.png"></glsx-image>
</block>
</view> </view>
<view class="title">{{refundStatus[orderInfo.refundStatus]}}</view> </view>
<view class="tips"> <view class="box mb">
<block wx:if="{{orderInfo.refundStatus == 5}}"> <view class="text-box">
钱款将原路退回至您的账户 <view class="header">
<view class="title">商品寄回地址</view>
<view class="copy">复制</view>
</view>
<block wx:for="{{address}}" wx:key="index">
<view class="item">
<view class="label">{{item.title}}:</view>
<view class="value">
<view>{{addressObject[item.key]}}</view>
</view>
</view>
</block> </block>
<block wx:elif="{{orderInfo.refundStatus > 5 }}">退款不成功,您可以再次提交退款申请重试</block> <view class="title">请填写退货物流</view>
<block wx:else>等待平台处理</block> <view class="form">
<view class="item">
<view class="label">物流公司:</view>
<view class="value icon" bindtap="showExpressSelector">
<view>{{express.text||'请选择'}}</view>
<mp-icon icon="arrow" color="#B1B1B3" size="12"></mp-icon>
</view>
</view>
<view class="item">
<view class="label">快递单号:</view>
<view class="value">
<input type="text" value="{{order.express_no}}" placeholder="请输入" placeholder-style="color: #999999;" />
</view>
</view>
</view>
<view class="btn-box">
<view class="btn submit-btn" data-order-code="{{item.orderCode}}">提交物流</view>
</view>
</view> </view>
</view> </view>
<view class="box"> <view class="box">
<view class="text-box"> <view class="text-box">
<view class="title">售后信息</view>
<content item="{{orderInfo}}" />
<block wx:for="{{afterSaleObj}}" wx:key="index"> <block wx:for="{{afterSaleObj}}" wx:key="index">
<view class="item"> <view class="item">
<view class="label">{{item.title}}:</view> <view class="label">{{item.title}}:</view>
<view class="value"> <view class="value">
<block wx:if="{{item.enum}}"> <block wx:if="{{item.enum}}">{{item.enum[orderInfo[item.key]]}}</block>
{{item.enum[orderInfo[item.key]]}}
</block>
<block wx:elif="{{item.isArray}}"> <block wx:elif="{{item.isArray}}">
<block wx:for="{{orderInfo[item.key]}}" wx:key="index" wx:for-item="i"> <block wx:for="{{orderInfo[item.key]}}" wx:key="index" wx:for-item="i">
<text>{{i}};</text> <text>{{i}};</text>
</block> </block>
</block> </block>
<block wx:else> <block wx:else>{{orderInfo[item.key] || ''}}</block>
{{orderInfo[item.key] || ''}}
</block>
</view> </view>
</view> </view>
</block> </block>
<block wx:if="{{orderInfo.deliveryCompany}}">
<view class="item">
<view class="label">快递公司:</view>
<view class="value">{{orderInfo.deliveryCompany}}</view>
</view>
<view class="item">
<view class="label">快递单号:</view>
<view class="value">{{orderInfo.deliveryNumber}}</view>
</view>
</block>
</view> </view>
<block wx:if="{{orderInfo.imgUrls && orderInfo.imgUrls.length}}"> <block wx:if="{{orderInfo.imgUrls && orderInfo.imgUrls.length}}">
<view class="photo-box"> <view class="photo-box">
...@@ -66,5 +77,12 @@ ...@@ -66,5 +77,12 @@
<block wx:if="{{orderInfo.refundStatus >5}}"> <block wx:if="{{orderInfo.refundStatus >5}}">
<view class="default-btn" bindtap="confirm">重新提交</view> <view class="default-btn" bindtap="confirm">重新提交</view>
</block> </block>
</view> </view>
<!-- <popup show="{{showPopup}}" title="选择快递公司" bindconfirm="confirmPopup">
<view wx:for="{{expressList}}" wx:key="index" bindtap="selectExpress" data-item="{{item}}" class="section {{item.id==express.id?'active':''}}">
{{item.name}}
</view>
</popup> -->
<mp-actionSheet bindactiontap="selectExpress" show="{{isShowExpressSelector}}" actions="{{expressList}}" title="选择快递公司" >
</mp-actionSheet>
</block> </block>
\ No newline at end of file \ No newline at end of file
import { afterSaleMixin } from "~/mixins/index"; import { afterSaleMixin } from "~/mixins/index";
import { RefundReason } from "~/constants/mine.js"; import { RefundReason } from "~/constants/mine.js";
console.log("🚀 ~ RefundReason:", RefundReason)
Page({ Page({
behaviors: [afterSaleMixin], behaviors: [afterSaleMixin],
...@@ -45,9 +44,14 @@ Page({ ...@@ -45,9 +44,14 @@ Page({
}); });
}, },
changeRefundCount(e) { changeRefundCount(e) {
console.log("🚀 ~ changeRefundCount ~ e:", e);
this.setData({ this.setData({
"orderObj.refundCount": e.detail, "orderObj.refundCount": e.detail
});
},
radioChange(e){
this.setData({
"orderObj.reason": e.detail.value,
refundReason:RefundReason.find(item => item.value == e.detail.value).text
}); });
}, },
noScroll() {}, noScroll() {},
...@@ -107,7 +111,7 @@ Page({ ...@@ -107,7 +111,7 @@ Page({
}); });
}); });
}, },
confirm() { submit() {
let { orderObj, imgUrls } = this.data; let { orderObj, imgUrls } = this.data;
orderObj.imgUrls = imgUrls; orderObj.imgUrls = imgUrls;
console.log(orderObj); console.log(orderObj);
......
...@@ -10,6 +10,26 @@ ...@@ -10,6 +10,26 @@
color: #1b233d; color: #1b233d;
} }
.page-section {
max-height: calc(100%);
overflow: hidden;
overflow-y: scroll;
.weui-cell {
height: 88rpx;
line-height: 88rpx;
font-size: 28rpx;
color: #333435;
box-sizing: border-box;
.weui-cell__hd {
margin-left: 10rpx;
margin-right: 20rpx;
}
&::before {
display: none;
}
}
}
.box { .box {
background: #ffffff; background: #ffffff;
border-radius: 8rpx; border-radius: 8rpx;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<view class="box-item"> <view class="box-item">
<text class="box-item-title">退款原因</text> <text class="box-item-title">退款原因</text>
<view class="box-item-value" bindtap="showPopup"> <view class="box-item-value" bindtap="showPopup">
请选择 {{refundReason||'请选择'}}
<view class="arrow"> <view class="arrow">
<glsx-image webp src="mine/mine-arrow.png"></glsx-image> <glsx-image webp src="mine/mine-arrow.png"></glsx-image>
</view> </view>
...@@ -62,14 +62,14 @@ ...@@ -62,14 +62,14 @@
</block> </block>
</block> </block>
</view> </view>
<view class="btn text-center" bindtap="confirm">提交</view> <view class="btn text-center" bindtap="submit">提交</view>
</view> </view>
<popup show="{{showPopup}}" only="{{false}}" title="请选择退款原因" bindconfirm="confirmPopup"> <popup show="{{showPopup}}" only="{{false}}" title="请选择退款原因" bindconfirm="confirmPopup">
<view class="page-section"> <view class="page-section">
<radio-group bindchange="radioChange"> <radio-group bindchange="radioChange">
<label class="weui-cell weui-check__label" wx:for="{{RefundReason}}" wx:key="{{item.value}}"> <label class="weui-cell weui-check__label" wx:for="{{RefundReason}}" wx:key="{{item.value}}">
<view class="weui-cell__hd"> <view class="weui-cell__hd">
<radio value="{{item.value}}" checked="true" /> <radio value="{{item.value}}" checked="true" color="#FC8A32" />
</view> </view>
<view class="weui-cell__bd">{{item.text}}</view> <view class="weui-cell__bd">{{item.text}}</view>
</label> </label>
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</view> </view>
</view> </view>
<!-- !hasUserInfo --> <!-- !hasUserInfo -->
<view wx:if="{{item.orderGoods.length > 1 && !hasUserInfo}}"> <!-- <view wx:if="{{item.orderGoods.length > 1 && !hasUserInfo}}">
<block wx:if="{{item.orderStatus == 5 || item.orderStatus == 8}}"> <block wx:if="{{item.orderStatus == 5 || item.orderStatus == 8}}">
<block wx:if="{{item.evaluatedFlag == 'Y'}}"> <block wx:if="{{item.evaluatedFlag == 'Y'}}">
<view class="btn confirm" catchtap="onLookEvaluate" data-item="{{item}}">查看评价</view> <view class="btn confirm" catchtap="onLookEvaluate" data-item="{{item}}">查看评价</view>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<view class="btn confirm" catchtap="onEvaluate" wx:else data-item="{{item}}">立即评价</view> <view class="btn confirm" catchtap="onEvaluate" wx:else data-item="{{item}}">立即评价</view>
</block> </block>
</block> </block>
</view> </view> -->
</view> </view>
</view> </view>
</block> </block>
......
// packageMine/pages/order/index/components/orderActionButtons.js // packageMine/pages/order/index/components/orderActionButtons.js
// 定义枚举常量
const OrderStatus = {
PENDING_PAYMENT: 1, // 待付款
PROCESSING: 2, // 处理中
SHIPPED: 3, // 已发货
DELIVERED: 4, // 已送达
COMPLETED: 5, // 已完成
CANCELLED: 6, // 已取消
REFUNDED: 7, // 已退款
CLOSED: 8, // 已关闭
AFTER_SALE: 9, // 售后中
};
const OrderSource = {
SPECIAL: 5, // 特殊订单(如金币兑换)
};
const AfterSaleStatus = {
PROCESSING: 1, // 售后处理中
};
const DeliveryType = {
EXPRESS: 2, // 快递发货
};
const CouponStatus = {
USED: 2, // 已使用
EXPIRED: 3, // 已过期
};
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -7,25 +38,237 @@ Component({ ...@@ -7,25 +38,237 @@ Component({
item: { item: {
type: Object, type: Object,
value: {}, value: {},
observer: function () {
// 当item变化时重新计算按钮
this.updateButtons();
},
}, },
hasUserInfo: { hasUserInfo: {
type: Boolean, type: Boolean,
value: false, value: false,
observer: function () {
// 当hasUserInfo变化时重新计算按钮
this.updateButtons();
},
}, },
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: {}, data: {
buttons: [],
orderItem: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
// 获取当前订单应该显示的按钮
getButtons() {
const { item, hasUserInfo } = this.data;
// 待付款状态按钮策略
if (item.orderStatus == OrderStatus.PENDING_PAYMENT) {
const buttons = [
{
text: "取消付款",
type: "cancelPay",
class: "btn pay",
handler: this.onCancelPay.bind(this),
},
];
if (item.orderSource != 4) {
buttons.push({
text: "去支付",
type: "pay",
class: "btn pay",
handler: this.onPay.bind(this),
});
}
return buttons;
}
// 特殊订单查看详情策略
if (
item.orderSource == OrderSource.SPECIAL &&
(item.orderStatus == OrderStatus.PROCESSING ||
item.orderStatus == OrderStatus.REFUNDED)
) {
return [
{
text: "查看详情",
type: "viewDetail",
class: "btn pay",
handler: this.onToGoldDetail.bind(this),
},
];
}
// 售后中订单按钮策略
if (item.afterSaleStatus) {
const buttons = [];
if (item.afterSaleStatus == AfterSaleStatus.PROCESSING) {
buttons.push({
text: "取消售后",
type: "cancelOrder",
class: "btn pay",
handler: this.onCancelOrder.bind(this),
});
}
buttons.push({
text: "售后详情",
type: "afterSaleDetail",
class: "btn",
handler: this.onAfterSaleDetail.bind(this),
});
return buttons;
}
// 进行中订单按钮策略
if (
item.orderStatus > OrderStatus.PENDING_PAYMENT &&
item.orderStatus < OrderStatus.AFTER_SALE
) {
const buttons = [];
// 售后按钮
if (
item.payPrice > 0 &&
item.orderSource != 4 &&
!(
item.relatedUserCouponStatus == CouponStatus.USED ||
item.relatedUserCouponStatus == CouponStatus.EXPIRED
)
) {
buttons.push({
text: "售后",
type: "afterSale",
class: "btn",
handler: this.onAfterSale.bind(this),
});
}
// 确认收货按钮
if (
item.deliveryType == DeliveryType.EXPRESS &&
item.orderStatus == OrderStatus.SHIPPED
) {
buttons.push({
text: "确认收货",
type: "confirmReceipt",
class: "btn confirm",
handler: this.onConfirmReceipt.bind(this),
});
}
// 待评价订单
if (
item.orderGoods.length == 1 &&
!hasUserInfo &&
(item.orderStatus == OrderStatus.COMPLETED ||
item.orderStatus == OrderStatus.CLOSED)
) {
if (item.evaluatedFlag == "Y") {
buttons.push({
text: "查看评价",
type: "viewEvaluate",
class: "btn confirm",
handler: this.onLookEvaluate.bind(this),
});
} else {
if (!hasUserInfo) {
buttons.push({
text: "立即评价",
type: "getUserProfile",
class: "btn confirm userProfile",
handler: this.onGetUserProfile.bind(this),
});
} else {
buttons.push({
text: "立即评价",
type: "evaluate",
class: "btn confirm",
handler: this.onEvaluate.bind(this),
});
}
}
}
return buttons;
}
// 待评价订单(独立情况)
if (
item.orderGoods.length == 1 &&
!hasUserInfo &&
(item.orderStatus == OrderStatus.COMPLETED ||
item.orderStatus == OrderStatus.CLOSED)
) {
if (item.evaluatedFlag == "Y") {
return [
{
text: "查看评价",
type: "viewEvaluate",
class: "btn confirm",
handler: this.onLookEvaluate.bind(this),
},
];
} else {
if (!hasUserInfo) {
return [
{
text: "立即评价",
type: "getUserProfile",
class: "btn confirm userProfile",
handler: this.onGetUserProfile.bind(this),
},
];
} else {
return [
{
text: "立即评价",
type: "evaluate",
class: "btn confirm",
handler: this.onEvaluate.bind(this),
},
];
}
}
}
// 默认返回空数组
return [];
},
// 更新按钮
updateButtons() {
const buttons = this.getButtons();
this.setData({
buttons,
orderItem: this.data.item,
});
},
// 按钮点击事件处理
onButtonClick(e) {
const { index } = e.currentTarget.dataset;
const button = this.data.buttons[index];
if (button && button.handler) {
button.handler(e);
}
},
// 取消付款 // 取消付款
onCancelPay(e) { onCancelPay(e) {
let { orderCode } = e.currentTarget.dataset; let { orderCode } =
e.currentTarget.dataset.item || e.currentTarget.dataset;
wx.showModal({ wx.showModal({
title: "温馨提示", title: "温馨提示",
content: "请问您是否要取消付款", content: "请问您是否要取消付款",
...@@ -55,7 +298,7 @@ Component({ ...@@ -55,7 +298,7 @@ Component({
let _this = this; let _this = this;
wx.p.wxApi.showLoading("结算中..."); wx.p.wxApi.showLoading("结算中...");
wx.p.api.shopmallApi wx.p.api.shopmallApi
.payOrder(e.currentTarget.dataset) .payOrder(e.currentTarget.dataset.item || e.currentTarget.dataset)
.then(({ needPay, payParams }) => { .then(({ needPay, payParams }) => {
wx.hideLoading(); wx.hideLoading();
if (needPay) { if (needPay) {
...@@ -101,21 +344,22 @@ Component({ ...@@ -101,21 +344,22 @@ Component({
// 售后 // 售后
onAfterSale(e) { onAfterSale(e) {
let { let {
item: { orderCode, payPrice,goodsNumber }, item: { orderCode, payPrice, goodsNumber },
} = e.currentTarget.dataset; } = e.currentTarget.dataset;
wx.p.router.go( wx.p.router.go(
"/packageMine/pages/order/afterSale_step_two/afterSale_step_two", "/packageMine/pages/order/afterSale_step_two/afterSale_step_two",
{ {
orderCode, orderCode,
refundPrice: payPrice, refundPrice: payPrice,
refundCount:goodsNumber refundCount: goodsNumber,
} }
); );
}, },
// 确认收货 // 确认收货
onConfirmReceipt(e) { onConfirmReceipt(e) {
let { orderCode } = e.currentTarget.dataset; let { orderCode } =
e.currentTarget.dataset.item || e.currentTarget.dataset;
wx.showModal({ wx.showModal({
title: "温馨提示", title: "温馨提示",
content: "是否确认收货", content: "是否确认收货",
...@@ -165,7 +409,8 @@ Component({ ...@@ -165,7 +409,8 @@ Component({
// 取消订单 // 取消订单
onCancelOrder(e) { onCancelOrder(e) {
let { orderCode } = e.currentTarget.dataset; let { orderCode } =
e.currentTarget.dataset.item || e.currentTarget.dataset;
wx.showModal({ wx.showModal({
title: "温馨提示", title: "温馨提示",
content: "请问您是否要取消售后", content: "请问您是否要取消售后",
...@@ -201,4 +446,11 @@ Component({ ...@@ -201,4 +446,11 @@ Component({
}); });
}, },
}, },
lifetimes: {
attached() {
// 组件实例进入页面节点树时执行
this.updateButtons();
},
},
}); });
<!-- 订单操作按钮组件 --> <!-- 订单操作按钮组件 -->
<view class="btn-box"> <view class="btn-box">
<block wx:if="{{!item.afterSaleStatus}}"> <block wx:for="{{buttons}}" wx:key="index">
<block wx:if="{{item.orderStatus == 1}}"> <block wx:if="{{item.type === 'getUserProfile'}}">
<view class="btn pay" catchtap="onCancelPay" data-order-code="{{item.orderCode}}">取消付款</view> <button catchtap="onGetUserProfile" class="{{item.class}}" data-item="{{orderItem}}">{{item.text}}</button>
<block wx:if="{{item.orderSource != 4}}">
<view class="btn pay" catchtap="onPay" data-order-code="{{item.orderCode}}">去支付</view>
</block>
</block> </block>
<block wx:if="{{item.orderSource==5 && (item.orderStatus == 2 || item.orderStatus == 7)}}"> <block wx:else>
<view class="btn pay" data-item="{{item}}" bind:tap="onToGoldDetail">查看详情</view> <view class="{{item.class}}" catchtap="onButtonClick" data-index="{{index}}" data-item="{{orderItem}}">{{item.text}}</view>
</block> </block>
<block wx:elif="{{item.orderStatus > 2 && item.orderStatus < 9}}">
<!-- deliveryType 结算方式(1:到店核销,2:快递发货) -->
<block wx:if="{{item.payPrice > 0 && item.orderSource != 4}}">
<view class="btn" catchtap="onAfterSale" data-item="{{item}}" wx:if="{{!(item.relatedUserCouponStatus == 2 || item.relatedUserCouponStatus == 3)}}">售后</view>
</block>
<block wx:if="{{item.deliveryType == 2 && item.orderStatus == 4}}">
<view class="btn confirm" catchtap="onConfirmReceipt" data-order-code="{{item.orderCode}}">确认收货</view>
</block>
</block>
<!-- !hasUserInfo -->
<view wx:if="{{item.orderGoods.length == 1 && !hasUserInfo}}">
<block wx:if="{{item.orderStatus == 5 || item.orderStatus == 8}}">
<block wx:if="{{item.evaluatedFlag == 'Y'}}">
<view class="btn confirm" catchtap="onLookEvaluate" data-item="{{item}}">查看评价</view>
</block>
<block wx:else>
<button catchtap="onGetUserProfile" wx:if="{{!hasUserInfo}}" class="btn confirm userProfile" data-item="{{item}}"> 立即评价 </button>
<view class="btn confirm" catchtap="onEvaluate" wx:else data-item="{{item}}">立即评价</view>
</block>
</block>
</view>
</block>
<block wx:else>
<block wx:if="{{item.afterSaleStatus == 1}}">
<view class="btn pay" catchtap="onCancelOrder" data-order-code="{{item.orderCode}}">取消售后</view>
</block>
<view class="btn" data-item="{{item}}" catchtap="onAfterSaleDetail">售后详情</view>
</block> </block>
</view> </view>
\ No newline at end of file \ No newline at end of file
<view class="item" catchtap="onJump" data-item="{{item}}"> <view class="item" catchtap="onJump" data-item="{{item}}">
<top item="{{item}}" after-sale-status="{{afterSaleStatus}}" status-enum="{{statusEnum}}"></top> <top item="{{item}}" after-sale-status="{{afterSaleStatus}}" status-enum="{{statusEnum}}"></top>
<content item="{{item}}" has-user-info="{{hasUserInfo}}" bind:lookEvaluate="onLookEvaluate" bind:getUserProfile="onGetUserProfile" bind:evaluate="onEvaluate"></content> <content item="{{item}}"></content>
<bottom item="{{item}}" /> <bottom item="{{item}}" />
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,10 @@ Page({ ...@@ -8,7 +8,10 @@ Page({
isAgree: false, isAgree: false,
mobile: '', mobile: '',
captcha: '', captcha: '',
count: 0 count: 0,
showChooseSource: false,
showEnableWallet: false,
showEnableSuccess: false
}, },
changeLoginType() { changeLoginType() {
const { const {
...@@ -173,6 +176,26 @@ Page({ ...@@ -173,6 +176,26 @@ Page({
}) })
}, },
// 选择积分来源
pointSourceEvent() {
},
// 关闭开通积分钱包弹窗
closeWallet() {
this.setData({ showEnableWallet: false })
},
// 一键开通积分钱包
enableWalletConfirm() {
},
// 开通成功
successConfirm() {
},
back() { back() {
wx.p.router.back() wx.p.router.back()
} }
......
{ {
"usingComponents": {}, "usingComponents": {
"points-source": "./components/PointsSource/PointsSource",
"enable-wallet": "./components/EnableWallet/EnableWallet",
"enable-success": "./components/EnableSuccess/EnableSuccess"
},
"navigationStyle": "custom" "navigationStyle": "custom"
} }
\ No newline at end of file \ No newline at end of file
<view class="layout"> <view class="layout">
<view class="login-bg x-center"> <view class="bg-top">
<glsx-image src="login/login-bg.png"></glsx-image> <glsx-image src="login/login-bg.png"></glsx-image>
</view> </view>
<navigation-bar navStyle="background:transparent;" custom page-title="登录"> <navigation-bar navStyle="background:transparent;" showBack page-title="登录"><text class="page-title">登录</text></navigation-bar>
<view class="nav-bar flex">
<view class="back flex" bindtap="back">
<view class="icon">
<glsx-image src="login/login-back.png"></glsx-image>
</view>
</view>
登录
</view>
</navigation-bar>
<view class="content" style="margin-top: {{navHeight}}px;"> <view class="content" style="margin-top: {{navHeight}}px;">
<block wx:if="{{loginType==0}}"> <block wx:if="{{loginType==0}}">
<view class="h1"> <view class="h1">您好</view>
欢迎使用 <view class="h2">
<view class="logo"> 欢迎使用积分商城小程序
<glsx-image src="login/logo.png"></glsx-image> </view>
</view> <view class="login-img">
<glsx-image src="login/login-img.png"></glsx-image>
</view> </view>
<view class="wx-box"> <view class="wx-box">
<block wx:if="{{!isAgree}}"> <block wx:if="{{!isAgree}}">
<button class="wx-auth-button text-center {{isAgree}}" bindtap="showTips">登录</button> <button class="wx-auth-button text-center {{isAgree}}" bindtap="showTips">微信登录</button>
</block> </block>
<block wx:else> <block wx:else>
<button open-type="getPhoneNumber" catchgetphonenumber="getPhoneNumber" class="wx-auth-button text-center">登录</button> <button open-type="getPhoneNumber" catchgetphonenumber="getPhoneNumber" class="wx-auth-button text-center">微信登录</button>
</block> </block>
</view> </view>
</block> </block>
...@@ -38,31 +30,37 @@ ...@@ -38,31 +30,37 @@
<input maxlength="11" type="number" adjust-position="{{false}}" placeholder-class="placeholderClass" placeholder="填写手机号" bindinput="input" data-name="mobile" class="input" value="{{mobile}}" /> <input maxlength="11" type="number" adjust-position="{{false}}" placeholder-class="placeholderClass" placeholder="填写手机号" bindinput="input" data-name="mobile" class="input" value="{{mobile}}" />
</view> </view>
<view class="login-item flex"> <view class="login-item flex">
<input maxlength="4" type="number" adjust-position="{{false}}" placeholder-class="placeholderClass" placeholder="填写验证码" bindinput="input" data-name="captcha" class="input" value="{{captcha}}" /> <input maxlength="4" type="number" adjust-position="{{false}}" placeholder-class="placeholderClass" placeholder="填写验证码" bindinput="input" data-name="captcha" class="input" value="{{captcha}}" />
<button disabled="{{!mobile}}" class="code-btn" bindtap="getSmsCode">{{count? count + 's':'获取验证码'}}</button> <button disabled="{{!mobile}}" class="code-btn" bindtap="getSmsCode">{{count? count + 's':'获取验证码'}}</button>
</view> </view>
</view> </view>
<button class="wx-auth-button text-center" bindtap="phoneLogin">登录</button> <button class="wx-auth-button text-center" bindtap="phoneLogin">登录</button>
</block> </block>
<view class="type-box flex"> <view class="type-box flex">
<view class="title" bindtap="changeLoginType"> <view class="title">
{{loginType==0?'手机号登录':'微信登录'}} 其他方式
</view> </view>
<!-- <view class="type" bindtap="changeLoginType"> <view class="type" bindtap="changeLoginType">
<view class="icon"> <view class="icon">
<glsx-image src="common/{{loginType == 0?'phone':'wx'}}.png"></glsx-image> <glsx-image src="login/{{loginType == 0?'phone':'wx'}}.png"></glsx-image>
</view> </view>
{{loginType == 0?'手机号':'微信登录'}} {{loginType == 0?'手机号':'微信登录'}}
</view> --> </view>
</view> </view>
<view class="tips text-center" bindtap="handleChangeAgree"> <view class="tips text-center" bindtap="handleChangeAgree">
<view class="check {{isAgree}}"> <view class="check {{isAgree}}">
<glsx-image src="login/check.png" class="icon"></glsx-image> <glsx-image src="login/check.png" class="icon"></glsx-image>
</view> </view>
阅读并同意以下协议 我已阅读并同意
<text class="txt-orange" catchtap="handleAgree" data-name="privacy">《隐私协议》</text> <text class="txt-orange" catchtap="handleAgree" data-name="privacy">《隐私协议》</text>
<text class="txt-orange" catchtap="handleAgree" data-name="agreement">《服务使用协议》</text> <text class="txt-orange" catchtap="handleAgree" data-name="agreement">《服务使用协议》</text>
</view> </view>
</view> </view>
</view> </view>
<glsx-privacy appletName="海马刀"></glsx-privacy>
\ No newline at end of file \ No newline at end of file
<glsx-privacy appletName="积分商城"></glsx-privacy>
<!-- 积分来源选择 -->
<points-source show="{{showChooseSource}}" bindconfirm="pointSourceEvent"></points-source>
<!-- 开通钱包 -->
<enable-wallet show="{{showEnableWallet}}" bindclose="closeWallet" bindconfirm="enableWalletConfirm"></enable-wallet>
<!-- 钱包开通成功 -->
<enable-success show="{{showEnableSuccess}}" bindconfirm="successConfirm"></enable-success>
\ No newline at end of file \ No newline at end of file
/* pages/login/login.wxss */ /* pages/login/login.wxss */
page{
.login-bg { background-color: #FAFBFF !important;
position: fixed;
z-index: -2;
width: 1350rpx;
height: 1664rpx;
top: -60rpx;
} }
.layout::before{ .bg-top {
position: fixed; position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 600rpx;
background-image: linear-gradient(0deg, #0a030300 22%, #0A0303 100%);
z-index: -1; z-index: -1;
content: ''; width: 100%;
} height: 974rpx;
top: 0;
.layout::after {
position: fixed;
left: 0; left: 0;
bottom: 0; animation: opacity .25s forwards;
width: 100vw;
height: 400rpx;
transform: scaleY(-1);
background-image: linear-gradient(0deg, #0a030300 22%, #0A0303 90%);
z-index: -1;
content: '';
} }
.page-title {
.nav-bar { color: #2D2D2E;
height: 100%;
position: relative;
font-weight: 600; font-weight: 600;
font-size: 34rpx; font-size: 34rpx;
color: #FFFFFF;
justify-content: center;
} }
.nav-bar .back {
height: 100%;
justify-content: center;
padding: 0 40rpx;
position: absolute;
top: 0;
left: 0;
}
.nav-bar .back .icon {
width: 16rpx;
height: 28rpx;
}
@keyframes opacity { @keyframes opacity {
0% { 0% {
opacity: 0; opacity: 0;
...@@ -66,35 +28,37 @@ ...@@ -66,35 +28,37 @@
.h1 { .h1 {
padding: 20rpx 0; margin: 0 0 24rpx 80rpx;
font-size: 44rpx; padding-top: 90rpx;
color: #fff; font-size: 60rpx;
text-align: center; color: #323436;
font-weight: 600;
} }
.h2 {
margin: 0 0 60rpx 80rpx;
font-size: 44rpx;
color: #323436;
}
.h1 .logo { .login-img {
width: 402rpx; width: 468rpx;
height: 144rpx; height: 468rpx;
margin: 44rpx auto 0; margin: 60rpx auto;
} }
.h3 { .h3 {
font-weight: 500; font-weight: 500;
font-size: 44rpx; font-size: 44rpx;
color: #fff; color: #323436;
padding: 146rpx 106rpx 0; padding: 176rpx 0 0 106rpx;
}
.wx-box {
margin: 472rpx auto 0;
} }
.wx-auth-button { .wx-auth-button {
width: 590rpx !important; width: 590rpx !important;
height: 96rpx; height: 96rpx;
background: var(--btnColor); background: #FB8A32;
border-radius: 16rpx; border-radius: 20rpx;
font-weight: 500; font-weight: 500;
font-size: 32rpx; font-size: 32rpx;
color: #FFFFFF; color: #FFFFFF;
...@@ -106,6 +70,7 @@ ...@@ -106,6 +70,7 @@
border-color: #CCCED1 !important; border-color: #CCCED1 !important;
color: #fff !important; color: #fff !important;
box-shadow: none; box-shadow: none;
} }
.wx-auth-button[disabled]:not([type])::after { .wx-auth-button[disabled]:not([type])::after {
...@@ -115,8 +80,8 @@ ...@@ -115,8 +80,8 @@
.type-box { .type-box {
flex-direction: column; flex-direction: column;
margin-top: 33rpx; margin-top: 33rpx;
font-size: 28rpx; font-size: 24rpx;
color: #fff; color: #8A8C90;
} }
.type .icon { .type .icon {
...@@ -127,7 +92,7 @@ ...@@ -127,7 +92,7 @@
.tips { .tips {
font-size: 24rpx; font-size: 24rpx;
color: #C9C9C9; color: #858A94;
position: fixed; position: fixed;
bottom: 56rpx; bottom: 56rpx;
left: 0; left: 0;
...@@ -140,13 +105,13 @@ ...@@ -140,13 +105,13 @@
height: 24rpx; height: 24rpx;
box-sizing: border-box; box-sizing: border-box;
border-radius: 100%; border-radius: 100%;
border: 2rpx solid #fff; border: 2rpx solid #FB8A32;
margin-right: 8rpx; margin-right: 8rpx;
position: relative; position: relative;
} }
.tips .check.true { .tips .check.true {
border-color: var(--btnColor); border-color: #FB8A32;
} }
.tips .check .icon { .tips .check .icon {
...@@ -161,7 +126,7 @@ ...@@ -161,7 +126,7 @@
.txt-orange { .txt-orange {
color: #fff; color: #5092FF;
} }
...@@ -179,7 +144,6 @@ ...@@ -179,7 +144,6 @@
.login-item .input { .login-item .input {
flex: 1; flex: 1;
color: #fff;
} }
.placeholderClass { .placeholderClass {
...@@ -188,19 +152,16 @@ ...@@ -188,19 +152,16 @@
.code-btn { .code-btn {
font-size: 24rpx; font-size: 24rpx;
color: #fff; color: #5092FF;
flex-shrink: 0; flex-shrink: 0;
margin-left: auto; margin-left: auto;
padding: 8rpx 16rpx !important; padding: 0 !important;
width: fit-content !important; width: fit-content !important;
background-color: #AA656B; font-weight: 400;
} }
.code-btn[disabled]:not([type]){
.code-btn[disabled]:not([type]) { background-color: transparent;
background-color: #8A8C90;
color: #fff;
} }
.code-btn::after { .code-btn::after {
display: none; display: none;
} }
\ No newline at end of file \ No newline at end of file
// pages/Login/components/EnableSuccess/EnableSuccess.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
confirm() {
this.triggerEvent('confirm')
}
}
})
\ No newline at end of file \ No newline at end of file
/* pages/Login/components/EnableSuccess/EnableSuccess.wxss */
.success {
position: fixed;
left: 0;
bottom: 0;
right: 0;
top: 0;
z-index: 9;
.success-bg {
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .6);
}
.success-content {
position: absolute;
width: calc(100% - 208rpx);
height: 578rpx;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 2;
.content-bg {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
.content-box {
position: absolute;
z-index: 2;
margin-top: 226rpx;
width: 100%;
display: flex;
flex-flow: column;
align-items: center;
.success-text {
font-size: 48rpx;
font-weight: 700;
color: #FB8A32;
margin-bottom: 20rpx;
}
.success-tips {
line-height: 50rpx;
}
.success-btn {
width: 352rpx;
height: 96rpx;
background-image: linear-gradient(119deg, #FFB14E 11%, #FB8A32 96%);
box-shadow: 0 12rpx 12rpx 4rpx #fb8a321a;
border-radius: 48rpx;
display: flex;
align-items: center;
justify-content: center;
color: #FFFFFF;
font-size: 32rpx;
font-weight: 500;
margin-top: 24rpx;
}
}
}
}
\ No newline at end of file \ No newline at end of file
<!--pages/Login/components/EnableSuccess/EnableSuccess.wxml-->
<view class="success" catchtouchmove="noScroll" hidden="{{!show}}">
<view class="success-bg"></view>
<view class="success-content">
<view class="content-bg">
<glsx-image src="login/success-bg.png"></glsx-image>
</view>
<view class="content-box">
<view class="success-text">开通成功</view>
<view class="success-tips">
<view>您的积分钱包开通成功!</view>
<view>即刻开启您的财富之旅!</view>
</view>
<view class="success-btn" bindtap="confirm">我知道了</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// pages/Login/components/EnableWallet/EnableWallet.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean
}
},
/**
* 组件的初始数据
*/
data: {
stepDataArr: [{
icon: 'wallet-icon-1',
label: '开通钱包',
tips: '一站式积分管理体验'
}, {
icon: 'wallet-icon-2',
label: '查询积分',
tips: '您的第一笔可用积分',
pointsFlag: true
}, {
icon: 'wallet-icon-3',
label: '积分随心用',
tips: '兑换商品/分享亲友/话费充值, 想怎么用就怎么用!'
}]
},
/**
* 组件的方法列表
*/
methods: {
// 关闭弹窗
closeWallet() {
this.triggerEvent('close')
},
input(e) {
let { target } = e.currentTarget.dataset
let { value } = e.detail
value = target == 'phone' ? value.replace(/[^0-9]/g, '') : value
this.setData({
[target]: value
})
},
// 开通
confirm() {
let { name, phone } = this.data
if (!name) return wx.p.wxApi.showToast('姓名不能为空')
if (!phone || !/^[1]([3-9])[0-9]{9}$/.test(phone)) return wx.p.wxApi.showToast('请输入正确手机号')
}
}
})
\ No newline at end of file \ No newline at end of file
/* pages/Login/components/EnableWallet/EnableWallet.wxss */
.wallet {
position: fixed;
left: 0;
bottom: 0;
right: 0;
top: 0;
z-index: 9;
.wallet-bg {
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .6);
}
.wallet-content {
position: absolute;
width: calc(100% - 32rpx);
height: 968rpx;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 2;
.content-bg {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
.close {
width: 48rpx;
height: 48rpx;
position: absolute;
top: 0;
right: 10rpx;
z-index: 2;
}
.content-box {
position: absolute;
z-index: 2;
margin: 220rpx 40rpx 0 40rpx;
.box-item {
display: flex;
align-items: center;
margin-bottom: 26rpx;
.wallet-icon {
width: 76rpx;
height: 76rpx;
margin-right: 24rpx;
}
.label {
font-size: 26rpx;
color: #322811;
font-weight: 700;
}
.tips {
font-size: 24rpx;
color: #666666;
}
}
.text {
font-size: 24rpx;
color: #999999;
margin: 56rpx 0 16rpx;
}
.input-box {
height: 80rpx;
background: #F5F6F7;
border-radius: 16rpx;
display: flex;
align-items: center;
margin-bottom: 16rpx;
.input-label {
flex-shrink: 0;
width: 164rpx;
padding-left: 32rpx;
}
}
.wallet-btn {
height: 96rpx;
background-image: linear-gradient(108deg, #FFB14E 11%, #FB8A32 96%);
box-shadow: 0 12rpx 12rpx 4rpx #fb8a321a;
border-radius: 48rpx;
display: flex;
align-items: center;
justify-content: center;
color: #FFFFFF;
font-size: 32rpx;
font-weight: 500;
margin-top: 36rpx;
}
}
}
}
\ No newline at end of file \ No newline at end of file
<!--pages/Login/components/EnableWallet/EnableWallet.wxml-->
<view class="wallet" catchtouchmove="noScroll" hidden="{{!show}}">
<view class="wallet-bg"></view>
<view class="wallet-content">
<view class="content-bg">
<glsx-image src="login/wallet-bg.png"></glsx-image>
</view>
<view class="close" bindtap="closeWallet">
<glsx-image src="login/wallet-close.png"></glsx-image>
</view>
<view class="content-box">
<view class="box-item" wx:for="{{stepDataArr}}" wx:key="index">
<view class="wallet-icon">
<glsx-image src="login/{{item.icon}}.png"></glsx-image>
</view>
<view>
<view class="label">{{item.label}}</view>
<view class="tips">
{{item.tips}}
<text class="label" wx:if="{{item.pointsFlag}}">{{1500}}</text>
</view>
</view>
</view>
<view class="text">请确认信息无误</view>
<view class="input-box">
<view class="input-label">姓名</view>
<input bindinput="input" data-target="name" maxlength="10" value="{{name}}" type="text" placeholder="请输入"/>
</view>
<view class="input-box">
<view class="input-label">手机号</view>
<input bindinput="input" data-target="phone" maxlength="11" value="{{phone}}" type="text" placeholder="请输入"/>
</view>
<view class="wallet-btn" bindtap="confirm">一键开通</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
// pages/Login/components/PointsSource/PointsSource.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean
}
},
/**
* 组件的初始数据
*/
data: {
sourceArr: [{
id: 1,
label: '续保用户',
color: '#AF531F',
background: 'linear-gradient(90deg, #FCF5E5 0%, #FFE9BD 100%)',
icon: 'source-1'
}, {
id: 2,
label: '阳光激励用户',
color: '#C7462B',
background: 'linear-gradient(90deg, #FCF3F2 0%, #FFE0DB 100%)',
icon: 'source-2'
}, {
id: 3,
label: '管理层',
color: '#244BCA',
background: 'linear-gradient(90deg, #E7F5FD 0%, #C3E7FF 100%)',
icon: 'source-3'
}]
},
/**
* 组件的方法列表
*/
methods: {
// 切换选择来源
checkSource(e) {
let { target } = e.currentTarget.dataset
let { sourceArr } = this.data
sourceArr?.forEach(val => {
val.isChecked = false
if (val.id == target.id) {
val.isChecked = true
}
})
this.setData({sourceArr})
},
// 下一步
nextStep(e) {
let { target } = e.currentTarget.dataset
if (target) return // 未选择来源不可点击
// 请求接口
console.log('请求接口')
}
}
})
\ No newline at end of file \ No newline at end of file
/* pages/Login/components/PointsSource/PointsSource.wxss */
.source {
position: fixed;
left: 0;
bottom: 0;
right: 0;
top: 0;
z-index: 9;
.source-bg {
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .6);
}
.source-content {
position: absolute;
width: 100%;
box-sizing: border-box;
background: #FFFFFF;
border-radius: 20rpx 20rpx 0 0;
left: 0;
bottom: 0;
animation: show-sku-box .5s forwards;
z-index: 2;
padding: 52rpx 48rpx 48rpx 48rpx;
.title {
font-size: 40rpx;
font-weight: 500;
color: #333333;
}
.source-box {
padding: 54rpx 32rpx 0 32rpx;
.source-item {
border-radius: 20rpx;
margin-bottom: 36rpx;
position: relative;
height: 136rpx;
display: flex;
align-items: center;
padding-right: 28rpx;
justify-content: space-between;
.source-icon {
width: 112rpx;
height: 112rpx;
position: absolute;
left: 44rpx;
top: -18rpx;
}
.label {
font-size: 32rpx;
font-weight: 500;
margin-left: 200rpx;
}
.item-check{
width: 40rpx;
height: 40rpx;
border-radius: 50%;
box-sizing: border-box;
border: 2rpx #DEE0E3 solid;
background: #FFFFFF;
.icon {
width: 40rpx;
height: 40rpx;
display: none;
}
&.true .icon{
display: block;
}
}
}
}
.btn {
margin: 0 32rpx;
height: 96rpx;
background: #FB8A32;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
color: #FFFFFF;
font-weight: 500;
font-size: 32rpx;
&.disabled{
background: #FB8A324D;
}
}
}
.isFullSucreen {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
}
\ No newline at end of file \ No newline at end of file
<!--pages/Login/components/PointsSource/PointsSource.wxml-->
<wxs module="fn">
module.exports = {
btnDisabled: function(arr) {
for (var i = 0; i < arr.length; i++) {
if (arr[i].isChecked == true) {
return false
}
}
return true
}
}
</wxs>
<view class="source" catchtouchmove="noScroll" hidden="{{!show}}">
<view class="source-bg"></view>
<view class="source-content isFullSucreen {{close?'close':''}}">
<view class="title">您的积分渠道来源</view>
<view class="source-box">
<view class="source-item" wx:for="{{sourceArr}}" wx:key="index" bindtap="checkSource" data-target="{{item}}" style="color: {{item.color}};background-image: {{item.background}};">
<view>
<view class="source-icon">
<glsx-image src="login/{{item.icon}}.png"></glsx-image>
</view>
<view class="label">{{item.label}}</view>
</view>
<view class="item-check {{item.isChecked}}">
<glsx-image src="login/source-check.png" class="icon"></glsx-image>
</view>
</view>
</view>
<view class="btn {{fn.btnDisabled(sourceArr) ? 'disabled' : ''}}" bindtap="nextStep" data-target="{{fn.btnDisabled(sourceArr)}}">下一步</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
const app = getApp()
import mapApi from '../../../utils/mapapi/mapapi'
Page({
options: {
styleIsolation: 'shared'
},
/**
* 组件的属性列表
*/
properties: {},
/**
* 组件的初始数据
*/
data: {
IMGURL: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/hmd/',
IMGURKBASE: 'equity/version/1_0_0/',
userInfo: {},
isOpen: true,
menuList: [{
title: '惠享生活',
desc: '5折起',
icon: 'share_icon',
url: '/packageEquity/pages/commodity/list/list'
},
{
title: '充值优惠',
desc: '5折起',
icon: 'charge_vip',
url: '/packageEquity/pages/commodity/charge/charge'
},
{
title: '全部服务',
desc: '更多',
icon: 'all_icon',
url: '/packageEquity/pages/allEquity/allEquity'
}
],
storePackageList: [],
showMorePack: false,
tabList: ['附近优惠'],
curTabIndex: 0,
pageParam: {
appearance: 1,
pageSize: 0,
pageCount: 10
},
commodityList: [],
loadingMore: false,
loadOver: false,
// 是否登录
showLogin: false,
showPage: true,
// 会员类型-背景
vipStatus: {
1: 'gold_vip_bg',
2: 'silver_vip_bg',
3: 'pt_vip_bg'
},
// 普通会员3 银卡2 金卡1 非会员 0
identity: 0,
titleClass: {
0: '',
1: 'gold_title',
2: 'sliver_title',
3: 'card_title',
},
dateClass: {
0: '',
1: 'gold_date',
2: 'sliver_date',
3: 'card_date',
}
},
/**
* 组件的方法列表
*/
onLoad() {
this.getShopPackage()
this.getMemberCardData()
let freecard = wx.p.storage.get('bindInfo')
if (freecard) {
let bingInfo = JSON.parse(decodeURIComponent(freecard))
const sid = bingInfo.data.sessionId
wx.p.cache.storageApi.setSessionId(sid)
this.handleFreeCard(bingInfo)
}
this.setData({
isOpen: wx.p.storage.get('sessionId') ? true : false
})
},
onShow() {
let authComponent = this.selectComponent('#authorize')
if (authComponent) authComponent.check()
// if (this.data.userInfo && !this.data.userInfo.phone) return
this.toCheckMember()
},
onPullDownRefresh() {
this.getShopPackage()
this.toCheckMember()
app.globalData.goodsCommodityList = []
app.globalData.goodsPageParam.pageSize = 0
app.globalData.goodsLoaded = false
let { currentAddress } = this.data
if(!currentAddress) return
const { lat, lng } = currentAddress.location
this.toGetCommodity(lat, lng, false, 1)
},
onReachBottom() {
if (this.data.unauthorized) {
return
}
if (!this.data.commodityList.length) {
return
}
let {
currentAddress
} = this.data
if(!currentAddress) return
const {
lat,
lng
} = currentAddress.location
this.toGetCommodity(lat, lng)
},
// 新版
openMorePack(e) {
const {
show
} = e.currentTarget.dataset
this.setData({
showMorePack: !show
})
},
// 页面跳转
// toAllEquityPage() {
// wx.p.router.go('/packageEquity/pages/allEquity/allEquity')
// },
toBuyMember() {
wx.p.router.go('/packageEquity/pages/open/open', {
notIntercept: true
})
},
toNewPage(e) {
const {
index,
item
} = e.currentTarget.dataset
wx.p.router.go(item.url, {
notIntercept: true
})
},
// 定位
async getLocation() {
try {
const res = await this.getAddressInfo()
this.toGetCommodity(res.location.lat, res.location.lng, 1)
this.setData({
currentAddress: res,
unauthorized: false
})
wx.p.storage.set('unauthorized', false)
} catch (error) {
console.log(error)
}
},
// 获取附近优惠数据
toGetCommodity(lat, lng, firstLoad) {
let para = {
lat,
lng,
...app.globalData.goodsPageParam
}
if (app.globalData.goodsLoaded || (firstLoad && app.globalData.goodsPageParam?.length)) {
this.setData({
commodityList: app.globalData.goodsCommodityList,
})
return
}
para.pageOffset = para.pageSize
wx.p.api.equityApi.getLasteCommodity(para).then(res => {
if (!res?.data?.length) {
app.globalData.goodsLoaded = true
return
}
app.globalData.goodsPageParam.pageSize = res.pageOffset
let tempArr = []
res.data.forEach(item => {
tempArr.push(item)
})
app.globalData.goodsCommodityList = app.globalData.goodsCommodityList.concat(tempArr)
app.globalData.goodsLoaded = false
this.setData({
commodityList: app.globalData.goodsCommodityList,
})
})
},
// 重新收起获取定位
relocation() {
this.setData({
showAuth: true
})
},
/**授权失败 */
authFail() {
wx.p.storage.set('unauthorized', true)
this.setData({
unauthorized: true
})
},
/**授权成功 */
authSuccess() {
this.getLocation()
},
// 获取门店套餐
getShopPackage() {
const {
merchantId
} = wx.p.storage.get('merchant_info')
let para = {
merchantId
}
wx.p.api.equityApi.storePackage(para).then(res => {
this.setData({
storePackageList: res || []
})
})
},
// 去套餐详情页
toPackageDetail(e) {
const {
id
} = e.currentTarget.dataset
wx.p.router.go('/packageEquity/pages/package/package', {
id,
notIntercept: true
})
},
// 获取用户会员信息
toCheckMember() {
let sid = wx.p.storage.get('sessionId')
if (!sid) {
this.setData({
isOpen: false
})
return
}
wx.p.api.equityApi.checkOpenMember().then(res => {
let flag = false,
identity = 0 // 普通会员3 银卡2 金卡1 非会员 0
if (res.data && res.data.validitDate) {
res.data.time = new Date(res.data.validitDate).format('yyyy.MM.dd')
}
if (res.data && res.data.endTime) {
res.data.endTime = new Date(res.data.endTime).format('yyyy.MM.dd')
}
// 普通会员
if (res.code == 0 && res.data) {
flag = true
identity = 3
if (res.data && res.data.cardTypeSpecial) {
identity = res.data.cardTypeSpecial
}
}
wx.p.storage.set('isVIP', flag)
this.setData({
isOpen: flag,
vipInfo: res.data,
identity
})
})
},
// 获取门店会员卡信息
getMemberCardData() {
const {
merchantId
} = wx.p.storage.get('merchant_info')
let para = {
merchantId
}
wx.p.api.equityApi.memberCard(para).then(res => {
this.setData({
memberInfo: res
})
})
},
// 处理免费领取权益页面带来的参数---弹框显示
handleFreeCard(bindInfo) {
wx.p.storage.rm('bindInfo')
const {
code,
errId,
message
} = bindInfo
if (code == 0) {
wx.showModal({
title: '提示',
content: '领取成功',
confirmText: '确定',
showCancel: false,
confirmColor: '#F13C3D'
})
this.toCheckMember()
} else if (code == -1 && errId == 20321) {
wx.showModal({
title: '提示',
content: message,
confirmText: '续费开通',
cancelText: '不用了',
confirmColor: '#F13C3D'
}).then(res => {
if (res.confirm) {
this.toBuyMember()
}
})
} else if (errId == 20320 || errId == 20322) {
wx.showModal({
title: '提示',
content: message,
confirmText: '确定',
showCancel: false,
confirmColor: '#F13C3D'
})
}
},
// 检测是否已经登录
checkLogin() {
return wx.p.authStatus
},
async getAddressInfo() {
let addressInfo = wx.p.storage.get('address_info')
return new Promise(resolve => {
if (addressInfo && Date.now() - addressInfo.createTime < 2 * 60 * 1e3) resolve(addressInfo)
else
wx.getLocation({
type: 'gcj02'
}).then(({
latitude,
longitude
}) => {
mapApi.detailedAdrress([latitude, longitude]).then(detail => {
let info = {
...detail,
createTime: Date.now()
}
resolve(info)
wx.p.storage.set('address_info', info)
})
})
})
}
})
\ No newline at end of file \ No newline at end of file
{
"navigationStyle": "custom",
"enablePullDownRefresh": true,
"onReachBottomDistance": 10,
"usingComponents": {
"commodity-item": "/components/commodityItem/index"
}
}
\ No newline at end of file \ No newline at end of file
/* pages/tab/index/pages/equity/equity.wxss */
/* pages/tab/equity/equity.wxss */
page {
background: #F9F7F7;
}
.equity-container {
padding: 16rpx 20rpx;
}
// 顶部普通身份
.pt_vip_pannel {
position: relative;
width: 100%;
height: 136rpx;
background-image: linear-gradient(126deg, #303030 2%, #070707 98%);
border-radius: 16rpx;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 0 24rpx;
.logo {
width: 72rpx;
height: 60rpx;
}
.title_pannel {
margin-left: 24rpx;
.card_title {
font-weight: 600;
font-size: 28rpx;
color: #EECC9C;
}
.card_tip {
font-weight: 400;
font-size: 20rpx;
color: #EECC9C;
}
}
.open_btn {
width: 156rpx;
height: 56rpx;
background-image: radial-gradient(circle at 12% 25%, #FDE8BF 0%, #DDA15F 98%);
border-radius: 28rpx;
font-weight: 400;
font-size: 24rpx;
color: #070707;
position: absolute;
right: 32rpx;
top: 50%;
transform: translateY(-50%)
}
}
// 会员身份
.vip_pannel {
width: 100%;
height: 360rpx;
border-radius: 16rpx;
box-sizing: border-box;
padding: 40rpx 0 0 40rpx;
position: relative;
.card_title {
background: linear-gradient(125deg, #F0EED7 100%, #F2EAAB 100%) !important;
-webkit-background-clip: text !important;
background-clip: text !important;
color: transparent !important;
font-weight: 500;
font-size: 32rpx;
}
.sliver_title{
background: linear-gradient(125deg, #C99113 100%, #A9790B 100%) !important;
-webkit-background-clip: text !important;
background-clip: text !important;
color: transparent !important;
font-weight: 600;
font-size: 32rpx;
}
.gold_title{
background: linear-gradient(125deg, #645E54 100%, #29271E 100%) !important;
-webkit-background-clip: text !important;
background-clip: text !important;
color: transparent !important;
font-weight: 600;
font-size: 32rpx;
}
.card_date{
position: absolute;
left: 40rpx;
bottom: 40rpx;
background: linear-gradient(125deg, #F0EED7 100%, #F2EAAB 100%) !important;
-webkit-background-clip: text !important;
background-clip: text !important;
color: transparent !important;
font-weight: 400;
font-size: 20rpx;
}
.sliver_date{
background: linear-gradient(125deg, #C99113 100%, #A9790B 100%) !important;
-webkit-background-clip: text !important;
background-clip: text !important;
color: transparent !important;
}
.gold_date{
background: linear-gradient(125deg, #645E54 100%, #29271E 100%) !important;
-webkit-background-clip: text !important;
background-clip: text !important;
color: transparent !important;
}
}
// 金刚区
.menu_widget {
margin-top: 40rpx;
.title {
font-weight: 500;
font-size: 32rpx;
color: #1F1F1F;
}
.wrap {
display: flex;
align-items: center;
justify-content: space-around;
padding-top: 24rpx;
.menu_item {
position: relative;
.cover {
width: 100rpx;
height: 100rpx;
}
.text {
margin-top: 16rpx;
font-weight: 400;
font-size: 24rpx;
color: #000000;
}
.tip {
position: absolute;
top: -8rpx;
right: -16rpx;
width: 68rpx;
height: 32rpx;
}
}
}
}
.top_wrapper {
position: relative;
height: 606rpx;
}
.top_bg_img {
height: 420rpx;
}
.top_idCard_con {
position: absolute;
left: 0;
top: 0;
right: 0;
box-sizing: border-box;
padding: 32rpx 32rpx 0 32rpx;
}
.vip_icon {
position: absolute;
left: 66rpx;
top: 100rpx;
width: 92rpx;
height: 88rpx;
}
.card_box {
width: 60%;
position: absolute;
left: 172rpx;
top: 100rpx;
}
.card_title {
font-size: 34rpx;
font-weight: 500;
color: #8E5310;
line-height: 48rpx;
width: 89%;
white-space: pre-wrap;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
.onopenText {
color: #333333;
}
.card_date {
font-size: 24rpx;
font-weight: 400;
color: #8E5310;
line-height: 34rpx;
margin-top: 6rpx;
}
.card_date_grey {
color: #333333;
opacity: 0.7;
}
.open_btn {
position: absolute;
top: 124rpx;
right: 62rpx;
width: 120rpx;
height: 44rpx;
background: linear-gradient(128deg, #F5DBBD 0%, #EAC07E 100%);
border-radius: 22rpx;
font-size: 20rpx;
font-weight: 500;
color: #8E5310;
}
.member_back_img {
height: 226rpx !important;
}
.top_btn_con {
position: absolute;
left: 0;
right: 0;
top: 266rpx;
box-sizing: border-box;
padding: 28rpx 32rpx 0 32rpx;
}
.top_btn_title {
font-size: 32rpx;
font-weight: 500;
color: #FFFFFF;
line-height: 44rpx;
}
.top_btn {
font-size: 24rpx;
font-weight: 400;
color: #FFFFFF;
line-height: 34rpx;
opacity: 0.49;
}
.home_right_icon {
width: 8rpx;
height: 16rpx;
margin-left: 8rpx;
}
.fiex_menu_wrapper {
position: absolute;
right: 0;
left: 0;
bottom: 0;
height: 256rpx;
}
.home_menu_bg {
height: 272rpx;
}
.pos_wrap {
position: absolute;
left: 0;
right: 0;
top: 0;
height: 272rpx;
box-sizing: border-box;
padding-top: 28rpx;
padding: 28rpx 12rpx 0 12rpx;
display: flex;
justify-content: space-between;
}
.image_text_box {
/* width: 100rpx; */
width: 25%;
display: flex;
flex-direction: column;
align-items: center;
}
.box_icon {
width: 100rpx;
height: 100rpx;
}
.box_label {
font-size: 24rpx;
font-weight: 500;
color: #282829;
line-height: 34rpx;
margin-bottom: 8rpx;
}
.box_tip {
font-size: 20rpx;
font-weight: 400;
color: #999999;
line-height: 28rpx;
}
.service_title_wrap {
margin-top: 40rpx;
margin-bottom: 32rpx;
box-sizing: border-box;
display: flex;
align-items: flex-end;
}
.service_title {
font-size: 32rpx;
font-weight: 500;
color: #1F1F1F;
}
.service_info {
font-size: 20rpx;
font-weight: 600;
color: #8E5310;
margin-left: 12rpx;
}
.service_list_wrap {
box-sizing: border-box;
padding: 32rpx 4rpx 0 4rpx;
display: flex;
flex-wrap: wrap;
/* justify-content: space-between; */
}
.service_box_wrap {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 32rpx;
width: 25%;
position: relative;
}
.service_icon {
width: 88rpx;
height: 88rpx;
}
.lock_icon {
width: 20rpx;
height: 20rpx;
position: absolute;
right: 28rpx;
top: 0rpx;
}
.service_label {
font-size: 24rpx;
font-weight: 400;
color: #282829;
margin-top: 12rpx;
width: 120rpx;
text-align: center;
}
.unOpenColor {
color: #999999;
}
.swiper_wrapper {
box-sizing: border-box;
margin: 24rpx 32rpx 40rpx 32rpx;
height: 160rpx;
}
.image_swiper_item {
height: 160rpx !important;
border-radius: 16rpx;
}
.package_wrapper {
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.package_element_one,
.package_element_two {
width: 47.8%;
height: 220rpx;
border-radius: 16rpx;
position: relative;
}
.package_element_three {
width: 47.8%;
height: 460rpx;
border-radius: 16rpx;
position: relative;
}
.right_wid {
width: 47.8%;
height: 460rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.right_wid_w {
width: 100%;
}
.package_pos_box {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
box-sizing: border-box;
padding: 40rpx 0 0 20rpx;
}
.one_title {
font-size: 32rpx;
font-weight: 400;
color: #333333;
line-height: 44rpx;
width: 63.5%;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
.two_title {
color: #333333;
}
.three_title {
color: #333333;
}
.ont_desc {
font-size: 24rpx;
font-weight: 400;
color: #7D7D7D;
line-height: 34rpx;
width: 63.5%;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
.max_num {
font-size: 28rpx;
}
.pack_icon_max {
height: 460rpx !important;
}
.pack_icon {
height: 220rpx !important;
}
.marbottom {
margin-bottom: 20rpx;
}
.more_btn_wrap {
width: 100%;
}
.more_btn_text {
font-size: 24rpx;
font-weight: 500;
color: #282829;
}
.more_icon {
width: 40rpx;
height: 40rpx;
margin-right: 16rpx;
}
// 附近优惠
.tab_wrap {
margin-top: 40rpx;
margin-bottom: 32rpx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.tab_item {
position: relative;
}
.tab_text {
font-size: 32rpx;
font-weight: 500;
color: #282829;
}
.tab_text_active {
color: #BC192B;
}
.tab_line {
width: 48rpx;
height: 8rpx;
background: linear-gradient(138deg, #C18C25 0%, #8E5310 100%);
border-radius: 4rpx;
position: absolute;
left: 50%;
bottom: -20rpx;
transform: translate(-50%, 0);
}
.commodity_list_widget {
// margin-top: 20rpx;
box-sizing: border-box;
// padding: 32rpx;
}
.reLocation_wrap {
width: 100%;
height: 240rpx;
}
.loca_icon {
width: 40rpx;
height: 48rpx;
}
.loca_text {
margin-left: 8rpx;
font-size: 24rpx;
color: #282828;
text-decoration: underline;
}
.preModal {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .7);
z-index: 999;
}
.modal_content_wrap {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
}
.flex_cc {
display: flex;
align-items: center;
justify-content: center;
}
.flex_sbc {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex_sc {
display: flex;
align-items: center;
}
.text_hide {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.preImage_icon {
width: 69.3%;
height: 38.3%;
}
.preImage_btn {
width: 230rpx;
height: 110rox;
}
.orderBtn_wrap {
position: absolute;
right: 64rpx;
bottom: 36rpx;
display: flex;
align-items: center;
}
.order_icon {
width: 20rpx;
height: 22rpx;
margin-right: 8rpx;
}
.order_text_title {
font-size: 24rpx;
font-weight: 500;
color: #8E5310;
line-height: 34rpx;
}
\ No newline at end of file \ No newline at end of file
<!-- <navigation-bar bindnavbarReady="navbarReady" page-title="权益中心">权益中心</navigation-bar> -->
<navigation-bar>权益中心</navigation-bar>
<view class="equity-container" id="equity" style="margin-top: {{navHeight}}px;">
<!-- 顶部个人信息 -->
<!-- <view class="top_wrapper">
<view class="top_idCard_con">
<view class="card_box">
<view class="card_title {{isOpen?'':'onopenText'}}">
{{memberInfo.equityName}}
</view>
<view wx:if="{{isOpen&&vipInfo.cardNo&&controlShowBanner}}" class="card_date">
到期:{{vipInfo.time}}
</view>
<view wx:elif="{{isOpen&&!vipInfo.cardNo&&controlShowBanner}}" class="card_date">
{{vipInfo.renewDay}}天后到期
</view>
<view wx:else class="card_date card_date_grey">开通会员尊享优质权益</view>
</view>
<view wx:if="{{!isOpen}}" class="open_btn flex_cc" bind:tap="toBuyMember">去开通</view>
<view wx:elif="{{isOpen&&!vipInfo.cardNo&&controlShowBanner}}" class="open_btn flex_cc" bind:tap="toBuyMember">
去续费
</view>
<image webp class="vip_icon" webp src="{{IMGURKBASE}}{{isOpen?'scrm_mini_vip.png':'scrm_mini_no_vip.png'}}" />
<image webp mode="widthFix" webp class="member_back_img" src="{{IMGURKBASE}}{{isOpen?'home_member_bg':'no_open_vip'}}.png" />
</view>
<view class="top_btn_con flex_sbc">
<view class="top_btn_title">会员优享</view>
</view>
<view class="fiex_menu_wrapper">
<view class="pos_wrap">
<block wx:for="{{menuList}}" wx:key="index">
<view class="image_text_box" data-index="{{index}}" data-item="{{item}}" bind:tap="toNewPage">
<image webp class="box_icon" src="{{IMGURKBASE}}{{item.icon}}.png" />
<view class="box_label">{{item.title}}</view>
<view class="box_tip">{{item.desc}}</view>
</view>
</block>
</view>
<image webp mode="widthFix" class="home_menu_bg" webp src="{{IMGURKBASE}}home_diceng_icon.png" />
</view>
<image webp class="top_bg_img" mode="widthFix" webp src="{{IMGURKBASE}}scrm_new_bg.png" />
</view> -->
<!-- 普通身份 -->
<view wx:if="{{!isOpen}}" class="pt_vip_pannel">
<glsx-image class="logo" webp src="{{IMGURKBASE}}vip_logo_icon.png"></glsx-image>
<view class="title_pannel">
<view class="card_title">{{memberInfo.equityName}}</view>
<view class="card_tip">生活权益|专享超百项生活权益</view>
</view>
<view bind:tap="toBuyMember" class="open_btn flex_cc">开通会员</view>
</view>
<!-- 会员 -->
<view wx:elif="{{identity}}" style="background: url({{IMGURL}}{{IMGURKBASE}}{{vipStatus[identity]}}.png);background-size: 100% 100%;" class="vip_pannel">
<view class="card_title {{titleClass[identity]}}">{{identity==1?vipInfo.goldName:identity==2?vipInfo.silverName:memberInfo.equityName}}</view>
<view wx:if="{{isOpen&&vipInfo.cardNo&&identity==3}}" class="card_date {{dateClass[identity]}}">{{vipInfo.time}} 到期</view>
<view wx:elif="{{isOpen&&vipInfo.cardNo&&identity<3}}" class="card_date {{dateClass[identity]}}">{{vipInfo.endTime}} 到期</view>
<view wx:elif="{{isOpen&&!vipInfo.cardNo}}" class="card_date {{dateClass[identity]}}"> {{vipInfo.renewDay}}天后到期</view>
<view wx:else class="card_date">开通会员尊享优质权益</view>
</view>
<!-- 金刚区 -->
<view class="menu_widget">
<view class="title">会员优享</view>
<view class="wrap">
<block wx:for="{{menuList}}" wx:key="index">
<view data-index="{{index}}" data-item="{{item}}" bind:tap="toNewPage" class="menu_item">
<glsx-image class="cover" webp src="{{IMGURKBASE}}{{item.icon}}.png"></glsx-image>
<view class="text">{{item.title}}</view>
<glsx-image wx:if="{{index<2}}" class="tip" webp src="{{IMGURKBASE}}five_icon.png"></glsx-image>
</view>
</block>
</view>
</view>
<!-- 门店套餐 -->
<block wx:if="{{storePackageList.length}}">
<view class="service_title_wrap">
<view class="service_title">精选套餐服务</view>
</view>
<view class="package_wrapper">
<block wx:if="{{storePackageList.length<3}}">
<view class="package_element_one" bind:tap="toPackageDetail" data-id="{{storePackageList[0].packageId}}">
<view class="package_pos_box">
<view class="one_title">{{storePackageList[0].packageName}}</view>
<view class="ont_desc">
内含
<text class="max_num">{{storePackageList[0].num}}</text>
项超值套餐服务
</view>
</view>
<glsx-image webp mode="widthFix" class="pack_icon" webp src="{{IMGURKBASE}}scrm_bg1.png" />
</view>
<view wx:if="{{storePackageList.length==2}}" class="package_element_two" bind:tap="toPackageDetail" data-id="{{storePackageList[1].packageId}}">
<view class="package_pos_box">
<view class="one_title two_title">
{{storePackageList[1].packageName}}
</view>
<view class="ont_desc">
内含
<text class="max_num">{{storePackageList[1].num}}</text>
项超值套餐服务
</view>
</view>
<glsx-image webp mode="widthFix" class="pack_icon" webp src="{{IMGURKBASE}}scrm_bg2.png" />
</view>
</block>
<block wx:elif="{{storePackageList.length==3}}">
<view class="package_element_three" bind:tap="toPackageDetail" data-id="{{storePackageList[0].packageId}}">
<view class="package_pos_box">
<view class="one_title three_title">
{{storePackageList[0].packageName}}
</view>
<view class="ont_desc">
内含
<text class="max_num">{{storePackageList[0].num}}</text>
项超值套餐服务
</view>
</view>
<glsx-image webp mode="widthFix" class="pack_icon_max" webp src="{{IMGURKBASE}}scrm_bg3.png" />
</view>
<view class="right_wid">
<view class="package_element_one right_wid_w" bind:tap="toPackageDetail" data-id="{{storePackageList[1].packageId}}">
<view class="package_pos_box">
<view class="one_title">{{storePackageList[1].packageName}}</view>
<view class="ont_desc">
内含
<text class="max_num">{{storePackageList[1].num}}</text>
项超值套餐服务
</view>
</view>
<glsx-image webp mode="widthFix" class="pack_icon" webp src="{{IMGURKBASE}}scrm_bg1.png" />
</view>
<view class="package_element_two right_wid_w" bind:tap="toPackageDetail" data-id="{{storePackageList[2].packageId}}">
<view class="package_pos_box">
<view class="one_title two_title">
{{storePackageList[2].packageName}}
</view>
<view class="ont_desc">
内含
<text class="max_num">{{storePackageList[2].num}}</text>
项超值套餐服务
</view>
</view>
<glsx-image webp mode="widthFix" class="pack_icon" webp src="{{IMGURKBASE}}scrm_bg2.png" />
</view>
</view>
</block>
<block wx:elif="{{storePackageList.length==4}}">
<block wx:for="{{storePackageList}}" wx:key="index">
<view class="{{index%3==0?'package_element_one':'package_element_two'}} marbottom" bind:tap="toPackageDetail" data-id="{{item.packageId}}">
<view class="package_pos_box">
<view class="one_title {{index%3==0?'':'two_title'}}">
{{item.packageName}}
</view>
<view class="ont_desc">
内含
<text class="max_num">{{item.num}}</text>
项超值套餐服务
</view>
</view>
<glsx-image webp mode="widthFix" class="pack_icon" webp src="{{IMGURKBASE}}{{index%3==0?'scrm_bg1':'scrm_bg2'}}.png" />
</view>
</block>
</block>
<block wx:elif="{{storePackageList.length>4}}">
<view class="package_element_three marbottom" bind:tap="toPackageDetail" data-id="{{storePackageList[0].packageId}}">
<view class="package_pos_box">
<view class="one_title three_title">
{{storePackageList[0].packageName}}
</view>
<view class="ont_desc">
内含
<text class="max_num">{{storePackageList[0].num}}</text>
项超值套餐服务
</view>
</view>
<glsx-image webp mode="widthFix" class="pack_icon_max" webp src="{{IMGURKBASE}}scrm_bg3.png" />
</view>
<view class="right_wid marbottom">
<view class="package_element_one right_wid_w" bind:tap="toPackageDetail" data-id="{{storePackageList[1].packageId}}">
<view class="package_pos_box">
<view class="one_title">{{storePackageList[1].packageName}}</view>
<view class="ont_desc">
内含
<text class="max_num">{{storePackageList[1].num}}</text>
项超值套餐服务
</view>
</view>
<glsx-image webp mode="widthFix" class="pack_icon" webp src="{{IMGURKBASE}}scrm_bg1.png" />
</view>
<view class="package_element_two right_wid_w" bind:tap="toPackageDetail" data-id="{{storePackageList[2].packageId}}">
<view class="package_pos_box">
<view class="one_title two_title">
{{storePackageList[2].packageName}}
</view>
<view class="ont_desc">
内含
<text class="max_num">{{storePackageList[2].num}}</text>
项超值套餐服务
</view>
</view>
<glsx-image webp mode="widthFix" class="pack_icon" webp src="{{IMGURKBASE}}scrm_bg2.png" />
</view>
</view>
<block wx:if="{{showMorePack}}">
<block wx:for="{{storePackageList}}" wx:key="index">
<view wx:if="{{index>2}}" class="{{index%3==0?'package_element_one':'package_element_two'}} marbottom" bind:tap="toPackageDetail" data-id="{{item.packageId}}">
<view class="package_pos_box">
<view class="one_title {{index%3==0?'':'two_title'}}">
{{item.packageName}}
</view>
<view class="ont_desc">
内含
<text class="max_num">{{item.num}}</text>
项超值套餐服务
</view>
</view>
<glsx-image webp mode="widthFix" class="pack_icon" webp src="{{IMGURKBASE}}{{index%3==0?'scrm_bg1':'scrm_bg2'}}.png" />
</view>
</block>
</block>
<view class="more_btn_wrap flex_cc" data-show="{{showMorePack}}" bind:tap="openMorePack">
<glsx-image webp class="more_icon" webp src="equity/{{showMorePack?'scrm_up_icon':'scrm_down_icon'}}.png" />
<view class="more_btn_text">{{showMorePack?'收起':'查看更多'}}</view>
</view>
</block>
</view>
</block>
<!-- 附近优惠 -->
<view wx:if="{{commodityList.length}}" class="tab_wrap">
<block wx:for="{{tabList}}" wx:key="index">
<view class="tab_item">
<view class="tab_text {{curTabIndex==index?'tab_text_active':''}}">
{{item}}
</view>
<view wx:if="{{curTabIndex==index}}" class="tab_line"></view>
</view>
</block>
</view>
<view wx:if="{{commodityList.length}}" class="commodity_list_widget">
<block wx:for="{{commodityList}}" wx:key="index">
<commodity-item address="{{currentAddress}}" businessInfo="{{item}}" />
</block>
</view>
<view wx:if="{{unauthorized}}" class="reLocation_wrap flex_cc">
<glsx-image webp class="loca_icon" webp src="equity/location_icon.png" />
<view bind:tap="relocation" class="loca_text">定位一下,发现附近优惠</view>
</view>
</view>
<authorize id="authorize" scopeType="userLocation" isShowCheck="{{false}}" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
<glsx-privacy appletName="海马刀"></glsx-privacy>
\ No newline at end of file \ No newline at end of file
...@@ -46,7 +46,7 @@ class Router { ...@@ -46,7 +46,7 @@ class Router {
const shouldIntercept = this._interceptRoute(url); const shouldIntercept = this._interceptRoute(url);
if (shouldIntercept) return; if (shouldIntercept) return;
wx.navigateTo({ wx.navigateTo({
url: `${this.specialPages.h5}?url=${encodeURIComponent(url)}`, url: `${this.specialPages.webView}?url=${encodeURIComponent(url)}`,
}); });
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!