Commit 414ce063 by 程南

2020.05.11版本

parent 1e564142
...@@ -110,7 +110,9 @@ ...@@ -110,7 +110,9 @@
"pages/payCardInfo/payCardInfo", "pages/payCardInfo/payCardInfo",
"pages/moneyBuyCoupon/moneyBuyCoupon", "pages/moneyBuyCoupon/moneyBuyCoupon",
"pages/moneyBuyCouponInfo/moneyBuyCouponInfo", "pages/moneyBuyCouponInfo/moneyBuyCouponInfo",
"pages/moneyBuyCouponRecords/moneyBuyCouponRecords" "pages/moneyBuyCouponRecords/moneyBuyCouponRecords",
"pages/TimelimitedSales/TimelimitedSales",
"pages/belongWithGuide/belongWithGuide"
] ]
}, },
{ {
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
<template name="water-list"> <template name="water-list">
<navigator hover-class="none" url="/pages/productDetail/productDetail?id={{productId}}"> <navigator hover-class="none" url="/pages/productDetail/productDetail?id={{productId}}">
<view class="item"> <view class="item">
<image wx:if="{{isFlashSale}}" class="limited-icon" src="https://img3.bigaka.com/prd/3001/202005/20200508/3001a6dcdf69-369a-4f43-8757-60f071946ea8.png" />
<!-- 图片主图时 --> <!-- 图片主图时 -->
<image class="item-img" <image class="item-img"
src="{{indexUrl}}" src="{{indexUrl}}"
...@@ -34,11 +37,20 @@ ...@@ -34,11 +37,20 @@
<view class="item-title">{{productName}}</view> <view class="item-title">{{productName}}</view>
</view> </view>
<view class="pro-price-wrap"> <view class="pro-price-wrap">
<view class="pro-plus-price">
<view class="pro-plus-price" wx:if="{{falshSaleActivityPrice}}">
<text>¥</text>
<text class="plus-price">{{utils.numberFormat(falshSaleActivityPrice / 100)}}</text>
<text class="sale-price">¥{{utils.numberFormat(minSalePrice / 100)}}</text>
</view>
<view class="pro-plus-price" wx:if="{{!falshSaleActivityPrice}}">
<text>¥</text> <text>¥</text>
<text class="plus-price">{{memberPrice ? utils.numberFormat(memberPrice / 100) : utils.numberFormat(minSalePrice / 100)}}</text> <text class="plus-price">{{memberPrice ? utils.numberFormat(memberPrice / 100) : utils.numberFormat(minSalePrice / 100)}}</text>
<image wx:if="{{memberPrice}}" mode="widthFix" src="/assets/imgs/7_1_0/member-icon.png"></image> <image wx:if="{{memberPrice}}" mode="widthFix" src="/assets/imgs/7_1_0/member-icon.png"></image>
</view> </view>
<view class="pro-member-price" wx:if="{{plusPrice}}"> <view class="pro-member-price" wx:if="{{plusPrice}}">
<text>¥</text> <text>¥</text>
<text class="member-price">{{utils.numberFormat(plusPrice / 100)}}</text> <text class="member-price">{{utils.numberFormat(plusPrice / 100)}}</text>
......
...@@ -11,7 +11,22 @@ ...@@ -11,7 +11,22 @@
border-radius: 10rpx; border-radius: 10rpx;
box-shadow: 0px 2px 5px 0px rgba(199, 199, 199, 0.5); box-shadow: 0px 2px 5px 0px rgba(199, 199, 199, 0.5);
padding-bottom: 24rpx; padding-bottom: 24rpx;
position: relative;
} }
.sale-price{
color: rgba(170, 170, 170, 1);
font-size: 22rpx;
margin-left: 12rpx;
text-decoration: line-through;
}
.limited-icon{
position: absolute;
height: 36rpx;
width: 91rpx;
top: 0;
left: 0;
}
.item-ava{ .item-ava{
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
......
<!--component/productListStyleTwo/productListStyleTwo.wxml--> <!-- component/productListStyleTwo/productListStyleTwo.wxml -->
<wxs src="../../wxs/utils.wxs" module="utils" /> <wxs src="../../wxs/utils.wxs" module="utils" />
<block wx:for="{{imageData}}" wx:key="*this" wx:for-item="item"> <block wx:for="{{imageData}}" wx:key="*this" wx:for-item="item">
<navigator hover-class="none" url="/pages/productDetail/productDetail?id={{item.productId}}"> <navigator hover-class="none" url="/pages/productDetail/productDetail?id={{item.productId}}">
<view class="hot-item border_box" > <view class="hot-item border_box">
<view class="hot-img-box"> <view class="hot-img-box">
<image class="hot-img" <image wx:if="{{item.isFlashSale}}" class="limited-icon" src="https://img3.bigaka.com/prd/3001/202005/20200508/3001a6dcdf69-369a-4f43-8757-60f071946ea8.png" />
src="{{item.indexUrl}}" <image class="hot-img" src="{{item.indexUrl}}" mode="aspectFit" lazy-load wx:if="{{!utils.isVideo(item.indexUrl)}}" />
mode="aspectFit" lazy-load <video id="myVideo" class="hot-img" src="{{item.indexUrl}}" muted wx:if="{{utils.isVideo(item.indexUrl)}}"></video>
wx:if="{{!utils.isVideo(item.indexUrl)}}"/>
<video id="myVideo"
class="hot-img"
src="{{item.indexUrl}}"
muted
wx:if="{{utils.isVideo(item.indexUrl)}}"></video>
</view>
<view class="hot-item-desc border_box">
<view class="item-name">{{item.productName}}</view>
<!-- <view class="item-desc">{{item.productStatusDesc}}</view>-->
<view class="item-vip-price weui-flex">
<text class="vip-sale-price border_box">
¥{{item.memberPrice ? utils.numberFormat(item.memberPrice / 100) : utils.numberFormat(item.minSalePrice / 100)}}
</text>
<view class="" >
<image
class="item-vip"
src="https://img3.bigaka.com/prd/3001/202003/20200309/3001918ef881-b117-44da-8cfe-72e26f051e29.png"
mode="widthFix"
wx:if="{{item.memberPrice}}"
/>
</view>
<!-- <text class="vip-original-price">¥189</text> -->
</view>
<view class="item-plus-price weui-flex" wx:if="{{item.plusPrice}}">
<text class="vip-plus-price vip-sale-price border_box">¥{{utils.numberFormat(item.plusPrice / 100)}}</text>
<view class="">
<image
class="item-plus"
src="https://img3.bigaka.com/prd/3001/202003/20200309/3001fce746fd-c6f9-4016-bc0a-9aee0ac93f7a.png"
mode="widthFix"
lazy-load="false"
/>
</view> </view>
</view> <view class="hot-item-desc border_box">
<view/> <view class="item-name">{{item.productName}}</view>
</view> <!-- <view class="item-desc">{{item.productStatusDesc}}</view> -->
</view> <view class="item-vip-price weui-flex">
</navigator>
</block>
<text class="vip-sale-price border_box" wx:if="{{item.falshSaleActivityPrice}}">
¥{{utils.numberFormat(item.falshSaleActivityPrice / 100)}}<text class="sale-price">¥{{utils.numberFormat(item.minSalePrice / 100)}}</text>
</text>
<text class="vip-sale-price border_box" wx:if="{{!item.falshSaleActivityPrice}}">
¥{{item.memberPrice ? utils.numberFormat(item.memberPrice / 100) : utils.numberFormat(item.minSalePrice / 100)}}
</text>
<view class="">
<image class="item-vip" src="https://img3.bigaka.com/prd/3001/202003/20200309/3001918ef881-b117-44da-8cfe-72e26f051e29.png" mode="widthFix" wx:if="{{item.memberPrice}}" />
</view>
<!-- <text class="vip-original-price">¥189</text> -->
</view>
<view class="item-plus-price weui-flex" wx:if="{{item.plusPrice}}">
<text class="vip-plus-price vip-sale-price border_box">
¥{{utils.numberFormat(item.plusPrice / 100)}}
</text>
<view class="">
<image class="item-plus" src="https://img3.bigaka.com/prd/3001/202003/20200309/3001fce746fd-c6f9-4016-bc0a-9aee0ac93f7a.png" mode="widthFix" lazy-load="false" />
</view>
</view>
<view />
</view>
</view>
</navigator>
</block>
\ No newline at end of file
...@@ -17,6 +17,22 @@ ...@@ -17,6 +17,22 @@
border-top-left-radius: 10rpx; border-top-left-radius: 10rpx;
border-bottom-left-radius: 10rpx; border-bottom-left-radius: 10rpx;
} }
.sale-price{
color: rgba(170, 170, 170, 1);
font-size: 22rpx;
margin-left: 12rpx;
text-decoration: line-through;
}
.hot-img-box{
position: relative;
}
.limited-icon{
position: absolute;
height: 36rpx;
width: 91rpx;
top: 0;
left: 0;
}
.hot-item-desc { .hot-item-desc {
margin-left: 28rpx; margin-left: 28rpx;
margin-top: 33rpx; margin-top: 33rpx;
......
<!--component/scrollDel/scrollDel.wxml--> <!-- component/scrollDel/scrollDel.wxml -->
<!--<scroll-view scroll-y="{{isScroll}}" style='height:{{windowHeight}}px'>--> <!-- <scroll-view scroll-y="{{isScroll}}" style='height:{{windowHeight}}px'> -->
<wxs src="../../wxs/utils.wxs" module="utils" /> <wxs src="../../wxs/utils.wxs" module="utils" />
<scroll-view scroll-y="{{isScroll}}"> <scroll-view scroll-y="{{isScroll}}">
<block class="cart-item" wx:key="item" wx:for="{{cartList}}"> <block class="cart-item" wx:key="item" wx:for="{{cartList}}">
<view data-index='{{index}}' <view data-index='{{index}}' class="order-item cart-list" bindtouchstart="drawStart" bindtouchmove="drawMove" bindtouchend="drawEnd" style="right:{{item.right}}rpx">
class="order-item cart-list" <!-- 遮盖层 -->
bindtouchstart="drawStart" <view data-index="{{index}}" class="checke-item" catchtap="checkPro">
bindtouchmove="drawMove" <icon size="18" type="{{item.checked ? 'success' : 'circle'}}" color="{{checkedColor}}" data-index="{{index}}"></icon>
bindtouchend="drawEnd" </view>
style="right:{{item.right}}rpx"> <!-- bindtap="bindTapItem" data-id="{{item.id}}" -->
<!--遮盖层 --> <!-- productStatus 0未发布1下架2上架3删除 -->
<view data-index="{{index}}" class="checke-item" catchtap="checkPro"> <view class="pro-info" bindtap="bindTapItem" data-id="{{item.productId}}" style='border-bottom:{{index == (cartList.length -1) ? "none" : "1rpx solid #eeeeee" }};opacity:{{(item.productStatus == 0 || item.productStatus == 1 || item.productStatus == 3) ? 0.2 : 1}};'>
<icon size="18" type="{{item.checked ? 'success' : 'circle'}}" color="{{checkedColor}}" data-index="{{index}}" ></icon> <image wx:if="{{item.activityPrice}}" class="limited-icon" src="https://img3.bigaka.com/prd/3001/202005/20200508/3001a6dcdf69-369a-4f43-8757-60f071946ea8.png" />
<image class="pro-img" src="{{item.skuImgUrl}}" wx:if="{{!utils.isVideo(item.skuImgUrl)}}" mode="widthFix"></image>
<video id="myVideo" class="hot-img" src="{{item.skuImgUrl}}" muted wx:if="{{utils.isVideo(item.skuImgUrl)}}"></video>
<view class="pro-right-info">
<view class="pro-name">{{item.productName}}</view>
<view class="pro-sku">{{item.skuSpec}}</view>
<view class="pro-price">
<view class="price">
<text >¥{{item.activityPrice?item.activityPrice:item.price}}</text>
<text class="sale-price" wx:if="{{item.activityPrice}}">¥{{item.price}}</text>
</view>
<view class="pro-num-edit">
<button class="redus-num" data-index="{{index}}" catchtap="minusNum">
-
</button>
<input class="pro-num-edit-input" disabled type="number" data-index="{{index}}" catchtap bindblur="blurNum" bindinput="inputNum" value="{{item.count}}"></input>
<button class="add-num" data-index="{{index}}" catchtap="addNum">
+
</button>
</view>
</view>
</view>
</view>
<view class="remove" data-index="{{index}}" data-skuId="{{item.skuId}}" bindtap="delItem">
删除
</view>
</view> </view>
<!-- bindtap="bindTapItem" data-id="{{item.id}}" --> </block>
<!-- productStatus 0未发布1下架2上架3删除 -->
<view class="pro-info" bindtap="bindTapItem" data-id="{{item.productId}}"
style='border-bottom:{{index == (cartList.length -1) ? "none" : "1rpx solid #eeeeee" }};opacity:{{(item.productStatus == 0 || item.productStatus == 1 || item.productStatus == 3) ? 0.2 : 1}};'>
<image class="pro-img" src="{{item.skuImgUrl}}"
wx:if="{{!utils.isVideo(item.skuImgUrl)}}"
mode="widthFix"></image>
<video id="myVideo"
class="hot-img"
src="{{item.skuImgUrl}}"
muted
wx:if="{{utils.isVideo(item.skuImgUrl)}}"></video>
<view class="pro-right-info">
<view class="pro-name">{{item.productName}}</view>
<view class="pro-sku">{{item.skuSpec}}</view>
<view class="pro-price">
<view class="price">¥{{item.price}}</view>
<view class="pro-num-edit">
<button class="redus-num" data-index="{{index}}" catchtap="minusNum">-</button>
<input class="pro-num-edit-input" disabled type="number"
data-index="{{index}}" catchtap bindblur="blurNum" bindinput="inputNum" value="{{item.count}}"></input>
<button class="add-num" data-index="{{index}}" catchtap="addNum">+</button>
</view>
</view>
</view>
</view>
<view class="remove" data-index="{{index}}" data-skuId="{{item.skuId}}" bindtap="delItem">删除 </view>
</view>
</block>
</scroll-view> </scroll-view>
\ No newline at end of file
...@@ -23,9 +23,26 @@ ...@@ -23,9 +23,26 @@
display: flex; display: flex;
overflow: hidden; overflow: hidden;
} }
.pro-info{
position: relative;
}
.sale-price{
color: rgba(170, 170, 170, 1);
font-size: 22rpx;
margin-left: 12rpx;
text-decoration: line-through;
}
.cart-item:last-child .pro-info{ .cart-item:last-child .pro-info{
border-bottom: none; border-bottom: none;
} }
.limited-icon{
position: absolute;
height: 36rpx;
width: 91rpx;
top: 0;
left: 0;
}
.pro-info:last-child{ .pro-info:last-child{
border-bottom: none; border-bottom: none;
......
...@@ -311,7 +311,7 @@ Component({ ...@@ -311,7 +311,7 @@ Component({
if (flag) { if (flag) {
this.setData({ this.setData({
skuStock: this.data.skuInfos[i].stock, skuStock: this.data.skuInfos[i].stock,
salePrice: this.data.skuInfos[i].salePrice, salePrice: this.data.skuInfos[i].activityPrice ? this.data.skuInfos[i].activityPrice : this.data.skuInfos[i].salePrice ,
picUrl: this.data.skuInfos[i].picUrl, picUrl: this.data.skuInfos[i].picUrl,
skuId: this.data.skuInfos[i].skuId skuId: this.data.skuInfos[i].skuId
}) })
...@@ -347,7 +347,7 @@ Component({ ...@@ -347,7 +347,7 @@ Component({
if (flag) { if (flag) {
skuStock = item.stock skuStock = item.stock
skuId = item.skuId skuId = item.skuId
salePrice = item.salePrice salePrice = item.activityPrice ? item.activityPrice : item.salePrice
picUrl = item.picUrl picUrl = item.picUrl
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// 修改 BRANCH_ID 为对应的商户id // 修改 BRANCH_ID 为对应的商户id
// app.js 中brandId 修改为对应 // app.js 中brandId 修改为对应
const PROJECT_ENV = 'dev' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
//仅生产环境时 配置 : //仅生产环境时 配置 :
//3001 3001 , wx313ec36b710125d4 有直播 //3001 3001 , wx313ec36b710125d4 有直播
//2006 泰华 , wx40fec8944623c8b3 有直播 //门户 wx833d5ece112fc3fd //2006 泰华 , wx40fec8944623c8b3 有直播 //门户 wx833d5ece112fc3fd
...@@ -26,7 +26,7 @@ const PROJECT_ENV = 'dev' // 生产 prod, 开发 dev, 测试 test , 测试门户 ...@@ -26,7 +26,7 @@ const PROJECT_ENV = 'dev' // 生产 prod, 开发 dev, 测试 test , 测试门户
//2002 巴黎贝甜 wx21968cb3a486d4ab //2002 巴黎贝甜 wx21968cb3a486d4ab
//2014 包小姐与鞋先生 wxa00302e2f53dd9c5 //2014 包小姐与鞋先生 wxa00302e2f53dd9c5
const BRANCH_ID = 1001 const BRANCH_ID = 1002
const isMall = true const isMall = true
// const needMock = '' // // const needMock = '' //
......
...@@ -2,617 +2,621 @@ ...@@ -2,617 +2,621 @@
const wxService = require('../../utils/wxService') const wxService = require('../../utils/wxService')
wxService.page({ wxService.page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
product: { product: {
quantity: 1 quantity: 1
},
isAllSelect: false,
currentHeight: 52,
startX: '',
delBtnWidth: 66,//删除按钮宽度单位(rpx)
cartList: [],
outGoods: [],
checkAll: false,
checkedColor: 'rgb(203, 60, 60)',
shopCartTotalFee: 0, // 商品总价
invalidCarts: []
}, },
isAllSelect: false,
currentHeight: 52, /**
startX: '', * 生命周期函数--监听页面加载
delBtnWidth: 66,//删除按钮宽度单位(rpx) */
cartList: [], onLoad() {
outGoods: [], wx.hideShareMenu()
checkAll: false, wxService.getSystemInfo().then(res => {
checkedColor: 'rgb(203, 60, 60)', const { statusBarHeight } = res
shopCartTotalFee: 0, // 商品总价 const { currentHeight, currentMarginTop, currentPaddingTop } = this.data
invalidCarts : [] this.setData({
}, currentHeight: currentHeight + statusBarHeight,
})
/** })
* 生命周期函数--监听页面加载 },
*/
onLoad() { /**
wx.hideShareMenu() * 生命周期函数--监听页面显示
wxService.getSystemInfo().then(res => { */
const { statusBarHeight } = res onShow: function () {
const { currentHeight, currentMarginTop, currentPaddingTop } = this.data if (typeof this.getTabBar === 'function' &&
this.setData({ this.getTabBar()) {
currentHeight: currentHeight + statusBarHeight, this.getTabBar().setData({
}) selected: 2
}) })
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (typeof this.getTabBar === 'function' &&
this.getTabBar()) {
this.getTabBar().setData({
selected: 2
})
}
this.setData({
checkAll : false,
shopCartTotalFee : 0,
});
this.init()
},
init() {
wx.showLoading({
title: '加载中'
})
// 1556108807316001
// 1556108807316000
this.getCartList();
},
// 查询 /trolley/query
getCartList(refresh) {
wx.showLoading({
title: '加载中'
})
wxService.get('/sale/trolley/query').then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading();
let list = data.skuVOList ? data.skuVOList : [];
// item.checked
//这里进行区分已经失效和未失效
// productStatus 0未发布1下架2上架3删除
let invalidCarts = [], validateCarts = [];
list.forEach(item=>{
item.checked = false;
if(item.productStatus == 2){
validateCarts.push(item);
}
else{
invalidCarts.push(item);
}
});
this.setData({
cartList: validateCarts,
invalidCarts : invalidCarts,
checkAll : false,
shopCartTotalFee : 0,
})
} }
}
if(refresh){ this.setData({
wx.showToast({ checkAll: false,
title: '刷新成功', shopCartTotalFee: 0,
}); });
wx.stopPullDownRefresh();
} this.init()
}) },
},
minusNumChange(e) { init() {
this.minusNum(e.detail) wx.showLoading({
}, title: '加载中'
minusNum: function (e) { // 减少数量 })
let cartList = this.data.cartList // 1556108807316001
// let proNum = cartList[e.currentTarget.dataset.index].count; // 1556108807316000
this.getCartList();
let proNum = cartList[e].count },
if (proNum > 1) {
proNum-- // 查询 /trolley/query
} else { getCartList(refresh) {
wx.showToast({ wx.showLoading({
title: '数量不能为0', title: '加载中'
icon: 'none' })
}) wxService.get('/sale/trolley/query').then(res => {
return false if (res) {
} const { result, data } = res.data
// cartList[e.currentTarget.dataset.index].count = proNum if (result == 0) {
cartList[e].count = proNum wx.hideLoading();
this.setData({ let list = data.skuVOList ? data.skuVOList : [];
cartList: cartList // item.checked
}, function () { //这里进行区分已经失效和未失效
this.setTotalFee() // productStatus 0未发布1下架2上架3删除
this.inputProNumber(cartList[e]) // update let invalidCarts = [], validateCarts = [];
// this.editOk(cartList[e]) //调用完成 list.forEach(item => {
}) if(item.activityPrice){
}, // item.price = (item.activityPrice/10/10).toFixed(2)
addNumChange(e) { item.activityPrice = (item.activityPrice/10/10).toFixed(2)
this.addNum(e.detail) }
}, item.checked = false;
addNum (e) { // 增加数量 if (item.productStatus == 2) {
var cartList = this.data.cartList validateCarts.push(item);
// var proNum = cartList[e.currentTarget.dataset.index].count }
var proNum = cartList[e].count else {
// 判断库存 invalidCarts.push(item);
if (proNum < 100) { }
proNum++ });
} else {
wx.showToast({ this.setData({
title: '不能超过库存', cartList: validateCarts,
icon: 'none' invalidCarts: invalidCarts,
}) checkAll: false,
return false shopCartTotalFee: 0,
} })
}
cartList[e].count = proNum }
this.setData({
cartList: cartList if (refresh) {
}, function () { wx.showToast({
this.setTotalFee() title: '刷新成功',
});
this.inputProNumber(cartList[e]) // update wx.stopPullDownRefresh();
// this.editOk(cartList[e]) // add调用完成 }
}) })
}, },
blurNumChange(e) { minusNumChange(e) {
this.blurNum(e.detail) this.minusNum(e.detail)
}, },
blurNum (e) { minusNum: function (e) { // 减少数量
var newNum = e.value let cartList = this.data.cartList
// var newNum = e.detail.value // let proNum = cartList[e.currentTarget.dataset.index].count;
var cartList = this.data.cartList
if (newNum === '') { let proNum = cartList[e].count
newNum = 1 if (proNum > 1) {
} proNum--
cartList[e.index].count = newNum
this.setData({
cartList: cartList
}, function () {
this.setTotalFee()
this.inputProNumber(cartList[e.index]) //调用完成
})
},
inputNumChange(e) {
this.inputNum(e.detail)
},
inputNum: function (e) { // 输入数量
// var newNum = e.detail.value
var newNum = e.value
if (newNum) {
const { cartList } = this.data
if (newNum === '0') {
newNum = 1
} else {
newNum = parseInt(newNum)
}
cartList[e.index].count = newNum
this.setData({
cartList: cartList
}, function () {
this.setTotalFee()
this.inputProNumber(cartList[e.index]) //调用完成
})
}
},
setTotalFee(skipRedemption) {
var cartList = this.data.cartList
var checkProsId = [] // 选中的商品id
var totalFee = 0
// 购物车总金额
for (let i = 0; i < cartList.length; i++) {
if (cartList[i].checked) {
totalFee += cartList[i].price * (cartList[i].count ? cartList[i].count : 1)
checkProsId.push(cartList[i].skuId)
}
}
this.setData({
shopCartTotalFee: totalFee.toFixed(2)
})
},
goBuy() {
let skuIds = []
let trolleySku2Buy = []
let specIds = []
let quantitys = []
let redemptionSpecIds = []
let cartListData = this.data.cartList || []
if (!cartListData) return false
cartListData.filter(item => { // 选中的商品信息
return item.checked
}).map(item => {
if(!item.skuId) return false
let trolleySku2BuyObj = {
count: 0,
skuId: 0
}
trolleySku2BuyObj.count = item.count - 0
trolleySku2BuyObj.skuId = item.skuId
// skuIds.push(item.skuId)
trolleySku2Buy.push(trolleySku2BuyObj)
})
if (trolleySku2Buy.length == 0) {
wx.showToast({
title: '请选择商品',
icon: 'none'
})
return false
}
// 去下单页 && 参数
let tradeDto = {
trolleySku2Buy:JSON.stringify(trolleySku2Buy)
}
const parmas = tradeDto
wxService
.router('/pages/confirmOrder/confirmOrder')
.search(parmas)
// wxService
// .router('/pages/confirmOrder/confirmOrder')
// .search(parmas)
// 直接调支付
// this.handleGoBuy(skuIds)
},
// 调整商品 /trolley/add
editOk(cartPro) {
// count skuId
wx.showLoading({
title: '加载中'
})
wxService.post(`/sale/trolley/add?count=${cartPro.count}&skuId=${cartPro.skuId}`).then(res => {
if (res) {
const { result } = res.data
if (result == 0) {
wx.hideLoading()
} else { } else {
wx.showToast({ wx.showToast({
title: res.data.message, title: '数量不能为0',
icon: 'none' icon: 'none'
}) })
return false
} }
} // cartList[e.currentTarget.dataset.index].count = proNum
}) cartList[e].count = proNum
}, this.setData({
cartList: cartList
// 输入商品数量 }, function () {
inputProNumber(cartPro){ this.setTotalFee()
wx.showLoading({ this.inputProNumber(cartList[e]) // update
title: '加载中' // this.editOk(cartList[e]) //调用完成
}) })
wxService.post(`/sale/trolley/update?count=${cartPro.count}&skuId=${cartPro.skuId}`).then(res => { },
if (res) { addNumChange(e) {
const { result } = res.data this.addNum(e.detail)
if (result == 0) { },
wx.hideLoading() addNum(e) { // 增加数量
var cartList = this.data.cartList
// var proNum = cartList[e.currentTarget.dataset.index].count
var proNum = cartList[e].count
// 判断库存
if (proNum < 100) {
proNum++
} else { } else {
wx.showToast({ wx.showToast({
title: res.data.message, title: '不能超过库存',
icon: 'none' icon: 'none'
}) })
return false
}
cartList[e].count = proNum
this.setData({
cartList: cartList
}, function () {
this.setTotalFee()
this.inputProNumber(cartList[e]) // update
// this.editOk(cartList[e]) // add调用完成
})
},
blurNumChange(e) {
this.blurNum(e.detail)
},
blurNum(e) {
var newNum = e.value
// var newNum = e.detail.value
var cartList = this.data.cartList
if (newNum === '') {
newNum = 1
}
cartList[e.index].count = newNum
this.setData({
cartList: cartList
}, function () {
this.setTotalFee()
this.inputProNumber(cartList[e.index]) //调用完成
})
},
inputNumChange(e) {
this.inputNum(e.detail)
},
inputNum: function (e) { // 输入数量
// var newNum = e.detail.value
var newNum = e.value
if (newNum) {
const { cartList } = this.data
if (newNum === '0') {
newNum = 1
} else {
newNum = parseInt(newNum)
}
cartList[e.index].count = newNum
this.setData({
cartList: cartList
}, function () {
this.setTotalFee()
this.inputProNumber(cartList[e.index]) //调用完成
})
}
},
setTotalFee(skipRedemption) {
var cartList = this.data.cartList
var checkProsId = [] // 选中的商品id
var totalFee = 0
// 购物车总金额
for (let i = 0; i < cartList.length; i++) {
if (cartList[i].checked) {
totalFee += cartList[i].price * (cartList[i].count ? cartList[i].count : 1)
checkProsId.push(cartList[i].skuId)
}
} }
}
}) this.setData({
}, shopCartTotalFee: totalFee.toFixed(2)
checkProChange(e) { })
this.checkPro(e.detail)
}, },
checkPro: function (e) { // 选中商品 goBuy() {
var cartList = this.data.cartList let skuIds = []
var index = e; let trolleySku2Buy = []
let productStatus = cartList[index].productStatus; let specIds = []
if (productStatus == 0 || productStatus == 1 || productStatus == 3){ let quantitys = []
wx.showToast({ let redemptionSpecIds = []
title: '此商品已下架或不存在', let cartListData = this.data.cartList || []
icon : 'none'
}); if (!cartListData) return false
return ; cartListData.filter(item => { // 选中的商品信息
} return item.checked
}).map(item => {
var checkAll = false if (!item.skuId) return false
if (cartList[index].checked) { let trolleySku2BuyObj = {
cartList[index].checked = false count: 0,
} else { skuId: 0
cartList[index].checked = true }
} trolleySku2BuyObj.count = item.count - 0
trolleySku2BuyObj.skuId = item.skuId
if (cartList.length === cartList.filter(function (item) { // skuIds.push(item.skuId)
return item.checked trolleySku2Buy.push(trolleySku2BuyObj)
}).length ) { })
checkAll = true
}else { if (trolleySku2Buy.length == 0) {
checkAll = false
}
this.setData({
cartList: cartList,
checkAll: checkAll
}, function () {
this.setTotalFee()
})
},
checkAll: function () { // 全选
var cartList = this.data.cartList || [];
let offLineProducts = [];
cartList.forEach((item,index) => {
if (item.productStatus == 0 || item.productStatus == 1 || item.productStatus == 3){
offLineProducts.push(item.productName);
}
});
if (offLineProducts.length > 0){
let toastText = offLineProducts.join(',');
wx.showToast({
title: '您购物车中商品:' + toastText + ' 已下架或不存在!',
icon : 'none'
});
return ;
}
if(!cartList.length) return false
if (this.data.checkAll) {
this.setData({
cartList: cartList.map(function (item) {
item.checked = false
return item
}),
checkAll: false
}, function () {
this.setTotalFee()
})
} else {
this.setData({
cartList: cartList.map(function (item) {
// 区分失效商品
item.checked = true
return item
}),
checkAll: true
}, function () {
this.setTotalFee()
})
}
},
delItemChange(e) {
this.deletePro(e.detail)
},
//失效商品话滑动删除
delInvalidItemChange(e){
const {index, skuid} = e.detail;
var self = this
wx.showModal({
title: '提示',
content: '确认删除购物车中该商品?',
success(res) {
if (res.confirm) {
var invalidCarts = self.data.invalidCarts
invalidCarts = invalidCarts.filter((item, i) => {
return i !== index
})
self.setData({
invalidCarts: invalidCarts
})
self.editDelOk(skuid) //调用完成
}
}
})
},
//清空失效商品
onTapEmptyInvlidCarts(){
let self = this;
wx.showModal({
title: '提示',
content: '确认清空购物车中已失效的商品?',
success(res) {
if (res.confirm) {
wx.showLoading('清除中...');
let promiseArr = [];
self.data.invalidCarts.forEach(item => {
let skuId = item.skuId;
let tempPromise = wxService.post(`/sale/trolley/remove?skuId=${skuId}`);
promiseArr.push(tempPromise);
});
Promise.all(promiseArr).then(promiseArr => {
wx.hideLoading();
wx.showToast({ wx.showToast({
title: '清除成功', title: '请选择商品',
}); icon: 'none'
self.setData({ })
invalidCarts : [], return false
}); }
}).catch(err => {
wx.hideLoading(); // 去下单页 && 参数
let tradeDto = {
trolleySku2Buy: JSON.stringify(trolleySku2Buy)
}
const parmas = tradeDto
wxService
.router('/pages/confirmOrder/confirmOrder')
.search(parmas)
// wxService
// .router('/pages/confirmOrder/confirmOrder')
// .search(parmas)
// 直接调支付
// this.handleGoBuy(skuIds)
},
// 调整商品 /trolley/add
editOk(cartPro) {
// count skuId
wx.showLoading({
title: '加载中'
})
wxService.post(`/sale/trolley/add?count=${cartPro.count}&skuId=${cartPro.skuId}`).then(res => {
if (res) {
const { result } = res.data
if (result == 0) {
wx.hideLoading()
} else {
wx.showToast({
title: res.data.message,
icon: 'none'
})
}
}
})
},
// 输入商品数量
inputProNumber(cartPro) {
wx.showLoading({
title: '加载中'
})
wxService.post(`/sale/trolley/update?count=${cartPro.count}&skuId=${cartPro.skuId}`).then(res => {
if (res) {
const { result } = res.data
if (result == 0) {
wx.hideLoading()
} else {
wx.showToast({
title: res.data.message,
icon: 'none'
})
}
}
})
},
checkProChange(e) {
this.checkPro(e.detail)
},
checkPro: function (e) { // 选中商品
var cartList = this.data.cartList
var index = e;
let productStatus = cartList[index].productStatus;
if (productStatus == 0 || productStatus == 1 || productStatus == 3) {
wx.showToast({ wx.showToast({
title: '清除失败,请稍后再试', title: '此商品已下架或不存在',
icon : 'none' icon: 'none'
}); });
}) return;
} }
}
}); var checkAll = false
}, if (cartList[index].checked) {
//清空有效宝贝 cartList[index].checked = false
onTapEmptyValidCarts(){ } else {
let self = this; cartList[index].checked = true
let checked = self.data.cartList.filter(item => item.checked); }
if(checked.length == 0){
wx.showToast({ if (cartList.length === cartList.filter(function (item) {
title: '请先勾选需要删除的商品', return item.checked
icon : 'none' }).length) {
}); checkAll = true
} else {
return ; checkAll = false
} }
wx.showModal({ this.setData({
title: '提示', cartList: cartList,
content: '确认删除购物车中勾选的宝贝?', checkAll: checkAll
success(res) { }, function () {
if (res.confirm) { this.setTotalFee()
wx.showLoading('清除中...'); })
let promiseArr = []; },
checked.forEach(item => { checkAll: function () { // 全选
let skuId = item.skuId; var cartList = this.data.cartList || [];
let tempPromise = wxService.post(`/sale/trolley/remove?skuId=${skuId}`); let offLineProducts = [];
promiseArr.push(tempPromise); cartList.forEach((item, index) => {
}); if (item.productStatus == 0 || item.productStatus == 1 || item.productStatus == 3) {
offLineProducts.push(item.productName);
Promise.all(promiseArr).then(promiseArr => { }
wx.hideLoading(); });
if (offLineProducts.length > 0) {
let toastText = offLineProducts.join(',');
wx.showToast({ wx.showToast({
title: '清除成功', title: '您购物车中商品:' + toastText + ' 已下架或不存在!',
icon: 'none'
}); });
self.getCartList();
}).catch(err => { return;
wx.hideLoading(); }
if (!cartList.length) return false
if (this.data.checkAll) {
this.setData({
cartList: cartList.map(function (item) {
item.checked = false
return item
}),
checkAll: false
}, function () {
this.setTotalFee()
})
} else {
this.setData({
cartList: cartList.map(function (item) {
// 区分失效商品
item.checked = true
return item
}),
checkAll: true
}, function () {
this.setTotalFee()
})
}
},
delItemChange(e) {
this.deletePro(e.detail)
},
//失效商品话滑动删除
delInvalidItemChange(e) {
const { index, skuid } = e.detail;
var self = this
wx.showModal({
title: '提示',
content: '确认删除购物车中该商品?',
success(res) {
if (res.confirm) {
var invalidCarts = self.data.invalidCarts
invalidCarts = invalidCarts.filter((item, i) => {
return i !== index
})
self.setData({
invalidCarts: invalidCarts
})
self.editDelOk(skuid) //调用完成
}
}
})
},
//清空失效商品
onTapEmptyInvlidCarts() {
let self = this;
wx.showModal({
title: '提示',
content: '确认清空购物车中已失效的商品?',
success(res) {
if (res.confirm) {
wx.showLoading('清除中...');
let promiseArr = [];
self.data.invalidCarts.forEach(item => {
let skuId = item.skuId;
let tempPromise = wxService.post(`/sale/trolley/remove?skuId=${skuId}`);
promiseArr.push(tempPromise);
});
Promise.all(promiseArr).then(promiseArr => {
wx.hideLoading();
wx.showToast({
title: '清除成功',
});
self.setData({
invalidCarts: [],
});
}).catch(err => {
wx.hideLoading();
wx.showToast({
title: '清除失败,请稍后再试',
icon: 'none'
});
})
}
}
});
},
//清空有效宝贝
onTapEmptyValidCarts() {
let self = this;
let checked = self.data.cartList.filter(item => item.checked);
if (checked.length == 0) {
wx.showToast({ wx.showToast({
title: '清除失败,请稍后再试', title: '请先勾选需要删除的商品',
icon : 'none' icon: 'none'
}); });
});
return;
} }
}
}); wx.showModal({
}, title: '提示',
//删除商品 content: '确认删除购物车中勾选的宝贝?',
deletePro(e) { success(res) {
const {index, skuid} = e if (res.confirm) {
var self = this wx.showLoading('清除中...');
wx.showModal({ let promiseArr = [];
title: '提示', checked.forEach(item => {
content: '确认删除购物车中该商品?', let skuId = item.skuId;
success(res) { let tempPromise = wxService.post(`/sale/trolley/remove?skuId=${skuId}`);
if (res.confirm) { promiseArr.push(tempPromise);
var cartList = self.data.cartList });
cartList = cartList.filter((item, i) => {
return i !== index Promise.all(promiseArr).then(promiseArr => {
}) wx.hideLoading();
self.setData({ wx.showToast({
cartList: cartList title: '清除成功',
}) });
self.editDelOk(skuid) //调用完成 self.getCartList();
var totalFee = 0 }).catch(err => {
// 购物车总金额 wx.hideLoading();
for (let i = 0; i < cartList.length; i++) { wx.showToast({
if (cartList[i].checked) { title: '清除失败,请稍后再试',
totalFee += cartList[i].price * (cartList[i].count ? cartList[i].count : 1) icon: 'none'
});
});
}
} }
} });
self.setData({ },
shopCartTotalFee: totalFee.toFixed(2) //删除商品
}) deletePro(e) {
} else if (res.cancel) { const { index, skuid } = e
// console.log('用户点击取消') var self = this
wx.showModal({
title: '提示',
content: '确认删除购物车中该商品?',
success(res) {
if (res.confirm) {
var cartList = self.data.cartList
cartList = cartList.filter((item, i) => {
return i !== index
})
self.setData({
cartList: cartList
})
self.editDelOk(skuid) //调用完成
var totalFee = 0
// 购物车总金额
for (let i = 0; i < cartList.length; i++) {
if (cartList[i].checked) {
totalFee += cartList[i].price * (cartList[i].count ? cartList[i].count : 1)
}
}
self.setData({
shopCartTotalFee: totalFee.toFixed(2)
})
} else if (res.cancel) {
// console.log('用户点击取消')
}
}
})
},
editDelOk(skuId) {
wx.showLoading({
title: '加载中'
})
wxService.post(`/sale/trolley/remove?skuId=${skuId}`).then(res => {
if (res) {
const { result } = res.data
if (result == 0) {
wx.hideLoading()
setTimeout(() => {
wx.showToast({
title: '删除成功'
})
setTimeout(() => {
wx.hideToast();
}, 2000)
}, 100);
} else {
wx.showToast({
title: res.data.message,
icon: 'none'
})
}
}
})
},
// 开始滑动事件
touchS: function (e) {
if (e.touches.length == 1) {
this.setData({
//设置触摸起始点水平方向位置
startX: e.touches[0].clientX
});
} }
} },
}) touchM: function (e) {
}, if (e.touches.length == 1) {
editDelOk(skuId) { //手指移动时水平方向位置
wx.showLoading({ var moveX = e.touches[0].clientX;
title: '加载中' //手指起始点位置与移动期间的差值
}) var disX = this.data.startX - moveX;
wxService.post(`/sale/trolley/remove?skuId=${skuId}`).then(res => { var delBtnWidth = this.data.delBtnWidth;
if (res) { var txtStyle = "";
const { result } = res.data if (disX == 0 || disX < 0) { //如果移动距离小于等于0,文本层位置不变
if (result == 0) { txtStyle = "margin-left:0px";
wx.hideLoading() } else if (disX > 0) { //移动距离大于0,文本层left值等于手指移动距离
setTimeout(() => { txtStyle = "margin-left:-" + disX + "px";
wx.showToast({ if (disX >= delBtnWidth) {
title: '删除成功' //控制手指移动距离最大值为删除按钮的宽度
}) txtStyle = "margin-left:-" + delBtnWidth + "px";
setTimeout(() => { }
wx.hideToast(); }
}, 2000) var index = e.currentTarget.dataset.index;
}, 100); var cartList = this.data.cartList;
} else { cartList[index].shows = txtStyle;
wx.showToast({ //更新列表的状态
title: res.data.message, this.setData({
icon: 'none' cartList: cartList
}) });
} }
} },
}) // 滑动中事件
}, touchE: function (e) {
// 开始滑动事件 if (e.changedTouches.length == 1) {
touchS: function (e) { //手指移动结束后水平位置
if (e.touches.length == 1) { var endX = e.changedTouches[0].clientX;
this.setData({ //触摸开始与结束,手指移动的距离
//设置触摸起始点水平方向位置 var disX = this.data.startX - endX;
startX: e.touches[0].clientX var delBtnWidth = this.data.delBtnWidth;
}); //如果距离小于删除按钮的1/2,不显示删除按钮
} var txtStyle = "";
}, txtStyle = disX > delBtnWidth / 2 ? "margin-left:-" + delBtnWidth + "px" : "margin-left:0px";
touchM: function (e) { //获取手指触摸的是哪一项
if (e.touches.length == 1) { var index = e.currentTarget.dataset.index;
//手指移动时水平方向位置 var cartList = this.data.cartList;
var moveX = e.touches[0].clientX; cartList[index].shows = txtStyle;
//手指起始点位置与移动期间的差值 //更新列表的状态
var disX = this.data.startX - moveX; this.setData({
var delBtnWidth = this.data.delBtnWidth; cartList: cartList
var txtStyle = ""; });
if (disX == 0 || disX < 0) { //如果移动距离小于等于0,文本层位置不变 } else {
txtStyle = "margin-left:0px";
} else if (disX > 0) { //移动距离大于0,文本层left值等于手指移动距离
txtStyle = "margin-left:-" + disX + "px";
if (disX >= delBtnWidth) {
//控制手指移动距离最大值为删除按钮的宽度
txtStyle = "margin-left:-" + delBtnWidth + "px";
} }
} },
var index = e.currentTarget.dataset.index; //
var cartList = this.data.cartList; /**
cartList[index].shows = txtStyle; * 页面相关事件处理函数--监听用户下拉动作
//更新列表的状态 */
this.setData({ onPullDownRefresh: function () {
cartList: cartList this.getCartList(true);
}); },
}
},
// 滑动中事件
touchE: function (e) {
if (e.changedTouches.length == 1) {
//手指移动结束后水平位置
var endX = e.changedTouches[0].clientX;
//触摸开始与结束,手指移动的距离
var disX = this.data.startX - endX;
var delBtnWidth = this.data.delBtnWidth;
//如果距离小于删除按钮的1/2,不显示删除按钮
var txtStyle = "";
txtStyle = disX > delBtnWidth / 2 ? "margin-left:-" + delBtnWidth + "px" : "margin-left:0px";
//获取手指触摸的是哪一项
var index = e.currentTarget.dataset.index;
var cartList = this.data.cartList;
cartList[index].shows = txtStyle;
//更新列表的状态
this.setData({
cartList: cartList
});
} else {
}
},
//
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.getCartList(true);
},
}) })
\ No newline at end of file
...@@ -412,7 +412,7 @@ wxService.page({ ...@@ -412,7 +412,7 @@ wxService.page({
if(result == 0){ if(result == 0){
data.faceAmount = data.couponSetting.faceAmount; data.faceAmount = data.couponSetting.faceAmount;
data.postalDiscountPrice = '0.00'; data.postalDiscountPrice = '0.00';
data.couponSettingId = data.couponSetting.couponSettingId; data.couponId = data.coupon.id;
this.data.currentPostalCoupon = data; this.data.currentPostalCoupon = data;
}else{ }else{
...@@ -1040,7 +1040,7 @@ wxService.page({ ...@@ -1040,7 +1040,7 @@ wxService.page({
//处理包邮券信息 //处理包邮券信息
if(this.data.currentPostalCoupon){ if(this.data.currentPostalCoupon){
params.postCouponSettingId = this.data.currentPostalCoupon.couponSettingId; params.postCouponId = this.data.currentPostalCoupon.couponId;
} }
let _this = this; let _this = this;
......
...@@ -172,6 +172,8 @@ wxService.page({ ...@@ -172,6 +172,8 @@ wxService.page({
}, },
//跳转到我的购买优惠券记录 //跳转到我的购买优惠券记录
onTapToBuyCouponRecords(){ onTapToBuyCouponRecords(){
wx.navigateTo({
url: '/subPackageA/page/pages/moneyBuyCouponRecords/moneyBuyCouponRecords',
});
}, },
}) })
\ No newline at end of file
...@@ -6,522 +6,534 @@ const envInfo = require('../../config/index').envInfo ...@@ -6,522 +6,534 @@ const envInfo = require('../../config/index').envInfo
const orderTopBg = 'https://img3.bigaka.com/prd/3001/202003/20200309/3001a46ba5bf-235d-428b-b7bb-befcf37ff89b.jpg'; const orderTopBg = 'https://img3.bigaka.com/prd/3001/202003/20200309/3001a46ba5bf-235d-428b-b7bb-befcf37ff89b.jpg';
wxService.page({ wxService.page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
detail: null, detail: null,
id: '', id: '',
localNowTime: 0, localNowTime: 0,
hour: '00', hour: '00',
min: '00', min: '00',
sec: '00', sec: '00',
ms: '0', ms: '0',
mergedAmount: 0, mergedAmount: 0,
totalGoodsPrice : 0, totalGoodsPrice: 0,
canApplyRefund : true, canApplyRefund: true,
orderTopBg : orderTopBg, orderTopBg: orderTopBg,
}, },
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.data.id = options.id;
wx.hideShareMenu()
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
const { id } = this.options;
if(id) {
this.setData({
id
},()=>{
this.getOrderDetail(id)
})
}
},
//跳转商品详情
onTapToProductInfo(e){
let sku = e.currentTarget.dataset.item;
let productId = sku.productId;
wx.navigateTo({
url: '/pages/productDetail/productDetail?id=' + productId,
});
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.getOrderDetail(this.data.id);
setTimeout(() => {
wx.stopPullDownRefresh();
}, 500);
},
//获取订单详情
getOrderDetail(id){
wx.showLoading({
title: '加载中',
mask: true
});
wxService.get(`/sale/trade/seller/${id}`).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading();
//处理总数
let skuVOList = data.skuVOList ? data.skuVOList : [];
let sum = 0 ;
skuVOList.forEach(item => {
item.refundCount = item.refundCount ? item.refundCount : 0;
item.canRefundNum = (item.count - item.refundCount) >= 0 ? (item.count - item.refundCount) : 0;
sum = sum + item.price * item.count;
});
//处理收货地址
if (data.logistic){
let receiverInfoArr = data.logistic.receiverInfo.split(',').reverse().filter(item => item);
data.logistic.receiverName = receiverInfoArr[1];
data.logistic.receiverMobile = receiverInfoArr[0];
data.logistic.receiverAddress = receiverInfoArr[2] + receiverInfoArr[3];
}
else{
data.logistic = null;
}
// 处理积分抵扣
data.pointPayInfo = data.pointPayInfo ? data.pointPayInfo : {point:0,pointAmount:0};
//处理能不能退款
let canApplyRefund = true;
let filter = skuVOList.filter(c => c.canRefundNum > 0);
if (filter.length > 0){
canApplyRefund = true;
}
else{
canApplyRefund = false;
}
if(data.status == 'N' || data.status == 'C'){
const { localNowTime} = this.data
data.localNowTime = localNowTime ? localNowTime : new Date().getTime();
data.createOrderTime = new Date(data.createTime.replace(/-/g,'/')).getTime() || [];
data.countDownOrderTime = 7200000; // 2时(h)=7200000毫秒(ms)
// 订单倒计时 超多两小时 刷新当前页
data.orderCanRefund = true;
data.skuVOList.forEach(item => {
item.status = data.status;
});
data.parcelList = [{
code : '',
supplierCode : '',
supplierName : '',
status : data.status,
sendOutList : data.skuVOList,
}];
this.calcuPackageProductCountAndTotalPrice(data); /**
this.data.totalGoodsPrice = parseFloat(sum).toFixed(2); * 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.data.id = options.id;
wx.hideShareMenu()
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
const { id } = this.options;
if (id) {
this.setData({ this.setData({
detail: data, id
totalGoodsPrice: this.data.totalGoodsPrice, }, () => {
mergedAmount: data.mergedAmount || 0, this.getOrderDetail(id)
canApplyRefund: canApplyRefund })
}, ()=>{ }
this.initCountDown(data.countDownOrderTime, data.createOrderTime, data.localNowTime) },
});
} //跳转商品详情
else{ onTapToProductInfo(e) {
let parcelList = data.parcelList ? data.parcelList : []; let sku = e.currentTarget.dataset.item;
if(parcelList.length == 0){ let productId = sku.productId;
parcelList = [{
code : '--', wx.navigateTo({
supplierCode : '--', url: '/pages/productDetail/productDetail?id=' + productId,
supplierName : '--', });
status : data.status, },
orderCanRefund : true,
deliverTime : '--', /**
sendOutList : data.skuVOList, * 页面相关事件处理函数--监听用户下拉动作
}] */
onPullDownRefresh: function () {
data.parcelList = parcelList; this.getOrderDetail(this.data.id);
} setTimeout(() => {
else{ wx.stopPullDownRefresh();
parcelList.forEach(item => { }, 500);
item.code = item.code ? item.code : '--'; },
item.supplierCode = item.supplierCode ? item.supplierCode : '--';
item.supplierName = item.supplierName ? item.supplierName : '--'; //获取订单详情
item.status = item.status; getOrderDetail(id) {
item.deliverTime = item.deliverTime ? item.deliverTime : ''; wx.showLoading({
//计算一下包裹能不能退货 title: '加载中',
let deliverTime = item.deliverTime ? item.deliverTime : null; mask: true
if(deliverTime){ });
let diffObj = utils.getDateDiff(deliverTime);
if (diffObj.days <= this.data.canRefundDaysAfterDelivery){ wxService.get(`/sale/trade/seller/${id}`).then(res => {
item.orderCanRefund = true; if (res) {
} const { result, data } = res.data
else{ if (result == 0) {
item.orderCanRefund = false; wx.hideLoading();
} //处理总数
} let skuVOList = data.skuVOList ? data.skuVOList : [];
else{ let sum = 0;
item.orderCanRefund = true; skuVOList.forEach(item => {
} item.refundCount = item.refundCount ? item.refundCount : 0;
item.canRefundNum = (item.count - item.refundCount) >= 0 ? (item.count - item.refundCount) : 0;
//找商品填充 sum = sum + item.price * item.count;
let sendOutList = []; });
item.sendOutList.forEach(s => {
let filter = data.skuVOList.filter(f => f.skuId == s.skuId); if(data.order.wechatCouponPrice){
if(filter.length > 0){ data.order.wechatCouponPrice = data.order.wechatCouponPrice/10/10;
sendOutList.push(filter[0]); data.payAmount = (data.payAmount *1) - (data.order.wechatCouponPrice*1)
} }
});
if(data.order.postCouponDisCount){
item.sendOutList = sendOutList; data.order.postCouponDisCount = data.order.postCouponDisCount/10/10;
}); }
//处理收货地址
if (data.logistic) {
let receiverInfoArr = data.logistic.receiverInfo.split(',').reverse().filter(item => item);
data.logistic.receiverName = receiverInfoArr[1];
data.logistic.receiverMobile = receiverInfoArr[0];
data.logistic.receiverAddress = receiverInfoArr[2] + receiverInfoArr[3];
}
else {
data.logistic = null;
}
// 处理积分抵扣
data.pointPayInfo = data.pointPayInfo ? data.pointPayInfo : { point: 0, pointAmount: 0 };
data.payAmount = (data.payAmount *1) - (data.pointPayInfo.pointAmount*1);
//处理能不能退款
let canApplyRefund = true;
let filter = skuVOList.filter(c => c.canRefundNum > 0);
if (filter.length > 0) {
canApplyRefund = true;
}
else {
canApplyRefund = false;
}
if (data.status == 'N' || data.status == 'C') {
const { localNowTime } = this.data
data.localNowTime = localNowTime ? localNowTime : new Date().getTime();
data.createOrderTime = new Date(data.createTime.replace(/-/g, '/')).getTime() || [];
data.countDownOrderTime = 7200000; // 2时(h)=7200000毫秒(ms)
// 订单倒计时 超多两小时 刷新当前页
data.orderCanRefund = true;
data.skuVOList.forEach(item => {
item.status = data.status;
});
data.parcelList = [{
code: '',
supplierCode: '',
supplierName: '',
status: data.status,
sendOutList: data.skuVOList,
}];
this.calcuPackageProductCountAndTotalPrice(data);
this.data.totalGoodsPrice = parseFloat(sum).toFixed(2);
this.setData({
detail: data,
totalGoodsPrice: this.data.totalGoodsPrice,
mergedAmount: data.mergedAmount || 0,
canApplyRefund: canApplyRefund
}, () => {
this.initCountDown(data.countDownOrderTime, data.createOrderTime, data.localNowTime)
});
}
else {
let parcelList = data.parcelList ? data.parcelList : [];
if (parcelList.length == 0) {
parcelList = [{
code: '--',
supplierCode: '--',
supplierName: '--',
status: data.status,
orderCanRefund: true,
deliverTime: '--',
sendOutList: data.skuVOList,
}]
data.parcelList = parcelList;
}
else {
parcelList.forEach(item => {
item.code = item.code ? item.code : '--';
item.supplierCode = item.supplierCode ? item.supplierCode : '--';
item.supplierName = item.supplierName ? item.supplierName : '--';
item.status = item.status;
item.deliverTime = item.deliverTime ? item.deliverTime : '';
//计算一下包裹能不能退货
let deliverTime = item.deliverTime ? item.deliverTime : null;
if (deliverTime) {
let diffObj = utils.getDateDiff(deliverTime);
if (diffObj.days <= this.data.canRefundDaysAfterDelivery) {
item.orderCanRefund = true;
}
else {
item.orderCanRefund = false;
}
}
else {
item.orderCanRefund = true;
}
//找商品填充
let sendOutList = [];
item.sendOutList.forEach(s => {
let filter = data.skuVOList.filter(f => f.skuId == s.skuId);
if (filter.length > 0) {
sendOutList.push(filter[0]);
}
});
item.sendOutList = sendOutList;
});
}
this.calcuPackageProductCountAndTotalPrice(data);
this.data.totalGoodsPrice = parseFloat(sum).toFixed(2);
this.setData({
detail: data,
totalGoodsPrice: this.data.totalGoodsPrice,
mergedAmount: data.mergedAmount || 0,
canApplyRefund: canApplyRefund
});
}
}
} }
})
this.calcuPackageProductCountAndTotalPrice(data); },
this.data.totalGoodsPrice = parseFloat(sum).toFixed(2); //计算包裹商品数量和价格
this.setData({ calcuPackageProductCountAndTotalPrice(data) {
detail: data, let parcelList = data.parcelList;
totalGoodsPrice: this.data.totalGoodsPrice, parcelList.forEach(p => {
mergedAmount: data.mergedAmount || 0, let totalCount = 0, totalPrice = 0, totalCanRefundCount = 0;
canApplyRefund: canApplyRefund p.sendOutList.forEach(s => {
totalCount = totalCount + s.count;
totalPrice = totalPrice + s.amount;
totalCanRefundCount = totalCanRefundCount + s.canRefundNum;
}); });
} p.totalCount = totalCount;
} p.totalPrice = parseFloat(totalPrice).toFixed(2);
} //处理每个包裹的可退货数量是否大于0
}) p.totalCanRefundCount = totalCanRefundCount;
}, });
},
//计算包裹商品数量和价格
calcuPackageProductCountAndTotalPrice(data){ initCountDown(countDownOrderTime, startTime, localTime) {
let parcelList = data.parcelList; // 毫秒差 本地时间 - 创建时间
parcelList.forEach(p => { let countTimeSpan = localTime - startTime
let totalCount = 0, totalPrice = 0 , totalCanRefundCount = 0;
p.sendOutList.forEach(s => { let countDownTimer = setInterval(() => {
totalCount = totalCount + s.count; countDownOrderTime -= 1000
totalPrice = totalPrice + s.amount; let result = this.getCountDown(countTimeSpan, countDownOrderTime);
totalCanRefundCount = totalCanRefundCount + s.canRefundNum ; if (result.isOver) {
}); clearInterval(countDownTimer);
p.totalCount = totalCount; } else {
p.totalPrice = parseFloat(totalPrice).toFixed(2); this.setData({
//处理每个包裹的可退货数量是否大于0 hour: result.hour,
p.totalCanRefundCount = totalCanRefundCount; min: result.min,
}); sec: result.sec,
}, ms: result.ms,
})
initCountDown(countDownOrderTime,startTime,localTime) { }
// 毫秒差 本地时间 - 创建时间 }, 1000);
let countTimeSpan = localTime - startTime },
getCountDown(time, countDownOrderTime) {
let countDownTimer = setInterval(() => { // 判断是否为时间戳
countDownOrderTime -= 1000 let distancetime = time < countDownOrderTime ? countDownOrderTime - time : 0;
let result = this.getCountDown(countTimeSpan, countDownOrderTime);
if (result.isOver) { // 毫秒差 本地时间 - 创建时间 7200000毫秒(ms)
clearInterval(countDownTimer); let result = {
} else { hour: '00',
this.setData({ min: '00',
hour: result.hour, sec: '00',
min: result.min, ms: '00',
sec: result.sec, isOver: true,
ms: result.ms, };
}) if (distancetime) {
} // 如果大于7200000.说明尚未到达截止时间
}, 1000); result.ms = Math.floor((distancetime % 1000) / 100);
}, result.sec = Math.floor((distancetime / 1000) % 60);
getCountDown(time, countDownOrderTime) { result.min = Math.floor((distancetime / 1000 / 60) % 60);
// 判断是否为时间戳 result.hour = Math.floor((distancetime / 1000 / 60 / 60) % 24);
let distancetime = time < countDownOrderTime ? countDownOrderTime - time : 0; result.isOver = false;
// 毫秒差 本地时间 - 创建时间 7200000毫秒(ms) if (result.ms < 10) result.ms = result.ms;
let result = { if (result.sec < 10) result.sec = '0' + result.sec;
hour: '00', if (result.min < 10) result.min = '0' + result.min;
min: '00', if (result.hour < 10) result.hour = '0' + result.hour;
sec: '00',
ms: '00',
isOver: true,
};
if (distancetime) {
// 如果大于7200000.说明尚未到达截止时间
result.ms = Math.floor((distancetime % 1000) / 100);
result.sec = Math.floor((distancetime / 1000) % 60);
result.min = Math.floor((distancetime / 1000 / 60) % 60);
result.hour = Math.floor((distancetime / 1000 / 60 / 60) % 24);
result.isOver = false;
if (result.ms < 10) result.ms = result.ms;
if (result.sec < 10) result.sec = '0' + result.sec;
if (result.min < 10) result.min = '0' + result.min;
if (result.hour < 10) result.hour = '0' + result.hour;
} else {
const {detail, id} = this.data
if (!this.getDetailLimitCount) {
this.getDetailLimitCount = 1
} else { } else {
this.getDetailLimitCount++ const { detail, id } = this.data
if (!this.getDetailLimitCount) {
this.getDetailLimitCount = 1
} else {
this.getDetailLimitCount++
}
if (this.getDetailLimitCount <= 1 && detail.status == 'N') {
this.getOrderDetail(id)
}
} }
if (this.getDetailLimitCount <= 1 && detail.status == 'N') {
this.getOrderDetail(id) return result;
} },
} // 删除订单
handelDelOrder(e) {
return result; let _this = this;
}, wx.showModal({
// 删除订单 title: '订单删除提示',
handelDelOrder(e) { content: '确认删除此订单?',
let _this = this; showCancel: true,
wx.showModal({ cancelText: '取消',
title: '订单删除提示', confirmText: '删除',
content: '确认删除此订单?', confirmColor: '#cb3c3c',
showCancel: true, success: function (modalRes) {
cancelText: '取消', if (modalRes.confirm) {
confirmText: '删除', const { id } = e.currentTarget.dataset
confirmColor: '#cb3c3c', wx.showLoading({
success: function (modalRes) { title: '订单删除中..',
if (modalRes.confirm) { mask: true
const { id } = e.currentTarget.dataset })
wx.showLoading({ wxService.post(`/sale/trade/buyer/delete/${id}`).then(res => {
title: '订单删除中..', if (res) {
const { result } = res.data
if (result == 0) {
wx.hideLoading()
wx.showToast({
title: `删除成功!`,
});
setTimeout(() => {
wx.navigateBack({
delta: 1
});
}, 500);
} else {
wx.showToast({
title: `删除失败!`,
icon: 'none'
})
}
}
});
}
}
});
},
// 立即支付
handelToPay(e) {
const { id } = e.currentTarget.dataset
wx.showLoading({
title: '加载中',
mask: true mask: true
}) })
wxService.post(`/sale/trade/buyer/delete/${id}`).then(res => {
const { mergedAmount } = this.data
let url = mergedAmount ? `/sale/payment/merged/buyer/wxprepay/${id}` : `/sale/trade/buyer/wxprepay/${id}`
wxService.post(`${url}`).then(res => {
if (res) { if (res) {
const { result } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
wx.hideLoading() let amount = data.amount || 0
wx.showToast({ wx.hideLoading()
title: `删除成功!`, wx.requestPayment(Object.assign({
}); success(res) {
setTimeout(() => { wx.hideLoading()
wx.navigateBack({ // 支付成功页面
delta : 1 // wxService.router(`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=${amount}`)
}); wx.showToast({
}, 500); title: '支付成功',
} else { });
wx.showToast({
title: `删除失败!`, this.getOrderDetail(this.data.id);
icon: 'none' },
}) fail(res) {
} wx.hideLoading()
wx.showToast({
title: '支付失败',
});
}
}, data))
}
} }
}); })
} },
} // 取消订单
}); handelCancelOrder(e) {
let _this = this;
}, wx.showModal({
// 立即支付 title: '订单取消提示',
handelToPay(e) { content: '确认取消此订单?',
const { id } = e.currentTarget.dataset showCancel: true,
wx.showLoading({ cancelText: '再想想',
title: '加载中', confirmText: '取消订单',
mask: true confirmColor: '#cb3c3c',
}) success: function (modalRes) {
if (modalRes.confirm) {
const { mergedAmount } = this.data //跳去开卡
let url = mergedAmount ? `/sale/payment/merged/buyer/wxprepay/${id}` : `/sale/trade/buyer/wxprepay/${id}` const { id } = e.currentTarget.dataset
wxService.post(`${url}`).then(res => { wx.showLoading({
if (res) { title: '订单取消中..',
const { result, data } = res.data mask: true
if (result == 0) { });
let amount = data.amount || 0
wx.hideLoading() wxService.post(`/sale/trade/buyer/cancel/${id}`).then(res => {
wx.requestPayment(Object.assign({ if (res) {
success(res) { const { result } = res.data
wx.hideLoading() if (result == 0) {
// 支付成功页面 wx.hideLoading()
// wxService.router(`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=${amount}`) wx.showToast({
wx.showToast({ title: `取消成功!`,
title: '支付成功', icon: 'none'
}); })
setTimeout(() => {
this.getOrderDetail(this.data.id); _this.getOrderDetail(_this.data.id);
}, }, 200)
fail(res) { } else {
wx.hideLoading() wx.showToast({
wx.showToast({ title: `取消失败!`,
title: '支付失败', icon: 'none'
}); })
}
}
})
}
} }
}, data)) });
},
// 查看物流
checkLogistics(e) {
let { detail } = e.currentTarget.dataset;
let obj = {
id: this.data.id,
logistic: {
supplierName: detail.supplierName,
code: detail.code,
supplierCode: detail.supplierCode,
},
status: detail.status,
}
let params = JSON.stringify(obj);
// // 退款申请
wxService.router(`/pages/logistics/logistics`).search({ params });
},
// 申请退款
handelRequestRefund(e) {
let orderId = e.currentTarget.dataset.id;
let packageInfo = e.currentTarget.dataset.package;
if (packageInfo.totalCanRefundCount <= 0 || !packageInfo.totalCanRefundCount) {
return;
} }
}
}) let detail = {
}, id: orderId,
// 取消订单 skuVOList: packageInfo.sendOutList,
handelCancelOrder(e) { }
let _this = this;
wx.showModal({ let copyOrderInfo = JSON.parse(JSON.stringify(detail));
title: '订单取消提示', //过滤掉已经退货完的商品
content: '确认取消此订单?', copyOrderInfo.skuVOList = copyOrderInfo.skuVOList.filter(item => item.canRefundNum > 0);
showCancel: true, //更新可退货数量
cancelText: '再想想', copyOrderInfo.skuVOList.forEach(item => {
confirmText: '取消订单', item.totalCount = item.count;
confirmColor: '#cb3c3c', item.count = item.canRefundNum;
success: function (modalRes) { });
if (modalRes.confirm) {
//跳去开卡 let params = JSON.stringify(copyOrderInfo);
const { id } = e.currentTarget.dataset // 退款申请
wx.showLoading({ wxService.router(`/pages/refund/refund`).search({ params })
title: '订单取消中..', },
// 确认收货
handelConfirmReceipt(e) {
let id = e.currentTarget.dataset.id;
let packageInfo = e.currentTarget.dataset.package;
let parcelId = packageInfo.id;
wx.showLoading({
title: '加载中',
mask: true mask: true
}); });
wxService.post(`/sale/trade/buyer/cancel/${id}`).then(res => { //兼容老数据
if (parcelId) {
this.packageConfirmReceive(id, parcelId);
}
else {
this.oldVersionConfirmReceive(id);
}
},
//包裹的确认收货
packageConfirmReceive(findId, parcelId) {
wxService.post(`/sale/trade/buyer/parcelConfirm?findId=${findId}&parcelId=${parcelId}`).then(res => {
if (res) { if (res) {
const { result } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
wx.hideLoading() wx.hideLoading()
wx.showToast({ wx.showToast({
title: `取消成功!`, title: `您已确认收货!`,
icon: 'none' icon: 'none'
}) })
setTimeout(() => { setTimeout(() => {
_this.getOrderDetail(_this.data.id); this.getOrderDetail(this.data.id);
}, 200) }, 200)
} else { } else {
wx.showToast({
title: `确认收货失败!`,
icon: 'none'
})
}
}
})
},
//兼容以前老数据进行确认收货
oldVersionConfirmReceive(id) {
wxService.post(`/sale/trade/buyer/confirm/${id}`).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
wx.showToast({
title: `您已确认收货!`,
icon: 'none'
})
setTimeout(() => {
this.getOrderDetail(this.data.id);
}, 200)
} else {
wx.showToast({
title: `确认收货失败!`,
icon: 'none'
})
}
}
})
},
copy(e) {
wx.setClipboardData({
//准备复制的数据
data: e.currentTarget.dataset.content,
success: function (res) {
wx.showToast({ wx.showToast({
title: `取消失败!`, title: '复制成功',
icon: 'none' icon: 'none'
}) });
}
} }
})
}
}
});
},
// 查看物流
checkLogistics(e) {
let { detail } = e.currentTarget.dataset;
let obj = {
id: this.data.id,
logistic: {
supplierName : detail.supplierName,
code : detail.code,
supplierCode : detail.supplierCode,
},
status: detail.status,
}
let params = JSON.stringify(obj);
// // 退款申请
wxService.router(`/pages/logistics/logistics`).search({params});
},
// 申请退款
handelRequestRefund(e) {
let orderId = e.currentTarget.dataset.id;
let packageInfo = e.currentTarget.dataset.package;
if(packageInfo.totalCanRefundCount <= 0 || !packageInfo.totalCanRefundCount){
return ;
}
let detail = {
id : orderId,
skuVOList :packageInfo.sendOutList,
}
let copyOrderInfo = JSON.parse(JSON.stringify(detail));
//过滤掉已经退货完的商品
copyOrderInfo.skuVOList = copyOrderInfo.skuVOList.filter(item => item.canRefundNum > 0);
//更新可退货数量
copyOrderInfo.skuVOList.forEach(item => {
item.totalCount = item.count;
item.count = item.canRefundNum;
});
let params = JSON.stringify(copyOrderInfo);
// 退款申请
wxService.router(`/pages/refund/refund`).search({params})
},
// 确认收货
handelConfirmReceipt(e) {
let id = e.currentTarget.dataset.id;
let packageInfo = e.currentTarget.dataset.package;
let parcelId = packageInfo.id;
wx.showLoading({
title: '加载中',
mask: true
});
//兼容老数据
if(parcelId){
this.packageConfirmReceive(id,parcelId);
}
else{
this.oldVersionConfirmReceive(id);
}
},
//包裹的确认收货
packageConfirmReceive(findId, parcelId){
wxService.post(`/sale/trade/buyer/parcelConfirm?findId=${findId}&parcelId=${parcelId}`).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
wx.showToast({
title: `您已确认收货!`,
icon: 'none'
})
setTimeout(() => {
this.getOrderDetail(this.data.id);
}, 200)
} else {
wx.showToast({
title: `确认收货失败!`,
icon: 'none'
})
}
}
})
},
//兼容以前老数据进行确认收货
oldVersionConfirmReceive(id){
wxService.post(`/sale/trade/buyer/confirm/${id}`).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
wx.showToast({
title: `您已确认收货!`,
icon: 'none'
})
setTimeout(() => {
this.getOrderDetail(this.data.id);
}, 200)
} else {
wx.showToast({
title: `确认收货失败!`,
icon: 'none'
})
}
}
})
},
copy(e) {
wx.setClipboardData({
//准备复制的数据
data: e.currentTarget.dataset.content,
success: function (res) {
wx.showToast({
title: '复制成功',
icon: 'none'
}); });
} },
});
},
}) })
\ No newline at end of file
...@@ -152,8 +152,16 @@ ...@@ -152,8 +152,16 @@
<text>¥{{utils.numberFormat(detail.coouponDiscount)}}</text> <text>¥{{utils.numberFormat(detail.coouponDiscount)}}</text>
</view> </view>
<view class="order-pro-list"> <view class="order-pro-list">
<text>包邮券优惠</text>
<text>¥{{utils.numberFormat(detail.order.postCouponDisCount)}}</text>
</view>
<view class="order-pro-list">
<text>支付券优惠</text>
<text>¥{{utils.numberFormat(detail.order.wechatCouponPrice)}}</text>
</view>
<view class="order-pro-list">
<text class="pay-amount">实付金额</text> <text class="pay-amount">实付金额</text>
<text class="order-price">¥{{detail.payAmount}}</text> <text class="order-price">¥{{detail.payAmount }}</text>
</view> </view>
</view> </view>
<view class="order-number-info"> <view class="order-number-info">
......
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
<view class="product-price"> <view class="product-price">
<view class="price-wrap"> <view class="price-wrap">
<view class="price-icon" wx:if="{{memberLevel}}">会员专享价</view> <view class="price-icon" wx:if="{{memberLevel}}">会员专享价</view>
<text class="price">¥{{utils.numberFormat(productInfo.minSalePrice / 100)}}</text> <text class="price">¥{{ productInfo.minActivityPrice? utils.numberFormat(productInfo.minActivityPrice / 100):utils.numberFormat(productInfo.minSalePrice / 100) }}</text>
<text wx:if="{{productInfo.minActivityPrice}}" class="sale-price">¥{{utils.numberFormat(productInfo.minSalePrice / 100)}}</text>
<!-- <text class="cost-price">¥888</text> --> <!-- <text class="cost-price">¥888</text> -->
</view> </view>
<button <button
...@@ -176,7 +177,7 @@ ...@@ -176,7 +177,7 @@
good-type="{{productInfo.productType}}" good-type="{{productInfo.productType}}"
index-img="{{productInfo.indexUrl}}" index-img="{{productInfo.indexUrl}}"
sku-infos="{{productInfo.productSku}}" sku-infos="{{productInfo.productSku}}"
product-price="{{productInfo.plusPrice ? productInfo.plusPrice : productInfo.minSalePrice}}" product-price="{{ productInfo.plusPrice ? productInfo.plusPrice : productInfo.minSalePrice}}"
show="{{showSkuPopup}}" show="{{showSkuPopup}}"
bind:skuselect="confirmClick" bind:skuselect="confirmClick"
btn-text="{{btnText}}" btn-text="{{btnText}}"
......
...@@ -12,7 +12,12 @@ page{ ...@@ -12,7 +12,12 @@ page{
.swiper-image{ .swiper-image{
width: 100%; width: 100%;
} }
.sale-price{
color: rgba(170, 170, 170, 1);
font-size: 24rpx;
margin-left: 12rpx;
text-decoration: line-through;
}
.video-cover{ .video-cover{
width: 100%; width: 100%;
height: 100%; height: 100%;
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<text class="refund-desc">{{refundDetail.reason}}</text> <text class="refund-desc">{{refundDetail.reason}}</text>
</view> </view>
<view class="refund-item"> <view class="refund-item">
<text class="refund-label">退款时间</text> <text class="refund-label">申请时间</text>
<text class="refund-desc">{{refundDetail.createTime}}</text> <text class="refund-desc">{{refundDetail.createTime}}</text>
</view> </view>
<view class="refund-item"> <view class="refund-item">
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.8.2", "libVersion": "2.8.2",
"appid": "wxc3b64b09b1d3dfc2", "appid": "wxac09792264c49b5c",
"projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E", "projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E",
"debugOptions": { "debugOptions": {
"hidedInDevtools": [] "hidedInDevtools": []
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
"id": 16, "id": 16,
"name": "商品详情页", "name": "商品详情页",
"pathName": "pages/productDetail/productDetail", "pathName": "pages/productDetail/productDetail",
"query": "id=697828280501407744", "query": "id=684465422204145664",
"scene": null "scene": null
}, },
{ {
...@@ -657,6 +657,35 @@ ...@@ -657,6 +657,35 @@
"id": -1, "id": -1,
"name": "领券中心", "name": "领券中心",
"pathName": "subPackage/page/pages/couponCenter/couponCenter", "pathName": "subPackage/page/pages/couponCenter/couponCenter",
"query": "",
"scene": null
},
{
"id": -1,
"name": "限时抢购",
"pathName": "subPackageA/page/pages/TimelimitedSales/TimelimitedSales",
"query": "",
"scene": null
},
{
"id": -1,
"name": "所属门店信息",
"pathName": "subPackageA/page/pages/belongWithGuide/belongWithGuide",
"query": "",
"scene": null
},
{
"id": -1,
"name": "现金购买券记录",
"pathName": "subPackageA/page/pages/moneyBuyCouponRecords/moneyBuyCouponRecords",
"query": "",
"scene": null
},
{
"id": -1,
"name": "subPackage/page/pages/couponCenterInfo/couponCenterInfo",
"pathName": "subPackage/page/pages/couponCenterInfo/couponCenterInfo",
"query": "id=708696469342916608",
"scene": null "scene": null
} }
] ]
......
...@@ -143,7 +143,8 @@ wxService.page({ ...@@ -143,7 +143,8 @@ wxService.page({
}); });
let pageNo = this.data.pageNo, let pageNo = this.data.pageNo,
pageSize = this.data.pageSize; pageSize = this.data.pageSize;
wxService.post(`/sale/product/buyer/listPageByCategoryId?pageNo=${pageNo}&pageSize=${pageSize}`, this.data.form).then(res => { // wxService.post(`/sale/product/buyer/listPageByCategoryId?pageNo=${pageNo}&pageSize=${pageSize}`, this.data.form).then(res => {
wxService.post(`/sale/product/buyer/findCategoryTreeIdByProductList?pageNo=${pageNo}&pageSize=${pageSize}&id=${this.data.form.mallCategoryId}`).then(res => {
const { result, data } = res.data const { result, data } = res.data
if (result == 0 && data.content) { if (result == 0 && data.content) {
wx.hideLoading() wx.hideLoading()
......
...@@ -61,6 +61,7 @@ wxService.page({ ...@@ -61,6 +61,7 @@ wxService.page({
}); });
let id = this.data.activityId; let id = this.data.activityId;
let isStart = this.data.activityInfo.isStart; let isStart = this.data.activityInfo.isStart;
console.log(isStart)
//判断是不是老活动 //判断是不是老活动
if(!this.data.activityInfo.couponList){ if(!this.data.activityInfo.couponList){
this.getCoupon(id); this.getCoupon(id);
...@@ -107,7 +108,41 @@ wxService.page({ ...@@ -107,7 +108,41 @@ wxService.page({
}, },
//立即预约 //立即预约
orderCouponNow(id){ orderCouponNow(id){
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`${'/merchant/message/wxSubMsgMapping/getListByParams'}`, {
scenarioIds: ['usernoticeappointment'],
sourceFrom: 2,
switchType: 3
}).then(res => {
let tempArr = res.data.data ? res.data.data : [];
let tempids = [];
tempArr.map(item => {
tempids.push(item.templateId);
});
wx.requestSubscribeMessage({
tmplIds: tempids,
success: (res) => {
for (let i = 0; i < tempArr.length; i++) {
wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, {
businessId: id,
memberId: baseUserInfo.memberId,
scenarioId: tempArr[i].scenarioId,
templateId: tempArr[i].templateId
}).then(resp => { });
}
if (tempids.length > 0) {
let status = res[tempids[0]];
if (status == 'accept') {
this.getACtivityInfo();
wx.showToast({
title: '预约成功',
})
}
}
},
complete: (res) => { }
})
}).catch(err => { })
}, },
/** /**
......
...@@ -40,7 +40,9 @@ ...@@ -40,7 +40,9 @@
bindgetuserinfo="_getUserInfo" bindgetuserinfo="_getUserInfo"
open-type='getUserInfo' open-type='getUserInfo'
class="clear-btn positionAbs">{{activityInfo.isStart ? '立即领取' : '立即预约'}}</button> class="clear-btn positionAbs">{{activityInfo.isStart ? '立即领取' : '立即预约'}}</button>
<view wx:else class="view-btn" bindtap="onTapGetCoupon">{{activityInfo.isStart ? '立即领取' : '立即预约'}}</view> <!-- <view wx:else class="view-btn" bindtap="onTapGetCoupon">{{activityInfo.isStart ? '立即领取' : '立即预约'}}</view> -->
<view wx:if="{{currentHasUserInfo && !activityInfo.isAppointMent}}" class="view-btn" bindtap="onTapGetCoupon">{{activityInfo.isStart ? '立即领取' : '立即预约'}}</view>
<view wx:if="{{currentHasUserInfo && activityInfo.isAppointMent}}" class="view-btn" >已预约</view>
</view> </view>
</view> </view>
......
// share/share.js
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
const envInfo = require('../../../../config/index').envInfo
const app = getApp()
wxService.page({
data: {
bannerImg: '',
listData: [[], [], []],
current: 0,
typeArr: [1, 2, 3]
},
onLoad: function (options) {
this.getProductList();
this.getImg();
},
getImg() {
wxService.post(`/sale/specialPriceActivate/getPropagandaSet`).then(res => {
if (res.data.data && res.data.data.imgList.length > 0) {
this.setData({
bannerImg: res.data.data.imgList[0]
})
}
})
},
getProductList(current) {
current = current ? current : 0;
wxService.post(`/sale/specialPriceActivate/getActivityProductList?type=${this.data.typeArr[current]}`).then(res => {
let data = res.data.data?res.data.data:[];
data.map(item => {
item.activityPriceText = item.activityPrice ? String((item.activityPrice / 10 / 10).toFixed(2)).split('.') : ['00', '00'];
item.salePriceText = item.productPrice ? String((item.productPrice / 10 / 10).toFixed(2)).split('.') : ['00', '00'];
item.per = (item.salesCount / item.repertory).toFixed(2) * 10 * 10;
item.width = item.per / 10 / 10 * 254;
return item;
});
let list = this.data.listData;
list[current] = data;
this.setData({
listData: list
})
})
},
linkToProInfo(e) {
let productId = e.currentTarget.dataset.productid;
wxService.router(`/pages/productDetail/productDetail?id=${productId}`);
},
//消息订阅
subscribeClick(e) {
let activeId = e.currentTarget.dataset.id;
let itemIndex = e.currentTarget.dataset.index;
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`${'/merchant/message/wxSubMsgMapping/getListByParams'}`, {
scenarioIds: ['usernoticeappointment'],
sourceFrom: 2,
switchType: 3
}).then(res => {
let tempArr = res.data.data ? res.data.data : [];
let tempids = [];
tempArr.map(item => {
tempids.push(item.templateId);
});
console.log(tempids)
wx.requestSubscribeMessage({
tmplIds: tempids,
success: (res) => {
for (let i = 0; i < tempArr.length; i++) {
wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, {
businessId: activeId,
memberId: baseUserInfo.memberId,
scenarioId: tempArr[i].scenarioId,
templateId: tempArr[i].templateId
}).then(resp => { });
}
if(tempids.length>0){
let status = res[tempids[0]];
if(status == 'accept'){
let list = this.data.listData;
list[this.data.current][itemIndex].isAppointMent = true;
this.setData({
listData: list
})
wx.showToast({
title: '预约成功',
})
}
}
},
complete: (res) => {
console.log(res)
}
})
}).catch(err => {})
},
changeTab(e) {
this.setData({
current: e.target.dataset.current * 1
})
},
swiperChange(e) {
let current = e.detail.current;
this.setData({
current: current
})
if (this.data.listData[current].length === 0) {
this.getProductList(current);
}
// this.getProductList(current);
},
onShow: function () {
},
});
\ No newline at end of file
{
"navigationBarTitleText": "限时抢购",
"usingComponents": {}
}
\ No newline at end of file
<view class="banner-wrap">
<image class="banner-img" src="{{bannerImg}}" />
</view>
<view class="tab-wrap">
<view class="tab-item {{current==0?'tab-item-active':''}}" bind:tap="changeTab" data-current="0">抢购中</view>
<view class="tab-item {{current==1?'tab-item-active':''}}" bind:tap="changeTab" data-current="1">未开始</view>
<view class="tab-item {{current==2?'tab-item-active':''}}" bind:tap="changeTab" data-current="2">抢先商品</view>
</view>
<view class="list-wrap" style="flex:1;">
<swiper bindchange="swiperChange" current="{{current}}">
<block wx:for="{{3}}" wx:key="*this">
<swiper-item>
<view class="list-item" wx:for="{{listData[index]}}" wx:if="{{listData[current].length}}" wx:key="*this" data-productid="{{item.productId}}" bind:tap="linkToProInfo">
<view class="item-lf">
<image class="item-img" src="{{item.indexUrl}}" />
<image wx:if="{{(item.repertory - item.salesCount)==0}}" class="sale-out" src="https://img3.bigaka.com/prd/3001/202005/20200511/3001de63752e-41ab-4736-ac2e-4ef3603c0309.png" />
</view>
<view class="item-rt">
<view class="tips">{{ item.subtitle }}</view>
<view class="title">{{item.productName}}</view>
<view class="start-time" wx:if="{{current==1}}">开始时间 {{item.startTime}}</view>
<view class="left" wx:if="{{current!=1}}">
<view class="all-line">
<view class="left-line" style="width: {{item.width}}rpx;" wx:if="{{item.repertory!=0}}">已抢{{item.salesCount}}件</view>
<text class="per-text" wx:if="{{item.repertory!=0}}">{{item.per}}%</text>
<view class="left-line-saled" wx:if="{{(item.repertory - item.salesCount)==0}}">已抢完</view>
</view>
</view>
<view class="price-wrap">
<view class="active-price"><text class="fs-24">¥</text><text class="fs-38">{{ item.activityPriceText[0] }}.</text><text class="fs-32">{{item.activityPriceText[1]}}</text></view>
<view class="sale-price"><text class="fs-15">¥</text><text class="fs-23">{{item.salePriceText[0]}}.</text><text class="fs-17">{{item.salePriceText[1]}}</text></view>
<view class="rush-btn" wx:if="{{current!=1&&(item.repertory - item.salesCount)>0}}">马上抢</view>
<view class="subscribe-btn" wx:if="{{current==1 && !item.isAppointMent}}" catchtap="subscribeClick" data-id="{{item.productId}}" data-index="{{index}}">预约提醒</view>
<view class="subscribe-btn" wx:if="{{current==1 && item.isAppointMent}}" data-id="{{item.activityId}}">已预约</view>
<view class="saled-btn" wx:if="{{current!=1&&(item.repertory - item.salesCount)==0}}">去看看</view>
</view>
<view class="time">结束时间 {{item.endTime}}</view>
</view>
</view>
<view class="empty" wx:if="{{listData[index].length === 0}}">
暂无商品哦~
</view>
</swiper-item>
</block>
</swiper>
</view>
\ No newline at end of file
page{
background-color: #F4F5F6;
width: 100%;
height: 100%;
display: flex;
position: fixed;
flex-direction: column;
}
swiper{
overflow: visible;
width: 100%;
height: 100%;
}
swiper-item{
overflow: visible;
overflow-y: auto;
width: 100%;
height: 100%;
}
.banner-wrap{
height: 276rpx;
padding: 0 30rpx;
background-color: #ffffff;
}
.banner-img{
height: 276rpx;
width: 690rpx;
border-radius: 10rpx;
}
.tab-wrap{
height: 80rpx;
display: flex;
background-color: #ffffff;
padding: 0 30rpx;
justify-content: space-around;
color: #000000;
}
.tab-item{
display: flex;
align-items: center;
justify-content: center;
padding: 0 10rpx;
font-size: 28rpx;
opacity: 0.6;
}
.tab-item-active{
font-size: 34rpx;
opacity: 1;
font-weight: bold;
}
.list-wrap{
padding: 20rpx 30rpx;
}
.list-item{
background-color: #ffffff;
height: 300rpx;
border-radius: 10rpx;
display: flex;
margin-bottom: 20rpx;
}
.item-lf{
min-width: 269rpx;
max-width: 269rpx;
display: flex;
justify-content: center;
position: relative;
}
.sale-out{
width: 210rpx;
height: 210rpx;
position: absolute;
top: 44.5rpx;
left: 14.5rpx;
}
.item-img{
width: 210rpx;
height: 210rpx;
margin: auto;
margin-top: 30rpx;
}
.item-rt{
flex-grow: 1;
display: flex;
flex-direction: column;
padding-right: 23rpx;
}
.tips{
height: 22rpx;
color: rgba(102, 102, 102, 1);
font-size: 22rpx;
text-align: left;
margin-top: 33rpx;
}
.title{
height: 70rpx;
line-height: 35rpx;
color: rgba(0, 0, 0, 1);
font-size: 28rpx;
text-align: left;
margin-top: 10rpx;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
.left{
margin-top: 8rpx;
}
.all-line{
width: 254rpx;
height: 26rpx;
border-radius: 13rpx;
background-color: rgba(255, 206, 206, 1);
position: relative;
text-align: right;
display: flex;
align-items: center;
justify-content: flex-end;
}
.left-line{
position: absolute;
top: 0;
left: 0;
width: 79rpx;
height: 26rpx;
border-radius: 13rpx;
background-image: linear-gradient(to right, #FF2569, #FF1038);
color: #ffffff;
white-space: nowrap;
font-size: 16rpx;
display: flex;
align-items: center;
padding-left: 8rpx;
}
.left-line-saled{
position: absolute;
top: 0;
left: 0;
width: 254rpx;
height: 26rpx;
border-radius: 13rpx;
background-image: linear-gradient(to right, #FF2569, #FF1038);
color: #ffffff;
font-size: 16rpx;
display: flex;
align-items: center;
justify-content: center;
}
.start-time{
height: 20rpx;
color: rgba(250, 100, 0, 1);
font-size: 20rpx;
margin-top: 8rpx;
}
.per-text{
font-size: 16rpx;
color: #FF1038;
margin-right: 8rpx;
}
.price-wrap{
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 10rpx;
}
.active-price{
height: 53rpx;
color: rgba(255, 51, 51, 1);
vertical-align: bottom;
}
.sale-price{
vertical-align: bottom;
color: #9B9B9B;
text-decoration:line-through;
}
.rush-btn{
width: 123rpx;
height: 48rpx;
border-radius: 24rpx;
background-color: rgba(255, 16, 56, 1);
display: flex;
align-items: center;
justify-content: center;
color: rgba(255, 255, 255, 1);
font-size: 22rpx;
}
.subscribe-btn{
width: 138rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 24rpx;
border: 2rpx solid rgba(255, 16, 56, 1);
color: rgba(255, 16, 56, 1);
font-size: 22rpx;
}
.saled-btn{
width: 123rpx;
height: 48rpx;
border-radius: 24rpx;
border: 1rpx solid rgba(155, 155, 155, 1);
display: flex;
align-items: center;
justify-content: center;
color: rgba(155, 155, 155, 1);
font-size: 22rpx;
}
.time{
height: 20rpx;
color: rgba(192, 191, 191, 1);
font-size: 20rpx;
}
.empty{
width: 300rpx;
color: #808080;
margin: 40% auto;
text-align: center;
}
.fs-24{
font-size: 24rpx;
}
.fs-38{
font-size: 38rpx;
}
.fs-32{
font-size: 32rpx;
}
.fs-15{
font-size: 15rpx;
}
.fs-13{
font-size: 13rpx;
}
.fs-17{
font-size: 17rpx;
}
\ No newline at end of file
// share/share.js
const wxService = require('../../../../utils/wxService')
const utils = require('../../../../utils/util')
const envInfo = require('../../../../config/index').envInfo
const app = getApp()
wxService.page({
data: {
storeId: undefined,
storeName: undefined,
shoppingGuidName: undefined,
latitude: undefined,
longitude: undefined,
contactPhone: undefined
},
onLoad: function (options) {
const userInfo = wx.getStorageSync('_baseUserInfo');
this.getUserInfo(userInfo.member.id);
},
locationClick() {
wx.openLocation({
latitude: this.data.latitude,
longitude: this.data.longitude,
name : this.data.storeName,
address : this.data.address,
scale: 18
})
},
getUserInfo(id) {
wxService.post(`/member/find`, {
memberId: id
}).then(res => {
let member = res.data.data.member;
this.setData({
storeId: member.storeId,
storeName: member.storeName,
shoppingGuidName: member.shoppingGuidName
})
this.getStoreInfo(member.storeId)
})
},
getStoreInfo(id) {
wxService.get(`/platform/securityB/organization/findById/` + id).then(res => {
let data = res.data.data ? res.data.data : {}
this.setData({
latitude: data.latitude,
longitude: data.longitude,
contactPhone: data.contactPhone,
address: data.addressArea+data.addressDetail
})
})
}
});
\ No newline at end of file
{
"navigationBarTitleText": "所属门店",
"usingComponents": {}
}
\ No newline at end of file
<view class="guide-wrap">
<view class="guide-head">
<view class="head-lf">
<view class="row-wrap">
<view class="title">所属门店:</view>
<view class="content">{{storeName?storeName:'无'}}</view>
</view>
<view class="row-wrap">
<view class="title">门店电话:</view>
<view class="content">{{contactPhone?contactPhone:'无'}}</view>
</view>
</view>
<view class="head-rt" bind:tap="locationClick">
<image src="https://img3.bigaka.com/prd/3001/202005/20200509/300123dc8d19-2c59-461a-89a3-bab020687557.png" />
</view>
</view>
<view class="guide-body">
<view class="row-wrap">
<view class="title">所属导购:</view>
<view class="content">{{shoppingGuidName?shoppingGuidName:'无'}}</view>
</view>
<view class="row-wrap">
<view class="title">联系方式:</view>
<view class="content">企业微信</view>
</view>
<!-- <view class="qrcode-wrap">
</view>
<view class="save-btn">保存图片</view> -->
</view>
</view>
\ No newline at end of file
page{
background-color: #F4F5F6;
width: 100%;
height: 100%;
display: flex;
position: fixed;
flex-direction: column;
}
.guide-wrap{
padding: 30rpx;
}
.guide-head{
height: 198rpx;
background-color: #ffffff;
display: flex;
align-items: center;
padding: 0 48rpx;
justify-content: space-between;
border-radius: 10rpx;
}
.head-lf{
}
.head-rt{
height: 100rpx;
width: 100rpx;
}
.head-rt image{
height: 100rpx;
width: 100rpx;
}
.row-wrap{
display: flex;
font-size: 25rpx;
margin-bottom: 12rpx;
}
.title{
color: rgba(0, 0, 0, 0.5);
}
.content{
color: rgba(0, 0, 0, 1);
}
.guide-body{
height: 198rpx;
background-color: #ffffff;
display: flex;
flex-direction: column;
padding: 0 48rpx;
margin-top: 30rpx;
justify-content: center;
border-radius: 10rpx;
}
.qrcode-wrap{
height: 500rpx;
}
.save-btn{
display: flex;
align-items: center;
justify-content: center;
width: 320rpx;
height: 86rpx;
border-radius: 10rpx;
border: 1rpx solid rgba(0, 0, 0, 0.25);
color: rgba(0, 0, 0, 0.7);
font-size: 30rpx;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment