Commit 5985997f by 谢中龙

优化功能

parent 21ff127a
......@@ -171,5 +171,24 @@ App({
isPlusVip: isPlusVip,
cityJson: cityJson,
brandId: envInfo.brandId,
}
},
//跳转10级
navigateTo(routerObj){
//参数object : {url : ''}
if(!routerObj){
console.error('跳转页面需要路径');
return ;
}
if(Object.keys(routerObj).length == 0){
console.error('跳转页面需要路径');
return ;
}
if(getCurrentPages().length > 9){
wx.redirectTo(routerObj);
}
else{
wx.navigateTo(routerObj)
}
},
})
......@@ -6,7 +6,7 @@
// 修改 BRANCH_ID 为对应的商户id
// app.js 中brandId 修改为对应
const PROJECT_ENV = 'prod' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
//仅生产环境时 配置 :
//3001 3001 , wx313ec36b710125d4 有直播
//2006 泰华 , wx40fec8944623c8b3 有直播
......@@ -25,7 +25,7 @@ const PROJECT_ENV = 'prod' // 生产 prod, 开发 dev, 测试 test , 测试门
//2992 山东盛联微商城 wx53dedc202ae0d0c2
//2002 巴黎贝甜 wx21968cb3a486d4ab
const BRANCH_ID = 3001
const BRANCH_ID = 1002
const isMall = true
// const needMock = '' //
......
......@@ -64,7 +64,7 @@ wxService.page({
},
// 查询 /trolley/query
getCartList() {
getCartList(refresh) {
wx.showLoading({
title: '加载中'
})
......@@ -91,9 +91,18 @@ wxService.page({
this.setData({
cartList: validateCarts,
invalidCarts : invalidCarts,
checkAll : false,
shopCartTotalFee : 0,
})
}
}
if(refresh){
wx.showToast({
title: '刷新成功',
});
wx.stopPullDownRefresh();
}
})
},
minusNumChange(e) {
......@@ -442,14 +451,24 @@ wxService.page({
//清空有效宝贝
onTapEmptyValidCarts(){
let self = this;
let checked = self.data.cartList.filter(item => item.checked);
if(checked.length == 0){
wx.showToast({
title: '请先勾选需要删除的商品',
icon : 'none'
});
return ;
}
wx.showModal({
title: '提示',
content: '确认清空购物车中所有有效宝贝?',
content: '确认删除购物车中勾选的宝贝?',
success(res) {
if (res.confirm) {
wx.showLoading('清除中...');
let promiseArr = [];
self.data.cartList.forEach(item => {
checked.forEach(item => {
let skuId = item.skuId;
let tempPromise = wxService.post(`/sale/trolley/remove?skuId=${skuId}`);
promiseArr.push(tempPromise);
......@@ -460,11 +479,7 @@ wxService.page({
wx.showToast({
title: '清除成功',
});
self.setData({
cartList : [],
checkAll : false,
shopCartTotalFee : 0,
});
self.getCartList();
}).catch(err => {
wx.hideLoading();
wx.showToast({
......@@ -593,4 +608,11 @@ wxService.page({
} else {
}
},
//
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.getCartList(true);
},
})
\ No newline at end of file
{
"navigationBarTitleText": "购物车",
"enablePullDownRefresh": true,
"usingComponents": {
"scroll-del": "/component/scrollDel/scrollDel",
"go-home": "/component/goHome/goHome",
......
......@@ -3,7 +3,7 @@
<view class="cart-content" wx:if="{{cartList.length}}">
<view class="invalid-title">
<label>有效宝贝</label>
<text class="theme-text-color" bindtap="onTapEmptyValidCarts">清空</text>
<text class="theme-text-color" bindtap="onTapEmptyValidCarts">删除</text>
</view>
<!-- 购物车列表 -->
<scroll-del
......
......@@ -32,7 +32,7 @@
hover-class="none"
class="sec-menu-image"
open-type="navigate"
url="/subPackage/page/pages/fun/fun?id={{menuSec.id}}&name={{menuSec.label}}"
url="/subPackage/page/pages/categoryPro/categoryPro?id={{menuSec.id}}&name={{menuSec.label}}"
>
<image src="{{menuSec.image}}" mode="widthFix" />
</navigator>
......
......@@ -100,12 +100,16 @@ wxService.page({
title: '没有可用积分抵扣',
icon : 'none'
});
return ;
}
this.data.deductCheckStatus = !this.data.deductCheckStatus;
this.setData({
deductCheckStatus : this.data.deductCheckStatus
});
//需要计算显示订单价格
},
//显示积分抵扣规则
onTapShowDeductRule(){
......@@ -354,6 +358,7 @@ wxService.page({
// 实付款
this.setPayPrice();
},
//计算显示订单价格
setPayPrice() {
const {
currentCoupon,
......@@ -369,6 +374,10 @@ wxService.page({
let calCouponPrice = orderCoupon ? orderCoupon : defalutCoupon
//获取计算优惠后的价格
let promotionPrice = (orderInitPrice - calCouponPrice) > 0 ? (orderInitPrice - calCouponPrice) : 0;
//看一下积分是否勾选了
if(this.data.deductCheckStatus){
promotionPrice = parseFloat(promotionPrice - this.data.pointDeductMoney).toString(2);
}
// 实际价格 - 优惠价 + plus
this.setData({
// orderPrice: Math.round(orderInitPrice - orderCoupon)
......
......@@ -32,7 +32,6 @@ wxService.page({
if(res){
let obj = res.data.data ? res.data.data : null;
if (obj){
console.log(obj)
let arr = obj.definition ? JSON.parse(obj.definition) : [];
obj.desc = arr.filter(item => item.type == 2);
obj.hasExpDate = arr.filter(item => item.type == 1).length > 0 ;
......
......@@ -173,7 +173,7 @@ class Scratch {
if (!this.isStart) return
// 自动清楚采用点范围值方式判断
const { canvasWidth, canvasHeight, minX, minY, maxX, maxY } = this
if (maxX - minX > .3 * canvasWidth && maxY - minY > .3 * canvasHeight) {
if (maxX - minX > .2 * canvasWidth && maxY - minY > .2 * canvasHeight) {
this.ctx.draw()
this.endCallBack && this.endCallBack()
this.isStart = false
......
......@@ -42,8 +42,19 @@ wxService.page({
let data = res.data.data ? res.data.data : null;
if(data){
if(data.type == 3){
let memberId = data.tentacleId;
this.markShareRecords(memberId,this.data.activityId);
//判断打开着是不是自己
let currentLogginUser = wx.getStorageSync('_baseUserInfo');
if(!currentLogginUser){
let memberId = data.tentacleId;
this.markShareRecords(memberId,this.data.activityId);
}
else{
let curLoginMemberId = currentLogginUser.memberId;
if(curLoginMemberId != memberId){ // 不是自己打开的分享链接时才调用分享成功的接口 防止自己刷次数
let memberId = data.tentacleId;
this.markShareRecords(memberId,this.data.activityId);
}
}
}
}
}
......
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