diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js
index ca59edb..117bfef 100644
--- a/packageC/pages/presell/cart/cart.js
+++ b/packageC/pages/presell/cart/cart.js
@@ -62,6 +62,8 @@ Page({
ckeck_quan_price: 0,
check_quan_price_list: '',
check_quan_ware_list: '',
+ ckeck_quan_price_scj: 0, //优惠券用市场价进行获取
+
isget_by_quan: {}, //是否调用了接口获取包邮券
// 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid
//using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"}
@@ -214,9 +216,11 @@ Page({
onShow: function () {
this.data.paying = 0;
-
console.log('onshow-2222');
+
+ this.updateOrderCoupon();
+
var th = this;
//判断是不是第一次进入
if (this.data.fir_in) {
@@ -1059,7 +1063,7 @@ Page({
storeId: oo.stoid,
CashRepNo: quan_no,
WaresSum: th.data.ckeck_quan_price,
- WareIds: th.data.check_quan_ware_list
+ WareIds: th.data.check_quan_ware_list,
}
}).then(res => {
if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
@@ -2116,6 +2120,8 @@ Page({
check_quan_price_list = '',
check_quan_ware_list = '';
+ let check_quan_price_scj=0;
+
for (var i in goodlist) {
var gd = goodlist[i];
//--如果是秒杀就跳出,如果是赠品,如果是组合购,如果是限制使用优惠券--
@@ -2134,6 +2140,7 @@ Page({
item_price = gd.account_fir * gd.goods_num;
}
ckeck_quan_price += item_price;
+ check_quan_price_scj += gd.market_price * gd.goods_num;
//--组装价格list--
if (check_quan_price_list) {
@@ -2160,6 +2167,7 @@ Page({
arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price;
arr[ind].check_quan_ware_list = check_quan_ware_list;
arr[ind].check_quan_price_list = check_quan_price_list;
+ arr[ind].check_quan_price_scj = check_quan_price_scj;
//是否关闭使用优惠券
if (th.data.is_close_quan != 1 && !is_xz_yh) {
@@ -2171,7 +2179,8 @@ Page({
userId: app.globalData.user_id,
BuySum: ckeck_quan_price,
WareIds: check_quan_ware_list,
- pageSize: 100
+ pageSize: 100,
+ scj: check_quan_price_scj,
}
}).then(res => {
console.error('优惠券1---------------------');
@@ -2203,6 +2212,7 @@ Page({
var quanlist = null, th = this, frozenQuan = null;
var allprice = this.data.pre_arr.presell_price * this.data.order_goods.goods_num;
th.data.ckeck_quan_price = allprice;
+ th.data.check_quan_price_scj = this.data.goods.market_price* this.data.order_goods.goods_num;
//--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券--
if (th.data.is_close_quan != 1) {
@@ -2213,14 +2223,22 @@ Page({
frozenQuan = res.data.data;
th.data.frozenQuan = frozenQuan;
}
+
+ let quan_rq={
+ storeId: oo.stoid,
+ userId: app.globalData.user_id,
+ BuySum: th.data.ckeck_quan_price,
+ WareIds: encodeURIComponent(th.data.check_quan_ware_list),
+ pageSize: 100
+ };
+
+ if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){
+ quan_rq.BuyPosSum=th.data.ckeck_quan_price;
+ quan_rq.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list);
+ }
+
app.request.time_limit_get(6, url, {
- data: {
- storeId: oo.stoid,
- userId: app.globalData.user_id,
- BuySum: th.data.ckeck_quan_price,
- WareIds: encodeURIComponent(th.data.check_quan_ware_list),
- pageSize: 100
- },
+ data: quan_rq,
success: function (res) {
console.error('优惠券2-------------------');
if (res.data.code == 0) {
@@ -3202,6 +3220,10 @@ Page({
icon: 'none',
duration: 2500
})
+
+
+ th.updateOrderCoupon(); //取消支付的时候
+
})
// var n = t.data.data;
// th.weixinPay(n,
@@ -3801,6 +3823,25 @@ Page({
getApp().goto("/pages/index/index/index");
},
+ //优惠券锁定后解锁方法
+ async updateOrderCoupon(){
+ try{
+ let req_data={
+ store_id:oo.stoid,
+ user_id:(getApp().globalData.userInfo.user_id || 0),
+ order_id:this.data.order_id,
+ }
+ await getApp().request.promisePost("/api/weshop/order/updateOrderCoupon",{
+ is_json:1,
+ data:req_data
+ }).then(res=>{
+ console.log(111)
+ })
+ }catch(error){
+ console.log(error)
+ }
+ }
+
diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js
index d443549..43d0f51 100644
--- a/packageC/pages/presell/cart/cart2.js
+++ b/packageC/pages/presell/cart/cart2.js
@@ -71,6 +71,7 @@ Page({
ckeck_quan_price: 0,
check_quan_price_list: '',
check_quan_ware_list: '',
+ check_quan_price_scj: 0,
// 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid
//using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"}
@@ -753,6 +754,7 @@ Page({
th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
th.data.check_quan_ware_list = t.data.data.erpwareid + "";
+ th.data.check_quan_price_scj =t.data.data.market_price * gg.goods_num;
}
else
{
@@ -771,12 +773,10 @@ Page({
act: act
});
-
-
//计算价格
th.calculatePrice2();
//获取优惠券,如果有券的钱,就调用
- if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
+ if (th.data.check_quan_ware_list) th.get_buy_now_quan();
},
});
@@ -3303,14 +3303,22 @@ Page({
frozenQuan = res.data.data;
th.data.frozenQuan = frozenQuan;
}
+
+ let quan_req= {
+ storeId: oo.stoid,
+ userId: app.globalData.user_id,
+ BuySum: th.data.ckeck_quan_price,
+ WareIds: encodeURIComponent(th.data.check_quan_ware_list),
+ pageSize: 100
+ };
+
+ if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){
+ quan_req.BuyPosSum=th.data.ckeck_quan_price
+ quan_req.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list)
+ }
+
app.request.time_limit_get(6, url, {
- data: {
- storeId: oo.stoid,
- userId: app.globalData.user_id,
- BuySum: th.data.ckeck_quan_price,
- WareIds: encodeURIComponent(th.data.check_quan_ware_list),
- pageSize: 100
- },
+ data:quan_req,
success: function (res) {
if (res.data.code == 0) {
quanlist = res.data.data.pageData;
diff --git a/packageD/pages/user/coupons/coupons.json b/packageD/pages/user/coupons/coupons.json
index 8851a02..552053c 100644
--- a/packageD/pages/user/coupons/coupons.json
+++ b/packageD/pages/user/coupons/coupons.json
@@ -1,6 +1,8 @@
{
"enablePullDownRefresh": false,
"usingComponents": {
- "nodata": "/components/nodata/nodata"
- }
+ "nodata": "/components/nodata/nodata",
+ "com_top_nav": "/components/com_top_nav/com_top_nav"
+ },
+ "navigationStyle": "custom"
}
\ No newline at end of file
diff --git a/packageD/pages/user/coupons/coupons.wxml b/packageD/pages/user/coupons/coupons.wxml
index 91861d3..5692b70 100644
--- a/packageD/pages/user/coupons/coupons.wxml
+++ b/packageD/pages/user/coupons/coupons.wxml
@@ -1,6 +1,8 @@
+
+
@@ -35,7 +37,7 @@
- 使用说明:{{filter.showtypeName(detail.type)}}【消费满{{time.toFix(detail.condition,2)}}元可用】
+ 使用说明:{{filter.showtypeName(detail.type)}}【消费满{{time.toFix(detail.condition,2)}}元可用】
@@ -64,8 +66,10 @@
- 使用说明:{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}、使用场景:{{ (detail.UseRange && detail.UseRange !=0) ? (detail.UseRange==1 ? '仅线下可用' : '仅线上可用') :'通用'}}
- 使用说明: {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}、使用场景:{{(detail.UseRange && detail.UseRange !=0) ? (detail.UseRange==1 ? '仅线下可用' : '仅线上可用') :'通用'}}
+
+ 使用说明:{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}、使用场景:{{ (detail.UseRange && detail.UseRange !=0) ? (detail.UseRange==1 ? '仅线下可用' : '仅线上可用') :'通用'}} 取价规则:零售价 实收价
+
+ 使用说明: {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}、使用场景:{{(detail.UseRange && detail.UseRange !=0) ? (detail.UseRange==1 ? '仅线下可用' : '仅线上可用') :'通用'}} 取价规则:零售价 实收价
diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js
index e25de68..a9b6445 100644
--- a/packageE/pages/cart/cart2/cart2.js
+++ b/packageE/pages/cart/cart2/cart2.js
@@ -194,6 +194,7 @@ Page({
def_coupon2: null,//直接购买优惠券列表
def_coupon3: null,//购物车包邮券列表
def_coupon4: null,//直接购买包邮券列表
+
},
@@ -1895,7 +1896,8 @@ Page({
t.data.data.original_img = oo.imghost + t.data.data.original_img;
t.data.data['buynum'] = gg.goods_num;
- var distr_t = 0, et = 0
+ var distr_t = 0, et = 0;
+
if (t.data.data.is_minishop == 1 && getApp().is_sp_hao()) {
@@ -2379,7 +2381,7 @@ Page({
//-- 计算价格 --
th.calculatePrice2();
//获取优惠券,如果有券的钱,就调用
- if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
+ if (th.data.check_quan_ware_list ) th.get_buy_now_quan();
}
@@ -3239,14 +3241,42 @@ Page({
//普通券的时候
if (quan_no && th.data.using_quan[pickid].isby != 1) {
var IsUserWare = 1;
+ let is_quan_scj=0;
+ let get_c_price_data={
+ storeId: oo.stoid,
+ CashRepNo: quan_no,
+ WaresSum: cart_item.check_quan_price_list,
+ WareIds: cart_item.check_quan_ware_list
+ };
+
+ //-- 如果是零售价的时候 ---
+ if(th.data.using_quan[pickid].FactPriceType){
+ let scj_arr=c_arr[i].scj_arr;
+ let scj_check_quan_price_list=[];
+ let scj_check_quan_ware_list=[];
+ for (let jh = 0; jh -1) {
+ scj_check_quan_price_list[idxx] += scj_arr[jh].sum_price;
+ } else {
+ scj_check_quan_price_list.push(scj_arr[jh].sum_price);
+ scj_check_quan_ware_list.push(encodeURIComponent(scj_arr[jh].erpwareid));
+ }
+ }
+
+ get_c_price_data.WaresSum= scj_check_quan_price_list.join();
+ get_c_price_data.WareIds= scj_check_quan_ware_list.join();
+ is_quan_scj=1;
+ }
+
//---获取优惠券优惠---
await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", {
- data: {
- storeId: oo.stoid,
- CashRepNo: quan_no,
- WaresSum: cart_item.check_quan_price_list,
- WareIds: cart_item.check_quan_ware_list
- }
+ data:get_c_price_data
}).then(res => {
if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
var q_data = res.data.data;
@@ -3280,7 +3310,7 @@ Page({
for (var kk in cart_item.quan_youhui_list) {
var you_item = cart_item.quan_youhui_list[kk];
//-- 对券的价格进行平摊 --
- await th.split_set_goods_quanprice(you_item, cart_item);
+ await th.split_set_goods_quanprice(you_item, cart_item,is_quan_scj);
}
}
@@ -5529,15 +5559,14 @@ Page({
//房间号的ids
var room_ids = "";
-
- //-- 把券的钱,写入从表 ---
- if (t_item.quan_youhui_list && t_item.coupon_price) {
- for (var kk in t_item.quan_youhui_list) {
- var you_item = t_item.quan_youhui_list[kk];
- //-- 对券的价格进行平摊 --
- await th.split_set_goods_quanprice(you_item, t_item);
- }
- }
+ //-- 把券的钱,写入从表,前面已经摊了一次了,不要再摊第二次 ---
+ // if (t_item.quan_youhui_list && t_item.coupon_price) {
+ // for (var kk in t_item.quan_youhui_list) {
+ // var you_item = t_item.quan_youhui_list[kk];
+ // //-- 对券的价格进行平摊 --
+ // await th.split_set_goods_quanprice(you_item, t_item);
+ // }
+ // }
//看一下有没有活动不参与的,要记录到order_more表中
let can_cx = t_item.show_can_cx;
@@ -5968,9 +5997,6 @@ Page({
console.log("--str--");
console.log(str);
-
- // return false;
-
wx.showLoading({ title: "加载中" });
th.setData({ submit: 1, })
wx.request({
@@ -6974,7 +7000,15 @@ Page({
using_quan[pickid].isby = 1;
} else {
if (using_quan[pickid]) old_quan = using_quan[pickid];
- using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 };
+
+ let using_data={ coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 };
+
+ //-- 优化判断是有使用零售价的时候 --
+ if(item.FactPriceType){
+ using_data.FactPriceType=1;
+ }
+
+ using_quan[pickid] =using_data ;
using_quan[pickid].isby = 0;
}
this.setData({ using_quan: using_quan });
@@ -7163,6 +7197,7 @@ Page({
}
}, 500);
},
+
//-----获取购物车进来的劵-------
get_cart_quan: async function (order_prom_list_cart) {
var th = this;
@@ -7195,6 +7230,8 @@ Page({
check_quan_price_list_arr = [],
check_quan_ware_list_arr = [];
+ let ck_price_scj=0; //市场价的优化
+
for (var i in goodlist) {
var gd = goodlist[i];
//--如果是秒杀就跳出,如果是赠品,如果是组合购限制使用优惠券--
@@ -7238,6 +7275,10 @@ Page({
}
}
+ if(gd.is_collocation && gd.market_price && !gd.goods_market_price){
+ gd.goods_market_price=gd.market_price;
+ }
+
//如果有限制使用优惠券,就要返回
if (gd.prom_type == 3) {
@@ -7248,16 +7289,33 @@ Page({
}
var item_price = gd.goods_price * gd.goods_num;
var item_price2 = item_price;
+ var real_price=gd.goods_price;
//-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 --
if (gd.account_fir != null && gd.account_fir != undefined) {
item_price2 = gd.account_fir * gd.goods_num;
+ real_price=gd.account_fir;
}
if (gd.ld_account) {
item_price2 = gd.ld_account * gd.goods_num;
+ real_price=gd.ld_account;
}
ckeck_quan_price += item_price;
+
+ //如果实收价等于市场价的死后
+ if(real_price>=gd.goods_market_price){
+ ck_price_scj+= real_price * gd.goods_num; //市场价的优化
+ if(!arr[ind].scj_arr) arr[ind].scj_arr=[]; //组装市场价的数组,如果优惠券使用了零售价的券,就要带入使用券的接口
+ arr[ind].scj_arr.push({
+ sum_price:real_price * gd.goods_num,
+ index: parseInt(i),
+ goods_id:gd.goods_id,
+ erpwareid:gd.erpwareid
+ })
+ }
+
+
//如果商品有重复的过滤,一般是组合购和阶梯购的情况下
var idx = check_quan_ware_list_arr.findIndex(function (ele) {
return ele == encodeURIComponent(gd['erpwareid']);
@@ -7323,18 +7381,31 @@ Page({
arr[ind].check_quan_price_list = check_quan_price_list;
arr[ind].quan_list = null;
+ var quan_req= {
+ storeId: oo.stoid,
+ userId: app.globalData.user_id,
+ BuySum: arr[ind].ckeck_quan_price,
+ WareIds: check_quan_ware_list,
+ pageSize: 100
+ }
+
+ if(arr[ind].scj_arr && arr[ind].scj_arr.length ){
+ quan_req.BuyPosSum=ck_price_scj //优化获取市场价的优惠券
+
+ let PosWareIds=[];
+ for (let is = 0; is < arr[ind].scj_arr.length; is++) {
+ PosWareIds.push(arr[ind].scj_arr[is].erpwareid)
+ }
+
+ quan_req.PosWareIds=PosWareIds.join() //优化获取市场价的优惠券
+ }
+
//-- 是否关闭使用优惠券,循环有找到商品 --
if (th.data.is_close_quan != 1 && check_quan_ware_list) {
//--调用接口,获取优惠券的列表,3秒钟内控制接口请求--
var url = "/api/weshop/couponList/getUseCouponList";
await app.request.promiseGet(url, {
- data: {
- storeId: oo.stoid,
- userId: app.globalData.user_id,
- BuySum: arr[ind].ckeck_quan_price,
- WareIds: check_quan_ware_list,
- pageSize: 100
- }
+ data:quan_req
}).then(res => {
console.error('优惠券111111111111');
if (res.data.code == 0) {
@@ -7383,7 +7454,7 @@ Page({
//})
},
- //------ 获取立即购买的购物车的劵 --------
+ //------ 获取立即购买的购物车的劵,因为立即购买只有一个商品 --------
get_buy_now_quan: function () {
var quanlist = null, th = this, frozenQuan = null;
var good = this.data.bn_goods;
@@ -7404,14 +7475,23 @@ Page({
frozenQuan = res.data.data;
th.data.frozenQuan = frozenQuan;
}
+
+ let get_q_req={
+ storeId: oo.stoid,
+ userId: app.globalData.user_id,
+ BuySum: th.data.ckeck_quan_price,
+ WareIds: encodeURIComponent(th.data.check_quan_ware_list),
+ pageSize: 100
+ };
+
+ var gg = to.get_b_now();
+ if(th.data.ckeck_quan_price>= good.market_price* gg.goods_num){
+ get_q_req.BuyPosSum=th.data.ckeck_quan_price //优化获取市场价的优惠券
+ get_q_req.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list) //优化获取市场价的优惠券
+ }
+
app.request.time_limit_get(6, url, {
- data: {
- storeId: oo.stoid,
- userId: app.globalData.user_id,
- BuySum: th.data.ckeck_quan_price,
- WareIds: encodeURIComponent(th.data.check_quan_ware_list),
- pageSize: 100
- },
+ data:get_q_req ,
success: function (res) {
console.error('优惠券22222222222222222');
if (res.data.code == 0) {
@@ -8221,12 +8301,24 @@ Page({
},
//进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表
- split_set_goods_quanprice: async function (you_item, t_item) {
+ split_set_goods_quanprice: async function (you_item, t_item,is_quan_scj) {
var coupon_price = you_item.WareCashSum;
var goods = t_item.goods;
var arr = [];
+
+ if(!t_item.quan_no) t_item.quan_no=you_item.CashRepNo;
+
//判断是不是有goods_id重复
for (var i = 0; i < goods.length; i++) {
+
+ if(is_quan_scj){
+ let fd=t_item.scj_arr.find(function (e){
+ return e.index==i && e.erpwareid==you_item.WareId;
+ })
+ //不是零售价的商品,就进入下一轮
+ if(!fd) continue;
+ }
+
if (goods[i].erpwareid == you_item.WareId) {
var gg_ite = {
goods_id: goods[i].goods_id,
@@ -9189,7 +9281,6 @@ Page({
var cx_prom_group = this.data.cartlist[idx].show_can_cx[gd_key].act_arr;
var cx_arr = [];
-
for (var h = 0; h < cx_prom_group.length; h++) {
cx_prom_group[h].act.sele = 0;
//-- 看有没有选中的活动 --
@@ -9221,11 +9312,16 @@ Page({
//-- 切换活动的时候,让订单促销参与不选中 --
let tt_wd = "can_use_ord_prom[" + pk + "]";
+
+ let using_quan =this.data.using_quan;
+ using_quan[pk]={};
+
th.setData({
send_lb: {},
month_lb: {},
send_gf: {},
- [tt_wd]: 0
+ [tt_wd]: 0,
+ using_quan:using_quan
})
th.data.prom_goods_map = {};
diff --git a/packageE/pages/cart/cart2/cart2.wxml b/packageE/pages/cart/cart2/cart2.wxml
index 244cdbf..2d9e563 100644
--- a/packageE/pages/cart/cart2/cart2.wxml
+++ b/packageE/pages/cart/cart2/cart2.wxml
@@ -924,7 +924,7 @@
-
+
diff --git a/packageE/pages/cart/cart2/remark_part_qj.wxml b/packageE/pages/cart/cart2/remark_part_qj.wxml
new file mode 100644
index 0000000..8201a28
--- /dev/null
+++ b/packageE/pages/cart/cart2/remark_part_qj.wxml
@@ -0,0 +1,10 @@
+
+
+ {{util.format(item.Remark)}}
+
+ 仅{{item.UseObjectName}}使用
+ 全场通用
+
+ 取价规则:零售价实收价
+
+
\ No newline at end of file
diff --git a/packageE/pages/cart/cart2_pt/cart2_pt.js b/packageE/pages/cart/cart2_pt/cart2_pt.js
index 072bfe0..f3945d8 100644
--- a/packageE/pages/cart/cart2_pt/cart2_pt.js
+++ b/packageE/pages/cart/cart2_pt/cart2_pt.js
@@ -82,6 +82,7 @@ Page({
ckeck_quan_price: 0,
check_quan_price_list: '',
check_quan_ware_list: '',
+ check_quan_price_scj:0, //市场价的时候
// 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid
//using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"}
@@ -511,12 +512,21 @@ Page({
th.calculatePrice2();
+
+ th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
+ th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
+ th.data.check_quan_ware_list = t.data.data.erpwareid + "";
+ th.data.check_quan_price_scj = t.data.data.market_price * gg.goods_num;
+
+ th.get_buy_now_quan();
+
} else {
th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
th.data.check_quan_ware_list = t.data.data.erpwareid + "";
+ th.data.check_quan_price_scj = t.data.data.market_price * gg.goods_num;
gd.prom_id = gg.prom_id;
//--阶梯团很特殊,不能用总表来拿价格--
@@ -1995,14 +2005,22 @@ Page({
frozenQuan = res.data.data;
th.data.frozenQuan = frozenQuan;
}
+
+ let quan_rq={
+ storeId: oo.stoid,
+ userId: app.globalData.user_id,
+ BuySum: th.data.ckeck_quan_price,
+ WareIds: encodeURIComponent(th.data.check_quan_ware_list),
+ pageSize: 100,
+ };
+
+ if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){
+ quan_rq.BuyPosSum=th.data.ckeck_quan_price;
+ quan_rq.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list)
+ }
+
app.request.time_limit_get(6, url, {
- data: {
- storeId: oo.stoid,
- userId: app.globalData.user_id,
- BuySum: th.data.ckeck_quan_price,
- WareIds: encodeURIComponent(th.data.check_quan_ware_list),
- pageSize: 100
- },
+ data: quan_rq,
success: function (res) {
if (res.data.code == 0) {
quanlist = res.data.data.pageData;
diff --git a/packageE/pages/cart/cart_wk/cart_wk.js b/packageE/pages/cart/cart_wk/cart_wk.js
index 8d5bf4a..ff3e062 100644
--- a/packageE/pages/cart/cart_wk/cart_wk.js
+++ b/packageE/pages/cart/cart_wk/cart_wk.js
@@ -62,6 +62,8 @@ Page({
check_quan_price_list: '',
check_quan_ware_list: '',
+ check_quan_price_scj:0, //市场价取价
+
// 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid
//using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"}
using_quan: {},
@@ -117,6 +119,8 @@ Page({
*/
onShow: function () {
+ this.updateOrderCoupon();
+
var th = this;
//判断是不是第一次进入
if(this.data.fir_in){
@@ -479,6 +483,10 @@ Page({
th.data.ckeck_quan_price = q_ch_money;
th.data.check_quan_price_list = q_ch_money + "";
th.data.check_quan_ware_list = goods.erpwareid + "";
+
+ let scj_money= parseFloat( order.market_price * order_goods.goods_num).toFixed(2);
+ th.data.check_quan_price_scj = scj_money;
+
}else{
goods.is_xz_yh = 1;
}
@@ -664,6 +672,17 @@ Page({
//--弹起支付框--
to_pay() {
+ let order=this.data.order;
+ let formData=this.data.formData;
+ let exp_price=this.data.exp_price;
+ let bn_use_commission=this.data.bn_use_commission;
+
+ //如果支付为0的时候
+ if(order.tail_money+exp_price-formData.coupon_price-(bn_use_commission?goods.use_commission:0)-(formData.order_prom_amount?formData.order_prom_amount:0)<=0 ){
+ this.to_pay_type(1);
+ return false;
+ }
+
//如果有再计算价格的过程中,不能提交订单
if(this.data.submit){ return false}
if(!this.data.same_ok){ return false}
@@ -791,6 +810,8 @@ Page({
},function (){
th.data.paying=0;
//getApp().my_warnning("支付失败", 0, th);
+
+ th.updateOrderCoupon(); //取消祝福
})
//var n = t.data.data;
@@ -1520,23 +1541,34 @@ Page({
if (good.whsle_id) return false;
if(!th.data.check_quan_ware_list) return false;
+
+
+
//--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券--
if (th.data.is_close_quan != 1 && good.is_xz_yh != 1 && th.data.check_quan_ware_list) {
var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
var url = "/api/weshop/couponList/getUseCouponList";
+
+ let quan_rq={
+ storeId: oo.stoid,
+ userId: app.globalData.user_id,
+ BuySum: th.data.ckeck_quan_price,
+ WareIds: encodeURIComponent(th.data.check_quan_ware_list),
+ pageSize: 100,
+ };
+
+ if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){
+ quan_rq.BuyPosSum=th.data.ckeck_quan_price;
+ quan_rq.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list)
+ }
+
app.request.promiseGet(url0, { 1: 1 }).then(res => {
if (res.data.code == 0) {
frozenQuan = res.data.data;
th.data.frozenQuan = frozenQuan;
}
app.request.time_limit_get(6, url, {
- data: {
- storeId: oo.stoid,
- userId: app.globalData.user_id,
- BuySum: th.data.ckeck_quan_price,
- WareIds: encodeURIComponent(th.data.check_quan_ware_list),
- pageSize: 100
- },
+ data: quan_rq,
success: function (res) {
if (res.data.code == 0) {
quanlist = res.data.data.pageData;
@@ -2227,6 +2259,24 @@ Page({
th.setData({ open_quan: 0 });
},
+ //优惠券锁定后解锁方法
+ async updateOrderCoupon(){
+ try{
+ let req_data={
+ store_id:oo.stoid,
+ user_id:(getApp().globalData.userInfo.user_id || 0),
+ order_id:this.data.order_id,
+ }
+ await getApp().request.promisePost("/api/weshop/order/updateOrderCoupon",{
+ is_json:1,
+ data:req_data
+ }).then(res=>{
+ console.log(111)
+ })
+ }catch(error){
+
+ }
+ }
diff --git a/pages/user/assistance/giftpacklist.js b/pages/user/assistance/giftpacklist.js
index 58dba8d..140283a 100644
--- a/pages/user/assistance/giftpacklist.js
+++ b/pages/user/assistance/giftpacklist.js
@@ -218,9 +218,10 @@ Page({
"actId": th.data.id, //活动Id
"actType": 5, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
//"giftBagId": 1, //礼包Id
- "giftBagId": th.giftBagId, //礼包Id
+ "giftBagId": th.giftBagId, //礼包Id
"storeId": a.stoid, //商家Id
- "userId": d.user_id //用户ID
+ "userId": d.user_id, //用户ID
+ "buyFrom":2 //小程序领取
};
var data = JSON.stringify(json);
var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert";