diff --git a/components/diy_service/diy_service.js b/components/diy_service/diy_service.js
new file mode 100644
index 0000000..bebbbbe
--- /dev/null
+++ b/components/diy_service/diy_service.js
@@ -0,0 +1,61 @@
+Component({
+ properties: {
+ // 这里定义了innerText属性,属性值可以在组件使用时指定
+ object:{
+ type: Object,
+ value:null
+ },
+ },
+ data: {
+ iurl:getApp().globalData.setting.imghost
+ },
+
+ lifetimes: {
+ attached: function() {
+ var th=this;
+ //----获取系统参数-----
+ getApp().getConfig2(function(e) {
+ var json_d = JSON.parse(e.switch_list);
+ th.setData({ sys_switch:json_d, })
+ })
+ }
+ },
+
+ methods: {
+ berror:function(e){
+ var iurl=getApp().globalData.setting.imghost;
+ var ob={};
+ var txt="object.title_img";
+ ob[txt] = iurl +'/miniapp/images/logo.png';
+ this.setData(ob);
+ },
+
+ //-- 跳到绑定注册会员 --
+ go_user:function(){
+ getApp().goto('/pages/getphone/getphone');
+ return false;
+ },
+
+ //---------联系客服------------
+ contactService: function() {
+ getApp().getConfig(function(t) {
+ if (t.store_tel == undefined) {
+ getApp().request.get("/api/weshop/store/get/" + os.stoid, {
+ isShowLoading: 1,
+ data: {},
+ success: function(rs) {
+ getApp().globalData.config = rs.data.data;
+ if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
+ getApp().my_warnning("商家未设置电话", 0, th);
+ return false;
+ }
+ wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, })
+ }
+ })
+ } else {
+ wx.makePhoneCall({ phoneNumber: t.store_tel, })
+ }
+ });
+ },
+ }
+})
diff --git a/components/diy_service/diy_service.json b/components/diy_service/diy_service.json
new file mode 100644
index 0000000..e8cfaaf
--- /dev/null
+++ b/components/diy_service/diy_service.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/components/diy_service/diy_service.wxml b/components/diy_service/diy_service.wxml
new file mode 100644
index 0000000..d287119
--- /dev/null
+++ b/components/diy_service/diy_service.wxml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+ {{object.title}}
+
+
+
+
+
+
+
+
+
+
+ {{object.title}}
+
+
+
\ No newline at end of file
diff --git a/components/diy_service/diy_service.wxss b/components/diy_service/diy_service.wxss
new file mode 100644
index 0000000..d0bf844
--- /dev/null
+++ b/components/diy_service/diy_service.wxss
@@ -0,0 +1,6 @@
+.custom-service{ width: 116rpx; height: 116rpx; border-radius: 50%; background-color: #fff;z-index: 100;
+ border: 1px solid #adadad; box-shadow: 0 0 10px 2px #adadad; line-height: 28rpx;
+ position: fixed; top: 40%; right: 2rpx; display: flex;align-items: center;justify-content: center;}
+
+ .cs-img{ width: 36rpx; height: 36rpx;}
+.s_title{ font-size: 20rpx;}
\ No newline at end of file
diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js
index 78c1dec..7b58bd5 100644
--- a/pages/cart/cart2/cart2.js
+++ b/pages/cart/cart2/cart2.js
@@ -706,11 +706,33 @@ Page({
cart_item.prom_pt_json=[{"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}];
}
+ //-- 如果系统要平摊到单品 --
+ if(!th.data.ispt_goods){
+
+ var pt_data={
+ 'prom_id':item_map.prom_id,
+ 'dis': parseFloat((item_map.price-item_map.prom_price).toFixed(2)),
+ 'goods':item_map.goods
+ }
+
+ var pt_res=null;
+ await getApp().request.promisePost("/api/weshop/order/getGoodsSplit",{is_json:1,data:pt_data}).then(res=>{
+ if(res.data.code==0){ pt_res=res.data.data; }
+ })
+ if(pt_res){
+ for (var io in item_map.goods){
+ //平摊赋值
+ item_map.goods[io].account=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account;
+ item_map.goods[io].account_yu=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account_yu;
+ }
+ }
+ }
+
o_price-=(item_map.price-item_map.prom_price);
//如果有限制使用优惠券,就要减掉参与的活动商品的钱
if(!item_map.is_xz_yh) q_conditin=o_price;
}
-
+
//--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表-----------
for(var j=0;j0 && !th.data.ispt_goods){
+ var g_arr=new Array();
+ g_arr.push(goods);
+ var pt_data={
+ 'prom_id':goods.prom_id,
+ 'dis': parseFloat(th.data.formData.cut_price),
+ 'goods':g_arr,
+ }
+
+ var pt_res=null;
+ await getApp().request.promisePost("/api/weshop/order/getGoodsSplit",{is_json:1,data:pt_data}).then(res=>{
+ if(res.data.code==0){ pt_res=res.data.data; }
+ })
+ if(pt_res){
+ //平摊赋值
+ goods.account=pt_res[0].fisrt_account;
+ goods.account_yu=pt_res[0].fisrt_account_yu;
+ }
+ }
+
+
//--组装优惠券的钱--
if(th.data.formData.coupon_price){
item.coupon_price=th.data.formData.coupon_price;
@@ -1653,6 +1698,13 @@ Page({
}
}
+ //把优惠的平摊结果写进去
+ if(g_item.account>=0 || g_item.account_yu!=0){
+ if(g_item.account>=0) goods.account=g_item.account;
+ if(g_item.account_yu!=0) goods.account_yu=g_item.account_yu;
+ item.is_discount_amount=1;
+ }
+
//导购ID
if(g_item.guide_id){
goods.guide_id=g_item.guide_id;
@@ -2474,7 +2526,12 @@ Page({
}
is_xz_yh=0;
var item_price=gd.goods_price*gd.goods_num;
+ //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 --
+ if(gd.account!=null && gd.account!=undefined){
+ item_price=gd.account*gd.goods_num;
+ }
ckeck_quan_price+=item_price;
+
//--组装价格list--
if (check_quan_price_list) {
check_quan_price_list += "," +item_price;
@@ -2755,11 +2812,17 @@ Page({
},
//从优惠的映射中拿出商品从表的item
- item_map_get_goods:function(goods_id,map){
- for(var i in map.goods){
- if(map.goods[i].goods_id==goods_id) return map.goods[i];
- }
- }
+ item_map_get_goods:function(goods_id,map){
+ for(var i in map.goods){
+ if(map.goods[i].goods_id==goods_id) return map.goods[i];
+ }
+ },
+ //从优惠的映射中拿出商品从表的item
+ arr_get_goods:function(goods_id,arr){
+ for(var i in arr){
+ if(arr[i].goods_id==goods_id) return arr[i];
+ }
+ }
});
diff --git a/pages/index/index/index.json b/pages/index/index/index.json
index 3a921ec..66a0ff2 100644
--- a/pages/index/index/index.json
+++ b/pages/index/index/index.json
@@ -16,6 +16,7 @@
"richtext": "/components/diy_richtext/diy_richtext",
"assist":"/components/diy_assist/diy_assist",
"picMax": "/components/diy_picMax/diy_picMax",
- "mvideo": "/components/diy_video/diy_video"
+ "mvideo": "/components/diy_video/diy_video",
+ "service": "/components/diy_service/diy_service"
}
}
\ No newline at end of file
diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml
index 0d6c695..0b7d353 100644
--- a/pages/index/index/index.wxml
+++ b/pages/index/index/index.wxml
@@ -339,7 +339,12 @@
-
+
+
+
+
+
+
diff --git a/pages/template/index.json b/pages/template/index.json
index 4fc1363..1443fce 100644
--- a/pages/template/index.json
+++ b/pages/template/index.json
@@ -17,6 +17,7 @@
"richtext": "/components/diy_richtext/diy_richtext",
"assist":"/components/diy_assist/diy_assist",
"picMax": "/components/diy_picMax/diy_picMax",
- "mvideo": "/components/diy_video/diy_video"
+ "mvideo": "/components/diy_video/diy_video",
+ "service": "/components/diy_service/diy_service"
}
}
\ No newline at end of file
diff --git a/pages/template/index.wxml b/pages/template/index.wxml
index 4238850..0dbbeea 100644
--- a/pages/template/index.wxml
+++ b/pages/template/index.wxml
@@ -53,6 +53,10 @@
+
+
+
+
diff --git a/pages/user/coupons/exchange/exchange.js b/pages/user/coupons/exchange/exchange.js
index d9164b7..2842e32 100644
--- a/pages/user/coupons/exchange/exchange.js
+++ b/pages/user/coupons/exchange/exchange.js
@@ -60,9 +60,17 @@ Page({
* 点击兑换
*/
async click(e) {
- var monye=e.currentTarget.dataset.monye;
- var integr=e.currentTarget.dataset.integr;
- //var integr = "-" + integr;
+ var th=this;
+ this.data.monye=e.currentTarget.dataset.monye;
+ this.data.integr=e.currentTarget.dataset.integr;
+ var my_con = this.selectComponent("#my_con"); //组件的id
+ var title="是否使用"+th.data.integr+"积分兑换代金券面值"+th.data.monye+"元";
+ my_con.open(title, "确定", "取消", th.sure_pay, null)
+ },
+
+ sure_pay:function(){
+ var monye=this.data.monye;
+ var integr=this.data.integr;
var user_id = getApp().globalData.user_id;
console.log(integr,"是什么微卷",typeof integr,monye);
@@ -81,10 +89,11 @@ Page({
getApp().showWarning("积分不足");
}
}
-
- })
+ })
},
+
+
/**
* 生命周期函数--监听页面显示
*/
diff --git a/pages/user/coupons/exchange/exchange.json b/pages/user/coupons/exchange/exchange.json
index 8835af0..cc141cd 100644
--- a/pages/user/coupons/exchange/exchange.json
+++ b/pages/user/coupons/exchange/exchange.json
@@ -1,3 +1,5 @@
{
- "usingComponents": {}
+ "usingComponents": {
+ "my_confirm": "/components/my_confirm/my_confirm"
+ }
}
\ No newline at end of file
diff --git a/pages/user/coupons/exchange/exchange.wxml b/pages/user/coupons/exchange/exchange.wxml
index a7b7f7c..17abd3a 100644
--- a/pages/user/coupons/exchange/exchange.wxml
+++ b/pages/user/coupons/exchange/exchange.wxml
@@ -8,4 +8,5 @@
{{result.Integral}}积分兑换{{filter.getNum(result.ToSum)}}元微券
立即兑换
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/utils/request.js b/utils/request.js
index 5eec6d7..c4b0bae 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -191,13 +191,19 @@ module.exports = {
promisePost:function(url,data){
var th=this;
if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url;
+ var post_data=data.data;
+ var header={"content-type": "application/x-www-form-urlencoded" };
+ if(data.is_json){
+ header={ 'content-type': 'application/json'};
+ post_data=JSON.stringify(post_data);
+ }
return new Promise((resolve, reject) => {
data.isShowLoading && th.showLoading();
wx.request({
url,
method: 'POST',
- header: {"content-type": "application/x-www-form-urlencoded" },
- data:data.data,
+ header: header,
+ data:post_data,
success(res) {
data.isShowLoading && th.hideLoading();
resolve(res);