Commit 7f54d4d81d55c63dfc561e9116278946ceac33b4
Merge branch 'dev' into 'test'
Dev See merge request !477
Showing
15 changed files
with
217 additions
and
20 deletions
components/diy_advertising/diy_advertising.wxml
| ... | ... | @@ -410,11 +410,17 @@ |
| 410 | 410 | <block wx:for="{{object.data}}" wx:for-index="index" > |
| 411 | 411 | |
| 412 | 412 | <navigator url="{{item.wxapp_imgurl}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.wxapp_imgurl,'plugin')>=0}}"> |
| 413 | - <swiper-item><image src="{{item.src}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" /></swiper-item> | |
| 413 | + <swiper-item> | |
| 414 | + <image src="{{item.src}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" /> | |
| 415 | + <view class="title">{{item.title}}</view> | |
| 416 | + </swiper-item> | |
| 414 | 417 | </navigator> |
| 415 | 418 | |
| 416 | 419 | <view data-url="{{item.wxapp_imgurl}}" class="s1_gk_a1" bindtap="go_url" wx:else> |
| 417 | - <swiper-item><image src="{{item.src}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" /></swiper-item> | |
| 420 | + <swiper-item> | |
| 421 | + <image src="{{item.src}}" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" /> | |
| 422 | + <view class="title">{{item.title}}</view> | |
| 423 | + </swiper-item> | |
| 418 | 424 | </view> |
| 419 | 425 | |
| 420 | 426 | </block> | ... | ... |
components/diy_advertising/diy_advertising.wxss
| ... | ... | @@ -331,3 +331,5 @@ |
| 331 | 331 | } |
| 332 | 332 | .clicle{ width: 20rpx; height: 20rpx} |
| 333 | 333 | .dots{ position: absolute; bottom: 10rpx; width: 100%; display: flex; justify-content: center} |
| 334 | +.title{ position: absolute; left: 0; bottom: 0; background-color: rgba(6,6,6,0.5); font-size: 30rpx; | |
| 335 | + text-indent: 10rpx;width: 100%; height: 50rpx; line-height: 50rpx; color: #fff} | ... | ... |
components/diy_service/diy_service.js
0 → 100644
| 1 | +Component({ | |
| 2 | + properties: { | |
| 3 | + // 这里定义了innerText属性,属性值可以在组件使用时指定 | |
| 4 | + object:{ | |
| 5 | + type: Object, | |
| 6 | + value:null | |
| 7 | + }, | |
| 8 | + }, | |
| 9 | + data: { | |
| 10 | + iurl:getApp().globalData.setting.imghost | |
| 11 | + }, | |
| 12 | + | |
| 13 | + lifetimes: { | |
| 14 | + attached: function() { | |
| 15 | + var th=this; | |
| 16 | + //----获取系统参数----- | |
| 17 | + getApp().getConfig2(function(e) { | |
| 18 | + var json_d = JSON.parse(e.switch_list); | |
| 19 | + th.setData({ sys_switch:json_d, }) | |
| 20 | + }) | |
| 21 | + } | |
| 22 | + }, | |
| 23 | + | |
| 24 | + methods: { | |
| 25 | + berror:function(e){ | |
| 26 | + var iurl=getApp().globalData.setting.imghost; | |
| 27 | + var ob={}; | |
| 28 | + var txt="object.title_img"; | |
| 29 | + ob[txt] = iurl +'/miniapp/images/logo.png'; | |
| 30 | + this.setData(ob); | |
| 31 | + }, | |
| 32 | + | |
| 33 | + //-- 跳到绑定注册会员 -- | |
| 34 | + go_user:function(){ | |
| 35 | + getApp().goto('/pages/getphone/getphone'); | |
| 36 | + return false; | |
| 37 | + }, | |
| 38 | + | |
| 39 | + //---------联系客服------------ | |
| 40 | + contactService: function() { | |
| 41 | + getApp().getConfig(function(t) { | |
| 42 | + if (t.store_tel == undefined) { | |
| 43 | + getApp().request.get("/api/weshop/store/get/" + os.stoid, { | |
| 44 | + isShowLoading: 1, | |
| 45 | + data: {}, | |
| 46 | + success: function(rs) { | |
| 47 | + getApp().globalData.config = rs.data.data; | |
| 48 | + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | |
| 49 | + getApp().my_warnning("商家未设置电话", 0, th); | |
| 50 | + return false; | |
| 51 | + } | |
| 52 | + wx.makePhoneCall({ phoneNumber: rs.data.data.store_tel, }) | |
| 53 | + } | |
| 54 | + }) | |
| 55 | + } else { | |
| 56 | + wx.makePhoneCall({ phoneNumber: t.store_tel, }) | |
| 57 | + } | |
| 58 | + }); | |
| 59 | + }, | |
| 60 | + } | |
| 61 | +}) | ... | ... |
components/diy_service/diy_service.json
0 → 100644
components/diy_service/diy_service.wxml
0 → 100644
| 1 | +<!--有在线客户 和 打电话--> | |
| 2 | +<block wx:if="{{sys_switch.weapp_customertype}}"> | |
| 3 | + <!-- 判断是不是有登陆 --> | |
| 4 | + <view wx:if="{{userInfo}}" class="custom-service" bindtap="go_user" > | |
| 5 | + <view style="text-align: center;"> | |
| 6 | + <image class="cs-img" src="{{object.img}}"></image> | |
| 7 | + <view class="s_title" wx:if="{{object.title!=''}}">{{object.title}}</view> | |
| 8 | + </view> | |
| 9 | + </view> | |
| 10 | + | |
| 11 | + <button wx:else class="custom-service" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> | |
| 12 | + <view style="text-align: center;"> | |
| 13 | + <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> | |
| 14 | + <view class="s_title" wx:if="{{object.title!=''}}">{{object.title}}</view> | |
| 15 | + </view> | |
| 16 | + </button> | |
| 17 | +</block> | |
| 18 | + | |
| 19 | +<block wx:else> | |
| 20 | + <view class="custom-service cart-ico new_split" bindtap="contactService"> | |
| 21 | + <view style="text-align: center;"> | |
| 22 | + <image class="cs-img" src="{{object.img}}"></image> | |
| 23 | + <view class="s_title" wx:if="{{object.title!=''}}">{{object.title}}</view> | |
| 24 | + </view> | |
| 25 | + </view> | |
| 26 | +</block> | |
| 0 | 27 | \ No newline at end of file | ... | ... |
components/diy_service/diy_service.wxss
0 → 100644
| 1 | +.custom-service{ width: 116rpx; height: 116rpx; border-radius: 50%; background-color: #fff;z-index: 100; | |
| 2 | + border: 1px solid #adadad; box-shadow: 0 0 10px 2px #adadad; line-height: 28rpx; | |
| 3 | + position: fixed; top: 40%; right: 2rpx; display: flex;align-items: center;justify-content: center;} | |
| 4 | + | |
| 5 | + .cs-img{ width: 36rpx; height: 36rpx;} | |
| 6 | +.s_title{ font-size: 20rpx;} | |
| 0 | 7 | \ No newline at end of file | ... | ... |
pages/cart/cart2/cart2.js
| ... | ... | @@ -706,11 +706,33 @@ Page({ |
| 706 | 706 | cart_item.prom_pt_json=[{"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}]; |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | + //-- 如果系统要平摊到单品 -- | |
| 710 | + if(!th.data.ispt_goods){ | |
| 711 | + | |
| 712 | + var pt_data={ | |
| 713 | + 'prom_id':item_map.prom_id, | |
| 714 | + 'dis': parseFloat((item_map.price-item_map.prom_price).toFixed(2)), | |
| 715 | + 'goods':item_map.goods | |
| 716 | + } | |
| 717 | + | |
| 718 | + var pt_res=null; | |
| 719 | + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit",{is_json:1,data:pt_data}).then(res=>{ | |
| 720 | + if(res.data.code==0){ pt_res=res.data.data; } | |
| 721 | + }) | |
| 722 | + if(pt_res){ | |
| 723 | + for (var io in item_map.goods){ | |
| 724 | + //平摊赋值 | |
| 725 | + item_map.goods[io].account=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account; | |
| 726 | + item_map.goods[io].account_yu=th.arr_get_goods(item_map.goods[io].goods_id,pt_res).fisrt_account_yu; | |
| 727 | + } | |
| 728 | + } | |
| 729 | + } | |
| 730 | + | |
| 709 | 731 | o_price-=(item_map.price-item_map.prom_price); |
| 710 | 732 | //如果有限制使用优惠券,就要减掉参与的活动商品的钱 |
| 711 | 733 | if(!item_map.is_xz_yh) q_conditin=o_price; |
| 712 | 734 | } |
| 713 | - | |
| 735 | + | |
| 714 | 736 | //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表----------- |
| 715 | 737 | for(var j=0;j<item.length;j++){ |
| 716 | 738 | if(item[j].prom_type==3 && item[j].prom_id==item_map.prom_id){ |
| ... | ... | @@ -1473,6 +1495,29 @@ Page({ |
| 1473 | 1495 | return false; |
| 1474 | 1496 | } |
| 1475 | 1497 | } |
| 1498 | + | |
| 1499 | + //--- 如果有优惠促销的金额,要把金额先平摊下去 --- | |
| 1500 | + if(th.data.formData.cut_price>0 && !th.data.ispt_goods){ | |
| 1501 | + var g_arr=new Array(); | |
| 1502 | + g_arr.push(goods); | |
| 1503 | + var pt_data={ | |
| 1504 | + 'prom_id':goods.prom_id, | |
| 1505 | + 'dis': parseFloat(th.data.formData.cut_price), | |
| 1506 | + 'goods':g_arr, | |
| 1507 | + } | |
| 1508 | + | |
| 1509 | + var pt_res=null; | |
| 1510 | + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit",{is_json:1,data:pt_data}).then(res=>{ | |
| 1511 | + if(res.data.code==0){ pt_res=res.data.data; } | |
| 1512 | + }) | |
| 1513 | + if(pt_res){ | |
| 1514 | + //平摊赋值 | |
| 1515 | + goods.account=pt_res[0].fisrt_account; | |
| 1516 | + goods.account_yu=pt_res[0].fisrt_account_yu; | |
| 1517 | + } | |
| 1518 | + } | |
| 1519 | + | |
| 1520 | + | |
| 1476 | 1521 | //--组装优惠券的钱-- |
| 1477 | 1522 | if(th.data.formData.coupon_price){ |
| 1478 | 1523 | item.coupon_price=th.data.formData.coupon_price; |
| ... | ... | @@ -1653,6 +1698,13 @@ Page({ |
| 1653 | 1698 | } |
| 1654 | 1699 | } |
| 1655 | 1700 | |
| 1701 | + //把优惠的平摊结果写进去 | |
| 1702 | + if(g_item.account>=0 || g_item.account_yu!=0){ | |
| 1703 | + if(g_item.account>=0) goods.account=g_item.account; | |
| 1704 | + if(g_item.account_yu!=0) goods.account_yu=g_item.account_yu; | |
| 1705 | + item.is_discount_amount=1; | |
| 1706 | + } | |
| 1707 | + | |
| 1656 | 1708 | //导购ID |
| 1657 | 1709 | if(g_item.guide_id){ |
| 1658 | 1710 | goods.guide_id=g_item.guide_id; |
| ... | ... | @@ -2474,7 +2526,12 @@ Page({ |
| 2474 | 2526 | } |
| 2475 | 2527 | is_xz_yh=0; |
| 2476 | 2528 | var item_price=gd.goods_price*gd.goods_num; |
| 2529 | + //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 -- | |
| 2530 | + if(gd.account!=null && gd.account!=undefined){ | |
| 2531 | + item_price=gd.account*gd.goods_num; | |
| 2532 | + } | |
| 2477 | 2533 | ckeck_quan_price+=item_price; |
| 2534 | + | |
| 2478 | 2535 | //--组装价格list-- |
| 2479 | 2536 | if (check_quan_price_list) { |
| 2480 | 2537 | check_quan_price_list += "," +item_price; |
| ... | ... | @@ -2755,11 +2812,17 @@ Page({ |
| 2755 | 2812 | }, |
| 2756 | 2813 | |
| 2757 | 2814 | //从优惠的映射中拿出商品从表的item |
| 2758 | - item_map_get_goods:function(goods_id,map){ | |
| 2759 | - for(var i in map.goods){ | |
| 2760 | - if(map.goods[i].goods_id==goods_id) return map.goods[i]; | |
| 2761 | - } | |
| 2762 | - } | |
| 2815 | + item_map_get_goods:function(goods_id,map){ | |
| 2816 | + for(var i in map.goods){ | |
| 2817 | + if(map.goods[i].goods_id==goods_id) return map.goods[i]; | |
| 2818 | + } | |
| 2819 | + }, | |
| 2820 | + //从优惠的映射中拿出商品从表的item | |
| 2821 | + arr_get_goods:function(goods_id,arr){ | |
| 2822 | + for(var i in arr){ | |
| 2823 | + if(arr[i].goods_id==goods_id) return arr[i]; | |
| 2824 | + } | |
| 2825 | + } | |
| 2763 | 2826 | |
| 2764 | 2827 | |
| 2765 | 2828 | }); | ... | ... |
pages/index/index/index.json
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | "richtext": "/components/diy_richtext/diy_richtext", |
| 17 | 17 | "assist":"/components/diy_assist/diy_assist", |
| 18 | 18 | "picMax": "/components/diy_picMax/diy_picMax", |
| 19 | - "mvideo": "/components/diy_video/diy_video" | |
| 19 | + "mvideo": "/components/diy_video/diy_video", | |
| 20 | + "service": "/components/diy_service/diy_service" | |
| 20 | 21 | } |
| 21 | 22 | } |
| 22 | 23 | \ No newline at end of file | ... | ... |
pages/index/index/index.wxml
| ... | ... | @@ -339,7 +339,12 @@ |
| 339 | 339 | <!--图片组合--> |
| 340 | 340 | <block wx:if="{{item.ename=='picMix'}}"> |
| 341 | 341 | <picMax object="{{item.content}}"></picMax> |
| 342 | - </block> | |
| 342 | + </block> | |
| 343 | + <!--在线上客服--> | |
| 344 | + <block wx:if="{{item.ename=='onlineService'}}"> | |
| 345 | + <service object="{{item.content}}"></service> | |
| 346 | + </block> | |
| 347 | + | |
| 343 | 348 | </view> |
| 344 | 349 | </block> |
| 345 | 350 | </view> | ... | ... |
pages/template/index.json
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | "richtext": "/components/diy_richtext/diy_richtext", |
| 18 | 18 | "assist":"/components/diy_assist/diy_assist", |
| 19 | 19 | "picMax": "/components/diy_picMax/diy_picMax", |
| 20 | - "mvideo": "/components/diy_video/diy_video" | |
| 20 | + "mvideo": "/components/diy_video/diy_video", | |
| 21 | + "service": "/components/diy_service/diy_service" | |
| 21 | 22 | } |
| 22 | 23 | } |
| 23 | 24 | \ No newline at end of file | ... | ... |
pages/template/index.wxml
| ... | ... | @@ -53,6 +53,10 @@ |
| 53 | 53 | <block wx:if="{{item.ename=='picMix'}}"> |
| 54 | 54 | <picMax object="{{item.content}}"></picMax> |
| 55 | 55 | </block> |
| 56 | + <!--在线上客服--> | |
| 57 | + <block wx:if="{{item.ename=='onlineService'}}"> | |
| 58 | + <service object="{{item.content}}"></service> | |
| 59 | + </block> | |
| 56 | 60 | </view> |
| 57 | 61 | </block> |
| 58 | 62 | </view> | ... | ... |
pages/user/coupons/exchange/exchange.js
| ... | ... | @@ -60,9 +60,17 @@ Page({ |
| 60 | 60 | * 点击兑换 |
| 61 | 61 | */ |
| 62 | 62 | async click(e) { |
| 63 | - var monye=e.currentTarget.dataset.monye; | |
| 64 | - var integr=e.currentTarget.dataset.integr; | |
| 65 | - //var integr = "-" + integr; | |
| 63 | + var th=this; | |
| 64 | + this.data.monye=e.currentTarget.dataset.monye; | |
| 65 | + this.data.integr=e.currentTarget.dataset.integr; | |
| 66 | + var my_con = this.selectComponent("#my_con"); //组件的id | |
| 67 | + var title="是否使用"+th.data.integr+"积分兑换代金券面值"+th.data.monye+"元"; | |
| 68 | + my_con.open(title, "确定", "取消", th.sure_pay, null) | |
| 69 | + }, | |
| 70 | + | |
| 71 | + sure_pay:function(){ | |
| 72 | + var monye=this.data.monye; | |
| 73 | + var integr=this.data.integr; | |
| 66 | 74 | |
| 67 | 75 | var user_id = getApp().globalData.user_id; |
| 68 | 76 | console.log(integr,"是什么微卷",typeof integr,monye); |
| ... | ... | @@ -81,10 +89,11 @@ Page({ |
| 81 | 89 | getApp().showWarning("积分不足"); |
| 82 | 90 | } |
| 83 | 91 | } |
| 84 | - | |
| 85 | - }) | |
| 86 | 92 | |
| 93 | + }) | |
| 87 | 94 | }, |
| 95 | + | |
| 96 | + | |
| 88 | 97 | /** |
| 89 | 98 | * 生命周期函数--监听页面显示 |
| 90 | 99 | */ | ... | ... |
pages/user/coupons/exchange/exchange.json
pages/user/coupons/exchange/exchange.wxml
| ... | ... | @@ -8,4 +8,5 @@ |
| 8 | 8 | <view class='mb20'>{{result.Integral}}积分兑换{{filter.getNum(result.ToSum)}}元微券</view> |
| 9 | 9 | <view class='jf-btn' bindtap='click' data-monye='{{result.ToSum}}' data-integr="{{result.Integral}}">立即兑换</view> |
| 10 | 10 | </view> |
| 11 | -</block> | |
| 12 | 11 | \ No newline at end of file |
| 12 | +</block> | |
| 13 | +<my_confirm id="my_con"></my_confirm> | |
| 13 | 14 | \ No newline at end of file | ... | ... |
utils/request.js
| ... | ... | @@ -191,13 +191,19 @@ module.exports = { |
| 191 | 191 | promisePost:function(url,data){ |
| 192 | 192 | var th=this; |
| 193 | 193 | if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; |
| 194 | + var post_data=data.data; | |
| 195 | + var header={"content-type": "application/x-www-form-urlencoded" }; | |
| 196 | + if(data.is_json){ | |
| 197 | + header={ 'content-type': 'application/json'}; | |
| 198 | + post_data=JSON.stringify(post_data); | |
| 199 | + } | |
| 194 | 200 | return new Promise((resolve, reject) => { |
| 195 | 201 | data.isShowLoading && th.showLoading(); |
| 196 | 202 | wx.request({ |
| 197 | 203 | url, |
| 198 | 204 | method: 'POST', |
| 199 | - header: {"content-type": "application/x-www-form-urlencoded" }, | |
| 200 | - data:data.data, | |
| 205 | + header: header, | |
| 206 | + data:post_data, | |
| 201 | 207 | success(res) { |
| 202 | 208 | data.isShowLoading && th.hideLoading(); |
| 203 | 209 | resolve(res); | ... | ... |