diff --git a/app.js b/app.js index f3995ac..91af319 100644 --- a/app.js +++ b/app.js @@ -517,6 +517,9 @@ App({ } }, + re_to(url){ + wx.redirectTo({ url: url, }) //跳到非tabbar页 + }, //显示提示,word提示内容,type 0失败,提示 1成功 my_warnning(word, type, that, width) { diff --git a/app.json b/app.json index 934ee9d..6601c6c 100644 --- a/app.json +++ b/app.json @@ -26,8 +26,7 @@ "pages/activity/pind_list/pind_list", "pages/team/team_success/team_success", "pages/team/team_show/team_show", - "pages/team/team_ping/team_ping", - "pages/cart/cart2_pt/cart2_pt", + "pages/team/team_ping/team_ping", "pages/cart/cart_wk/cart_wk", @@ -227,7 +226,8 @@ "pages/user/monthgiftbag/giftpacklist/giftpacklist", "pages/user/monthgiftbag/giftpackinfo/giftpackinfo", "pages/user/monthgiftbag/giftpackbuy/giftpackbuy", - "pages/cart/cart2_inte/cart2_inte" + "pages/cart/cart2_inte/cart2_inte", + "pages/cart/cart2_pt/cart2_pt" ] }, diff --git a/components/diy_public/diy_public.js b/components/diy_public/diy_public.js new file mode 100644 index 0000000..ce4cdce --- /dev/null +++ b/components/diy_public/diy_public.js @@ -0,0 +1,420 @@ +// var e = function(e) { +// return e && e.__esModule ? e : { +// default: e +// }; +// }(require("../../utils/LoadMore3.js")), +// n = new e.default(), +var t = getApp(), + a = t.request, + o = t.globalData.setting, + os = o, + i = require("../../utils/util.js"), + ut = i, + s = require("../../utils/common.js"); +var regeneratorRuntime = require('../../utils/runtime.js'); +Component({ + properties: { + // 这里定义了innerText属性,属性值可以在组件使用时指定 + object: { + type: Object, + value: null, + }, + goods_array: { + type: Array, + value: [] + }, + newTime: { + type: Number, + value: 0 + }, + prom_type:{ + type:Number, + value:0 + } + }, + data: { + // 这里是一些组件内部数据 + yc: false, + someData: null, + ylp_img: "https://mshopimg.yolipai.net/", + imghost: os.imghost, + timer: null, + user_id:0, + img_width:100, + img_height:100, + swiperHeight:0, + prom_text:"已秒", + kttypeArr:['','商家','会员','阶梯'], + imgobj:{ + '1':"/miniapp/images/component/seckill.png", + '6':"/miniapp/images/component/pingd/pingd.png" + }, + nav1:'/packageA/pages/goodsInfo/goodsInfo?', + nav2:'/pages/goods/goodsInfo/goodsInfo?', + }, + + pageLifetimes: { + //要处理一下,游客登录后的界面的变化,主要还该是改变会员 + show: function () { + + + //会员身份变化 + var th = this; + var g_id = this.data.object; + + //只有再会员登陆之后,才重新调用接口 + // console.log('秒杀组件------------'); + // if(this.data.user_id!=getApp().globalData.user_id){ + // this.data.user_id=getApp().globalData.user_id + // this.init(g_id); + // } + setTimeout(function () { + if (th.data.goods_array && th.data.goods_array.length > 0) { + th.data.timer = setInterval(function () { + th.countDown2(th); + }, 1000); + } + },600) + }, + + hide:function () { + // 页面被被销毁的时候,清除定时器 + clearInterval(this.data.timer); + } + }, + + ready: function () { + if (this.data.prom_type==6) { + this.setData({ + prom_text:'已团', + nav1:'/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo?', + nav2:'/pages/goods/goodsInfo/goodsInfo?' + }) + } + var g_id = this.data.object; + + this.init(g_id); + this.data.user_id=getApp().globalData.user_id; + }, + detached() { + // 页面被被销毁的时候,清除定时器 + clearInterval(this.data.timer); + }, + methods: { + // 这里是一个自定义方法 + customMethod: function () { }, + init: function (g_id) { + var th = this; + this.loadImg(g_id) + getApp().getConfig2(function (e) { + var swithc_list = e.switch_list; + var sw_arr = JSON.parse(swithc_list); + + if(sw_arr.is_retail_price){ + th.setData({is_retail_price:1}); + } + }) + + + var app = getApp(), goodsidlist = "", idlist = ""; + if (g_id.data_type == 2) { + if (g_id.data && g_id.data.length > 0) { + //--先把商品ID串起来-- + g_id.data.forEach(function (val, ind) { + var item = {}; + goodsidlist += val.goodsid + ","; + idlist += val.flashid + ","; + }) + goodsidlist = ut.sub_last(goodsidlist); + idlist = ut.sub_last(idlist); + + var user_id=getApp().globalData.user_id; + if(!user_id){ user_id=0;} + + //--调用接口,读取秒杀-- + // var gUrl = "/api/ms/flash_sale/getGoodsList?store_id=" + os.stoid + "&goodsidlist=" + goodsidlist+"&user_id="+user_id+"&type=1"; + let gUrl = "/api/ms/flash_sale/getGoodsList?store_id=" + os.stoid + "&idlist=" + idlist + "&user_id="+user_id+"&type=1"; + + if (th.data.prom_type==6) { //天天拼单 + gUrl="/api/weshop/teamlist/getGoodsList?store_id=" + +os.stoid+"&goodsidlist="+goodsidlist; + } + + + app.request.promiseGet(gUrl, {}).then(res => { + + //如果秒杀的数组为空的时候 + var goodslist = res.data.data; + //就算是添加的活动已经过期,就要用最新的进行中活动 + if (goodslist && goodslist.length > 0) { + th.set_goods_list(g_id.data, goodslist); + } + }); + } + } else { + th.no_gid_set(); + } + }, + + //当是默认的情况 + no_gid_set() { + var user_id=getApp().globalData.user_id; + if(!user_id){ user_id=0;} + + let req={ store_id: os.stoid, is_end: 0, is_show: 1, timetype: 2,user_id:user_id}; + let gUrl="/api/ms/flash_sale/spikepage?page=1&pageSize=9" + + if (this.data.prom_type==6) { //天天拼单 + gUrl="/api/weshop/teamlist/pageteam/2?page=1&pageSize=9" + req={ + store_id:os.stoid, + is_end: 0, + is_show: 1, + user_id:user_id, + } + } + + getApp().request.promiseGet(gUrl, + { isShowLoading: 1, data:req } + ).then(res => { + + if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) { + var goodsidlist = res.data.data.pageData; + this.set_goods_list(null, goodsidlist); + } + }); + }, + + //就算是添加的活动已经过期,就要用最新的活动 + set_goods_list(g_id, goodslist) { + let prom_type=this.data.prom_type + goodslist.forEach(function (vy, indy) { + if(!vy.id) vy.id=vy.prom_id; + }) + + // 判断火热,预热 + var newTime = ut.gettimestamp(), all_array = [], th = this; + th.setData({ newTime: newTime }); + if (g_id) { + /*--商品队列按照添加的顺序排列--*/ + g_id.forEach(function (val, ind) { + goodslist.forEach(function (vy, indy) { + if (val.goodsid == vy.goods_id) { + all_array.push(vy); + } + }) + }) + } else { + all_array = goodslist; + } + + if (all_array.length == 0) { + all_array = goodslist; + } + + for(let i in all_array){ + let item=all_array[i]; + if(item.user_price) item.price=item.user_price; + if(item.start_time > newTime) { + item.status = 0; + } else if(item.end_time > newTime) { + item.status = 1; + }; + + } + + + var promisies = []; + for (const key in all_array) { + if (Object.hasOwnProperty.call(all_array, key)) { + const val = all_array[key]; + + promisies[key] = getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/"+prom_type+"/" + val.id, + {} + ).then(res => { + if (res.data.code == 0) { + if (res.data.data <= 0) all_array[key].status = 2; + }; + }); + } + } + + + Promise.all(promisies).then(() => { + // 判断活动是否结束 + let empty=[] + for(let i in all_array){ + let item=all_array[i]; + if(newTime > item.end_time) { + all_array[i].status = 3; + }; + // let price=all_array[i].price.toFixed(2) + let price=all_array[i].price + '' + if (price && price.indexOf('.') > -1) { + let priceArr = price.split(".") + all_array[i].price_n = priceArr[0] + all_array[i].price_xs = priceArr[1] + }else{ + all_array[i].price_n = price + } + + all_array[i].residue=all_array[i].goods_num*1 - all_array[i].buy_num*1 + if (all_array[i].residue && all_array[i].residue > 0 && all_array[i].status !=2) { + empty.push(all_array[i]) + } + } + + //控制已售罄是否显示 + if (!th.data.object.hide_sold_out_items) { + all_array=empty + } + + + var arr = new Array(); + if (th.data.object.style==7) { + //--三个三个一组--- + for (var i = 0; i < all_array.length; i += 2) { + arr.push(all_array.slice(i, i + 2)); + } + }else{ + //--三个三个一组--- + for (var i = 0; i < all_array.length; i += 3) { + arr.push(all_array.slice(i, i + 3)); + } + } + + + /*--熏染到前台--*/ + th.setData({ goods_array: arr }); + if (th.data.object.style==6) { + th.setSwiper_h() + } + + }); + + + th.data.timer = setInterval(function () { + th.countDown2(th); + }, 1000); + }, + setSwiper_h(){ + var th=this + wx.createSelectorQuery().in(this).select('.swiper_h').boundingClientRect(rect => { + if (rect && rect.height) { + var sumHeigth=(rect.height+13)+'px' + th.setData({ + swiperHeight: sumHeigth + }) + } + }).exec(); + // const query = this.createSelectorQuery() + // query.select('.swiper_h').boundingClientRect() + // query.exec( (res)=> { + // console.log(res) + // console.log(res[0].height) + // console.log(res[0].height * data.t.length) + // let sumHeigth = res[0].height * data.t.length; + // console.error('组件高度'); + // console.log(sumHeigth); + // th.setData({ + // swiperHeight: sumHeigth + // }) + // }) + }, + + + //---小于10的格式化函数---- + timeFormat: function (param) { + return param < 10 ? '0' + param : param; + }, + //----秒杀倒计时函数----- + countDown2: function (ob) { + if (ob == undefined) return false; + var ee = ob; + // 获取当前时间,同时得到活动结束时间数组 + var newTime = ut.gettimestamp(); + this.setData({ newTime: newTime }); + + var List = ee.data.goods_array; + if (List.length == 0) return false; + for (var j = 0; j < List.length; j++) { + // 对结束时间进行处理渲染到页面 + var endTimeList = List[j]; + for (var i = 0; i < endTimeList.length; i++) { + var o = endTimeList[i]; + var endTime = o.end_time; + if (newTime < o.start_time) endTime = o.start_time; + let obj = null; + // 如果活动未结束,对时间进行处理 + if (endTime - newTime > 0) { + let time = (endTime - newTime); + // 获取天、时、分、秒 + let day = parseInt(time / (60 * 60 * 24)); + let hou = parseInt(time % (60 * 60 * 24) / 3600); + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + obj = { + day: this.timeFormat(day), + hou: this.timeFormat(hou), + min: this.timeFormat(min), + sec: this.timeFormat(sec) + } + } else { + //活动已结束,全部设置为'00' + obj = { + day: '00', + hou: '00', + min: '00', + sec: '00' + } + } + var txt = "goods_array[" + j + "][" + i + "].djs"; + ee.setData({ + [txt]: obj + }); + } + } + }, + //图片失败,默认图片 + bind_bnerr3: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, + + go_to: function () { + let url= "/pages/activity/seckill_list/seckill_list" + if (this.data.prom_type==6) { //天天拼单 + url="/pages/activity/pind_list/pind_list" + } + wx.navigateTo({ + url + }); + }, + //加入购物车 + shoppingCart(){ + console.log('加入购物车'); + }, + loadImg(g_id){ + if (g_id.style==1) { + let w='' + switch (g_id.picture_scale) { + case 1: + w=`width:calc(100%-${g_id.page_margins*2}px);height:calc(100%-${g_id.page_margins*2}px)` + break; + + default: + break; + } + + + + } + } + + }, + + +}) \ No newline at end of file diff --git a/components/diy_public/diy_public.json b/components/diy_public/diy_public.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/diy_public/diy_public.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/diy_public/diy_public.wxml b/components/diy_public/diy_public.wxml new file mode 100644 index 0000000..6dce2de --- /dev/null +++ b/components/diy_public/diy_public.wxml @@ -0,0 +1,465 @@ + + + + + + + + {{object.column_name}} + + + 更多 + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + + + 距结束时间 + 距开始时间 + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + + + {{aitem.goods_name}} + + {{aitem.ct_num}}人团 + {{kttypeArr[aitem.kttype]}}团 + + + + + {{prom_text}}{{aitem.buy_num}} + 还剩余{{aitem.status==2 ? '0' : aitem.residue}} + + + + ¥{{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price || aitem.market_price}} + + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + {{aitem.goods_name}} + + {{aitem.ct_num}}人团 + {{kttypeArr[aitem.kttype]}}团 + + + {{prom_text}}{{aitem.buy_num}} + 还剩余{{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price || aitem.market_price}} + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + {{aitem.goods_name}} + + {{prom_text}}{{aitem.buy_num}} + {{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price || aitem.market_price}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + + {{aitem.goods_name}} + + + {{prom_text}}{{aitem.buy_num}} + {{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}}¥{{aitem.shop_price || aitem.market_price}} + + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + + + 距结束时间 + 距开始时间 + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + + + {{aitem.goods_name}} + + {{aitem.ct_num}}人团 + {{kttypeArr[aitem.kttype]}}团 + + + + + {{prom_text}}{{aitem.buy_num}} + 还剩余{{aitem.status==2 ? '0' : aitem.residue}} + + + + ¥{{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price || aitem.market_price}} + + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + {{aitem.goods_name}} + + {{aitem.ct_num}}人团 + {{kttypeArr[aitem.kttype]}}团 + + + {{prom_text}}{{aitem.buy_num}} + 还剩余{{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price || aitem.market_price}} + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + {{aitem.goods_name}} + + {{aitem.ct_num}}人团 + {{kttypeArr[aitem.kttype]}}团 + + + {{prom_text}}{{aitem.buy_num}} + 还剩余{{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price || aitem.market_price}} + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + {{aitem.goods_name}} + + {{prom_text}}{{aitem.buy_num}} + 还剩余{{aitem.residue}} + + + + + {{aitem.price}} + ¥{{aitem.shop_price || aitem.market_price}} + + + + + {{object.button_content}} + + + + + + + + + + + + + + + + + + + + + + + + + + + 已售罄 + + + {{aitem.djs.day}}天{{aitem.djs.hou}}:{{aitem.djs.min}}:{{aitem.djs.sec}} + + + + {{aitem.goods_name}} + + {{prom_text}}{{aitem.buy_num}} + {{aitem.residue}} + + + + + {{aitem.price_n}}.{{aitem.price_xs}} + ¥{{aitem.shop_price || aitem.market_price}} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/diy_public/diy_public.wxss b/components/diy_public/diy_public.wxss new file mode 100644 index 0000000..25c399a --- /dev/null +++ b/components/diy_public/diy_public.wxss @@ -0,0 +1,548 @@ +.flex{ + display: flex; + align-items: center; +} +.top { + background-color: white; + height: 70rpx; + line-height: 70rpx; + color: #000; + border-bottom: 2rpx solid #eee; + padding:0rpx 20rpx; + display: flex; + justify-content: space-between; + /* font-size: 32rpx; */ + font-size: 24rpx; +} + +.s_it { + width: 100%; + display: flex; + background-color: white; +} + +.s_prom { + width: 100%; + background-color: white; + min-height: 200rpx; +} + +swiper { + display: block; + height: 400rpx; +} + +.right_k { + width: 93rpx; + color: #7b7b7b; +} +.right_k image{ + width: 20rpx; + height: 20rpx; +} + .t_left { + width: 10rpx; + height: 38rpx; + background: #f23030; + margin-right: 10rpx; +} +.n_t_ms{ + color:#f23030; +} + +.sp { + min-height: 300rpx; + width: 100%; + background-color: white; + padding: 18rpx; + display: flex; +} + +.sp .sp_top { + height: 220rpx; + min-width: 30%; +} + +.sp .sp_top .s_img { + width: 210rpx; + height: 100%; +} + +.sp .sp_top .s_img image { + width: 210rpx; + height: 100%; + position: relative; + top: -74rpx; + left: 0rpx; +} + +.sp .sp_top .s_top_kill { + background-color: #c4182e; + font-size: 24rpx; + height: 38rpx; + line-height: 38rpx; + padding: 4rpx 10rpx; + border-radius: 10rpx; + z-index: 999; + position: relative; + top: 1rpx; + width: 110rpx; + color: #fff; + text-align: center; +} + +.po { + position: absolute; +} + +.sp .sp_top .s_foot_kill { + font-size: 20rpx; + position: relative; + top: -90rpx; + width: 210rpx; + height: 38rpx; + line-height: 38rpx; + color: #fff; + text-align: center; + background-color: rgba(0, 0, 0, 0.5); +} + +.sp_wz { + width: 210rpx; + min-height: 100rpx; +} + +.sp_wz .sp_wzi { + font-size: 30rpx; + border-bottom: 2rpx solid #dcdcdc; + width: 100%; + /* text-align: left; */ + padding: 4rpx 0; + /* overflow: hidden; */ + height: 90rpx; + word-break: break-all; + /* text-overflow: ellipsis; + white-space: nowrap; + line-height: 48rpx; */ +} + +.sp_wz .sp_jg { + color: #c4182e; + font-size: 30rpx; + overflow: hidden; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; + margin-right: 10rpx; +} + +.sp_wz .sp_jgx { + color: #adadad; + text-decoration: line-through; + font-size: 24rpx; + overflow: hidden; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; +} + +.one { + margin-left: 14rpx; +} + +.sp .sp_top .s_top1_kill { + position: absolute; + background-color: #c4182e; + font-size: 24rpx; + height: 38rpx; + line-height: 38rpx; + left: 265rpx; + top: 100rpx; + padding: 0 10rpx; + color: white; + border-radius: 10rpx; +} + +.sp .sp_top .s_top2_kill { + position: absolute; + background-color: #c4182e; + font-size: 24rpx; + height: 38rpx; + line-height: 38rpx; + right: 146rpx; + top: 100rpx; + padding: 0 10rpx; + color: white; + border-radius: 10rpx; +} + +.sp .sp_top .s_foot1_kill { + font-size: 20rpx; + position: absolute; + top: 270rpx; + width: 210rpx; + height: 38rpx; + line-height: 38rpx; + color: #fff; + text-align: center; + background-color: rgba(0, 0, 0, 0.5); +} + +.po1 { + position: absolute; +} + +.sp .sp_top .s_foot2_kill { + font-size: 20rpx; + position: absolute; + top: 270rpx; + width: 210rpx; + height: 38rpx; + line-height: 38rpx; + color: #fff; + text-align: center; + background-color: rgba(0, 0, 0, 0.5); +} + +.sp2 { + width: 100%; + min-height: 240rpx; +} + +.sp2 .one1 { + background-color: white; + height: 285rpx; + display: flex; + padding:0rpx 20rpx; + border-bottom: 6rpx#eee solid; + align-items: center; +} + +.sp2 .one1 .o1_img { + width: 220rpx; + height: 220rpx; + margin-right: 25rpx; +} + +.o1_right .sp_wzi { + font-size: 30rpx; + margin-bottom: 6rpx; + /* text-align: left; */ + padding: 4rpx 0; + height: 90rpx; + /* overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; */ +} + +.o1_right .o1_sj_kill { + height: 60rpx; + margin-bottom: 10rpx; + font-size: 28rpx; +} + +.o1_right .o1_sj_kill text { + background-color: #fdcb08; + text-align: center; + border-radius: 10rpx; + padding: 4rpx; + margin-left: 6rpx; +} + +.o1_right .sp_jg { + color: #c4182e; + font-size: 30rpx; + overflow: hidden; + display: inline-block; + margin-right: 10rpx; +} + +.o1_right .sp_jgx { + color: #dcdcdc; + text-decoration: line-through; + font-size: 26rpx; + overflow: hidden; + display: inline-block; +} + +.o1_img image { + width: 220rpx; + height: 220rpx; +} +.o1_right{ + width: 465rpx; +} +.o1_right .wo { + background-color: #c4182e; + width: 150rpx; + height: 50rpx; + line-height: 50rpx; + color: white; + text-align: center; + font-size: 30rpx; + border-radius: 14rpx; +} +.rob{ + display: flex; + justify-content: flex-end; + font-size: 30rpx; +} +.money{ + display: flex; + align-items: center; +} + +.sp .sp_top .s_top_kill.gray{background-color:#bdbdc1;color: #fff;font-weight: normal} + + +.ellipsis-2 { + + height: 110rpx; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} +.ellipsis-2n { + + /* height: 97rpx; */ + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} +.pdlf10{ + padding: 0 10rpx; +} +.new_item1{ + width: 100%; + overflow: hidden; +} + +.new_item1_image{ + width: 100%; + /* max-width: 100%; + max-height: 100%; */ +} +.new_item1_time{ + height: 50rpx; + background: #f23030; + color: #fff; + /* font-size: 25rpx; */ + font-size: 24rpx; + display: flex; + justify-content: space-between; + align-items: center; + opacity:.8; + /* padding: 0rpx 30rpx; */ + +} +.new_item1_time image{ + width: 188rpx; + height: 52rpx; +} +.new_item1_goods_name{ + padding: 10rpx 10rpx 0rpx; + /* font-size: 26rpx; */ + font-size: 28rpx; + width: 100%; + box-sizing: border-box; + color: #333333; +} +.new_item1_price{ + display: flex; + /* padding: 0 10rpx; */ + align-items: center; + justify-content: space-between; + /* font-size: 26rpx; */ + font-size: 24rpx; + padding: 0 10rpx 10rpx; +} +.clor{ + /* color: rgba(196, 24, 45, 1); */ + color: #ec0022; +} +.clor7b{ + color: #7b7b7b; +} +.new_item1_but{ + width: 130rpx; + height: 60rpx; + color: #fff; + background-color: #f23030; + line-height: 60rpx; + text-align: center; + border-radius: 15rpx; +} +.new_item1_but1{ + border-radius: 50rpx !important; +} +.new_item1_but2{ + border-radius: 50rpx !important; + background-color: rgba(0, 0, 0, 0) !important; + color: #f23030 !important; + border: 1rpx solid #f23030 !important; +} +.new_item1_but3{ + background-color: rgba(0, 0, 0, 0) !important; + color: #f23030 !important; + border: 1rpx solid #f23030 !important; +} + + + + +.new_item1_box{ + /* padding-top: 17rpx; */ + width: 100%; + box-sizing: border-box; + overflow: hidden; +} + +.aborder{ + border: 1px solid #e8e8e8; +} +.bgf{ + background-color: #fff; +} +.boxsha{ + /* box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.25); */ + /* box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); */ + box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 3px 10px 0 rgba(0, 0, 0, 0.19); +} +.but_radius85{ + border-radius:289rpx; +} +.but_radius5{ + border-radius:8px; +} +.imgBox{ + position: relative; +} +.imgBox_img{ + position: absolute; + left: 0; + top: 0; + width: 74rpx; + height: 70rpx; + +} + +.aspect_ratio1{ + aspect-ratio:1/1; +} +.aspect_ratio2{ + aspect-ratio:16/9; +} +.aspect_ratio3{ + aspect-ratio:3/2; +} +.aspect_ratio4{ + aspect-ratio:3/4; +} +.container1 { + position: relative; + width:100%; + padding-top: 100%; + overflow: hidden; +} +.container2 { + position: relative; + width:100%; + padding-top: 56.25%; + overflow: hidden; +} +.container3 { + position: relative; + width:100%; + padding-top: 66.67%; + overflow: hidden; +} +.container4 { + position: relative; + width:100%; + padding-top: 133.33%; + overflow: hidden; + +} + +.images1 { + display: block; + position: absolute; + width: 100%; + height: 100%; + top: 0; + bottom: 0; + left: 0; + right: 0; + object-fit: cover; + +} + +.flex2{ + display: flex; + /* align-items: center; */ + justify-content: space-between; + flex-wrap: wrap; + box-sizing: border-box; +} +.flex2:after { + content: ""; + width: 30%; + height: 0px; + visibility: hidden; + } + + .boxpad{ + /* padding:11rpx 9rpx; */ + box-sizing: border-box; + } + .pricefs28{ + font-size: 28rpx !important; + } + .pricefs42{ + font-size: 42rpx !important; + } + .pricefs38{ + font-size: 38rpx !important; + } + .imgbox1{ + width: 60rpx; + height: 60rpx; + } + .topBox{ + position: relative; + } + + .item_float{ + position: absolute; + bottom: 0; + left: 0; + width: 100%; + box-sizing: border-box; + } + .buy_box{ + display: flex; + margin: 10rpx 0 0 10rpx; + width: 100%; + opacity:.8; + } + .buy_box view{ + padding: 10rpx; + background-color:#f23030; + color: #fff; + /* margin-top: 10rpx; */ + line-height: 28rpx; + border-radius: 10rpx; + } + .mgr10{ + margin-right: 10rpx; + } + .fs24{ + font-size: 24rpx; + } + .lineh24{ + line-height: 24rpx !important; + } \ No newline at end of file diff --git a/packageA/pages/cart2_ser/cart2_ser.js b/packageA/pages/cart2_ser/cart2_ser.js index 7a22e7b..5c06bb6 100644 --- a/packageA/pages/cart2_ser/cart2_ser.js +++ b/packageA/pages/cart2_ser/cart2_ser.js @@ -3,7 +3,7 @@ var t = getApp(), a = t.request, e = require("../../../utils/common.js"), s = require("../../../utils/util.js"), - o = require("../../../utils/md5.js"), + ut=s, o = require("../../../utils/md5.js"), to = getApp(); var oo = t.globalData.setting, os = oo; @@ -49,6 +49,10 @@ Page({ is_cart: 0, //是不是购物车进来的购买 }, onLoad: function(t) { + + //定义第一次进入 + this.data.fir_in=1; + wx.setNavigationBarTitle({ title: "填写订单", }); @@ -274,11 +278,47 @@ Page({ //----------子页返回父页触发---------- onShow: function() { - var fy=s.fy_back("/pages/user/order_list/order_list?index=2&tabindex=1",1); - if(fy) return false; - t_pay.set_fir(); var th = this; + + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + var fy=s.fy_back("/pages/user/order_list/order_list?index=2&tabindex=1",1); + if(fy) return false; + t_pay.set_fir(); + + var back_url="/pages/payment/pay_success/pay_success?card=1&order_id=" + th.data.order_id; + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.order_id,back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){ + + if(!th.data.order_id) return false; + getApp().request.promiseGet("/api/weshop/recharge/user/page", + {data:{store_id:os.stoid,order_id:th.data.order_id,user_id:getApp().globalData.user_id }}).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pay_status==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to(back_url); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().re_to("/pages/user/order_list/order_list?index=2&tabindex=1"); + },1000) + } + } + }) + }); + + } + + if (th.data.isclose == 0) { wx.navigateTo({ url: "/pages/index/index/index" @@ -647,6 +687,9 @@ Page({ }, 1000) },function (e){ + + console.log('kkkkkkk'); + wx.showToast({ title: e, icon: 'none', diff --git a/packageA/pages/details_serviceCard/details_serviceCard.js b/packageA/pages/details_serviceCard/details_serviceCard.js index 99312e5..eb36139 100644 --- a/packageA/pages/details_serviceCard/details_serviceCard.js +++ b/packageA/pages/details_serviceCard/details_serviceCard.js @@ -20,6 +20,9 @@ Page({ */ onLoad: function(options) { + //定义第一次进入 + this.data.fir_in=1; + self = this; this.data.options = options; @@ -47,8 +50,87 @@ Page({ */ onShow: function() { this.data.is_summit_ing=0; - util.fy_back('',0) - t_pay.set_fir(); + + var th=this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + util.fy_back('',0) + t_pay.set_fir(); + + var back_url='/pages/user/order_list/order_list?index=2&tabindex=1'; + var err_url='/pages/user/order_list/order_list?index=2&tabindex=1'; + + //判断是不是有调用支付过 + if(th.data.payed) { + th.data.payed=0; + //-- 判断一下活动的类型 -- + var prom_type = th.data.details.list[0].prom_type > 0 ? th.data.details.list[0].prom_type : 0; + var order_id = th.data.details.order_id; + var order_sn = th.data.details.order_sn; + + var ck_url = ''; //请求地址 + var req_data = {}; //请求参数 + if (parseInt(prom_type) == 6) { + //跳转到组图的页面 + back_url= "/packageA/pages/serviceCard_pd/team_success/team_success?ordersn=" + order_sn + ck_url = "/api/weshop/rechargeServicelist/page"; + req_data = {store_id: os.stoid, order_id: order_id}; + } else { + ck_url = "/api/weshop/recharge/user/page"; + req_data = {store_id: os.stoid, order_id: order_id, user_id: getApp().globalData.user_id}; + } + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.details,back_url, err_url, function () { + if (!th.data.details) return false; + getApp().request.promiseGet(ck_url, + {data: req_data}).then(res => { + if (ut.ajax_ok(res)) { + var item = res.data.data.pageData[0]; + if (parseInt(prom_type) == 6) { + if (item.pt_status == 1 || item.pt_status == 2) { + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(() => { + getApp().re_to(back_url); + }, 1000) + + } else { + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(() => { + getApp().re_to(err_url); + }, 1000) + } + + } else { + if (item.pay_status == 1) { + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(() => { + getApp().re_to(back_url); + }, 1000) + + } else { + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(() => { + getApp().re_to(err_url); + }, 1000) + } + } + + + } + }) + }); + } + + } + + getApp().check_can_share(); if (app.globalData.userInfo) { if (!this.data.isLogin) { @@ -688,6 +770,8 @@ Page({ } if (flag) { + + th.data.payed=1; t_pay.set_pay_url("/api/weshop/order/pay/createRechargeOrder"); t_pay.pay({ parentSn: order_sn, diff --git a/packageA/pages/myGift/myGift.js b/packageA/pages/myGift/myGift.js index 26eb1cc..9ccc3f3 100644 --- a/packageA/pages/myGift/myGift.js +++ b/packageA/pages/myGift/myGift.js @@ -4,6 +4,7 @@ let self = null; var os = app.globalData.setting; var t_pay = require("../../../utils/pay2.js"); var util = require('../../../utils/util.js'); +var ut=util; Page({ @@ -53,6 +54,9 @@ Page({ */ onLoad: function (options) { + //定义第一次进入 + this.data.fir_in=1; + self = this; if(options.index){ this.setData({currentIndex:1}); //查看我的礼包 @@ -92,9 +96,47 @@ Page({ */ onShow: function () { - util.fy_back('',0) this.data.is_summit_ing=0; - t_pay.set_fir(); + + + var th=this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //富友插件支付 + util.fy_back('',0) + t_pay.set_fir(); + + //-- 通联的第三方支付的返回优化 -- + util.is_pay_ok(th.data.ok_order_sn,"none","none",function (){ + if(!th.data.ok_order_sn) return false; + + var b_url="/api/weshop/libao/libaoFormvip/page"; + var rq_data={ + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + number: th.data.ok_order_sn + }; + + getApp().request.promiseGet(b_url, + {data:rq_data}).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.fbillstate==1){ + //支付支付,返回首页 + util.m_toast('支付成功'); + }else{ + //支付支付,返回首页 + util.m_toast('支付失败'); + } + } + }) + }); + + } + + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { @@ -306,7 +348,7 @@ Page({ },function (e){ th.data.is_summit_ing=0; getApp().my_warnning(e, 0, th); - }) + },th) // var url = "/api/weshop/libao/libaoFormvip/libaoOrder"; // getApp().request.post(url, // { diff --git a/packageA/pages/myGiftDetails/myGiftDetails.js b/packageA/pages/myGiftDetails/myGiftDetails.js index c0f50fd..47e27a2 100644 --- a/packageA/pages/myGiftDetails/myGiftDetails.js +++ b/packageA/pages/myGiftDetails/myGiftDetails.js @@ -24,8 +24,10 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + //定义第一次进入 + this.data.fir_in=1; - self = this; + self = this; // 如果从商品详情页点击促销栏里的礼包跳转过来的话,不显示底部按钮 // showBtn 控制按钮是否显示 @@ -68,9 +70,58 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - this.data.is_summit_ing=0; - ut.fy_back('',0) - t_pay.set_fir(); + + this.data.is_summit_ing=0; + var th=this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + ut.fy_back('',0) + t_pay.set_fir(); + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"/packageA/pages/libao_payment/payment?type=2","none",function (){ + console.log('is_pay_ok'); + console.log(th.data.ok_order_sn); + if(!th.data.ok_order_sn) return false; + + var b_url="/api/weshop/libao/libaoFormvip/page"; + var rq_data={ + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + number: th.data.ok_order_sn + }; + + getApp().request.promiseGet(b_url, + {data:rq_data}).then(res=>{ + + console.log('is_pay_ok2'); + console.log('1111111'); + + if(ut.ajax_ok(res)){ + + var item=res.data.data.pageData[0]; + if(item.fbillstate==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().goto("/packageA/pages/libao_payment/payment?type=2"); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().goto("/pages/index/index/index"); + },1000) + } + } + }) + }); + + } + getApp().check_can_share(); if(app.globalData.userInfo) { if(!this.data.isLogin) { @@ -248,7 +299,7 @@ Page({ },function (msg){ th.data.is_summit_ing=0; getApp().my_warnning(msg, 0, th); - }) + },th) // var url = "/api/weshop/libao/libaoFormvip/libaoOrder"; // getApp().request.post(url, diff --git a/packageA/pages/serviceCard_pd/cart/cart.js b/packageA/pages/serviceCard_pd/cart/cart.js index 754c836..7911842 100644 --- a/packageA/pages/serviceCard_pd/cart/cart.js +++ b/packageA/pages/serviceCard_pd/cart/cart.js @@ -1,5 +1,5 @@ var t = getApp(), app = t, a = t.request, e = require("../../../../utils/common.js"), - s = require("../../../../utils/util.js"), o = require("../../../../utils/md5.js"), to = getApp(); + s = require("../../../../utils/util.js"),ut=s, o = require("../../../../utils/md5.js"), to = getApp(); var oo = t.globalData.setting, os = oo; var regeneratorRuntime = require('../../../../utils/runtime.js'); var util_pay = require("../../../../utils/pay.js"); @@ -71,7 +71,8 @@ Page({ }, onLoad: function (t) { console.log("onLoad_pt_cart"); - + //定义第一次进入 + this.data.fir_in=1; var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); var appD = getApp().get_b_now(); @@ -245,12 +246,45 @@ Page({ //----------子页返回父页触发---------- onShow: function () { - s.fy_back('',0); + var th = this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + s.fy_back('',0); + t_pay.set_fir(); + util_pay.set_fir(); + + var back_url="/packageA/pages/serviceCard_pd/team_success/team_success?ordersn=" + th.data.order_sn; + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.order_id,back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){ + if(!th.data.order_id) return false; + getApp().request.promiseGet("/api/weshop/rechargeServicelist/page",{ + data: { store_id: os.stoid, order_id: th.data.order_id} + }).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pt_status==1 || item.pt_status==2){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to(back_url); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().re_to("/pages/user/order_list/order_list?index=2&tabindex=1"); + },1000) + } + } + }) + }); + } - t_pay.set_fir(); - util_pay.set_fir(); - var th = this; if (th.data.isclose == 0) { wx.navigateTo({ url: "/pages/index/index/index" @@ -438,12 +472,7 @@ Page({ //-- 支付失败,要返回 -- setTimeout(function () { - var cps = getCurrentPages(); - if (cps.length > 1) { - wx.navigateBack({ delta: 1 }) - } else { - getApp().goto("/pages/index/index/index"); - } + getApp().re_to("/pages/user/order_list/order_list?index=2&tabindex=1"); }, 1000) }) diff --git a/packageA/pages/serviceCard_pd/cart_wk/cart_wk.js b/packageA/pages/serviceCard_pd/cart_wk/cart_wk.js index 4abcb1c..b6ac5bf 100644 --- a/packageA/pages/serviceCard_pd/cart_wk/cart_wk.js +++ b/packageA/pages/serviceCard_pd/cart_wk/cart_wk.js @@ -59,6 +59,8 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + //定义第一次进入 + this.data.fir_in=1; //清空is_pick_up getApp().request.put("/api/weshop/useraddress/updatePickUp", { @@ -94,11 +96,50 @@ Page({ */ onShow: function () { - ut.fy_back('',0); this.data.paying=0; - util_pay.set_fir(); - getApp().check_can_share(); + var th = this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + ut.fy_back('',0); + util_pay.set_fir(); + + + var back_url="/pages/payment/pay_success/pay_success?order_id=" + th.data.order.order_id + "&type=1&card=1"; + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.wk_pyed,back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){ + if(!th.data.wk_pyed) return false; + + getApp().request.promiseGet("/api/weshop/rechargeServicelist/page",{ + data: { store_id: os.stoid, order_id: th.data.order.order_id} + }).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pt_status==4 || item.pt_status==5){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to(back_url); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().re_to("/pages/user/order_list/order_list?index=2&tabindex=1"); + },1000) + } + } + }) + }); + + } + + + + getApp().check_can_share(); if (th.data.isclose == 0) { wx.navigateTo({ url: "/pages/index/index/index" @@ -606,6 +647,7 @@ Page({ return false; } + th.data.wk_pyed=1; util_pay.pay_data(t,function (){ var allmoney = th.data.allpice; th.jumpPaymentPage(th.data.order.order_id, allmoney); diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js index 5ddf31a..f90b71c 100644 --- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js +++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js @@ -128,6 +128,9 @@ Page({ }, onLoad: function (t) { + //定义第一次进入 + this.data.fir_in=1; + // console.log('收到的传参', t); wx.setNavigationBarTitle({ title: '填写订单', @@ -654,11 +657,48 @@ Page({ //----------子页返回父页触发---------- onShow: function () { - var fy=ut.fy_back('/pages/user/order_list/order_list',1); - if(fy) return false; - var th = this; - util_pay.set_fir(); + + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + var fy=ut.fy_back('/pages/user/order_list/order_list',1); + if(fy) return false; + util_pay.set_fir(); + + var back="/packageC/pages/luckyGo/luckyGo_details/luckyGo_details?type=1&ordersn=" + this.data.ok_order_sn + + "&group_id=" + th.data.param.group_id + "&goods_id=" + th.data.param.goods_id + + "&goods_name=" + th.data.bn_goods.goods_name; + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,back,'/pages/user/order_list/order_list',function (){ + if(!th.data.ok_order_sn) return false; + getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pay_status==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to(back); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().re_to("/pages/user/order_list/order_list"); + },1000) + } + } + }) + }); + + } + + if (th.data.isclose == 0) { wx.navigateTo({ @@ -1477,6 +1517,8 @@ Page({ // order_sn: data.data, // type:1, // }, 1); + + th.data.ok_order_sn=data.data; util_pay.pay(data.data, function () { setTimeout(function () { // wx.reLaunch({ diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index cde6347..0af57e2 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -147,6 +147,9 @@ Page({ }, onLoad: function (t) { + //定义第一次进入 + this.data.fir_in=1; + if (t.order_id) this.data.order_id = t.order_id; if (t.order_sn) this.data.order_sn = t.order_sn; @@ -190,17 +193,65 @@ Page({ is_no_by: {}, is_by: {} }) + this.data.fir_in=0; }, //----------子页返回父页触发---------- onShow: function () { + this.data.paying=0; - var fy= ut.fy_back("/pages/user/order_list/order_list",1); - if(fy) return false; + console.log('onshow-2222'); - util_pay.set_fir(); var th = this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + + console.log('onshow-3333'); + //-- 富友支付的 -- + var fy= ut.fy_back("/pages/user/order_list/order_list",1); + if(fy) return false; + util_pay.set_fir(); + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"back","back",function (){ + + console.log('onshow-444'); + console.log(th.data.ok_order_sn); + + if(!th.data.ok_order_sn) return false; + getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ + if(ut.ajax_ok(res)){ + + console.log('onshow-444'); + console.log(res); + + var item=res.data.data.pageData[0]; + if(item.pay_status==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + wx.navigateBack(); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + wx.navigateBack(); + },1000) + } + } + }) + }); + + } + + + th.setData({ show_submit: 0 }); //让提交先掩藏 th.data.g_cart_q_time = null; if (th.data.isclose == 0) { @@ -2519,6 +2570,9 @@ Page({ return false; } + //-- 订单OK -- + th.data.ok_order_sn=th.data.order.order_sn; + util_pay.pay_data(t,function (){ //---用余额支付--- getApp().my_warnning("支付成功", 1, th); @@ -2981,6 +3035,8 @@ Page({ type: 1 //正常单 }, 1);--*/ + + th.data.ok_order_sn=this.data.order.order_sn; util_pay.pay(this.data.order.order_sn, function () { wx.showToast({ title: '支付成功' }) wx.navigateBack(); diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js index 6ce154a..6249f72 100644 --- a/packageC/pages/presell/cart/cart2.js +++ b/packageC/pages/presell/cart/cart2.js @@ -157,6 +157,10 @@ Page({ }) }, onLoad: function (t) { + + //定义第一次进入 + this.data.fir_in=1; + wx.setNavigationBarTitle({ title: "填写订单", }) var th = this; @@ -191,19 +195,51 @@ Page({ //----------子页返回父页触发---------- onShow: function () { var th = this; - var fy= ut.fy_back('',0,function (){ - var cps = getCurrentPages(); - if (cps.length > 1) { - wx.navigateBack({ delta: 1 }) - } else { - getApp().goto("/pages/index/index/index"); - } + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //富友支付插件 + var fy= ut.fy_back('',0,function (){ + var cps = getCurrentPages(); + if (cps.length > 1) { + wx.navigateBack({ delta: 1 }) + } else { + getApp().goto("/pages/index/index/index"); + } - }) - if(fy) return false; + }) + if(fy) return false; + util_pay.set_fir(); + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn, + "/pages/user/order_list/order_list",function (){ + if(!th.data.ok_order_sn) return false; + getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pay_status==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().goto("/pages/index/index/index"); + },1000) + } + } + }) + }); + } - util_pay.set_fir(); th.data.g_cart_q_time = null; if (th.data.isclose == 0) { wx.navigateTo({ @@ -1667,6 +1703,8 @@ Page({ //void e.jumpToCart4({ // order_sn: data.data, //}, 1); + th.data.ok_order_sn=data.data; + util_pay.pay(data.data, function () { //app.my_warnning("支付成功",1,th); //setTimeout(function () { diff --git a/packageC/pages/presell/cart/cart2_pre.js b/packageC/pages/presell/cart/cart2_pre.js index 170b9fa..677bcab 100644 --- a/packageC/pages/presell/cart/cart2_pre.js +++ b/packageC/pages/presell/cart/cart2_pre.js @@ -78,6 +78,9 @@ Page({ }) }, onLoad: function (t) { + //定义第一次进入 + this.data.fir_in=1; + wx.setNavigationBarTitle({ title: "填写订单", }); @@ -280,9 +283,42 @@ Page({ var fy=ut.fy_back("/pages/user/order_list/order_list",1); if(fy) return false; - util_pay.set_fir(); var th = this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + + //-- 支付完成后的跳转的时间 -- + var ok_url = "/packageC/pages/presell/cart/cart?order_sn=" +this.data.ok_order_sn; + var err_url="/pages/user/order_list/order_list"; + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,ok_url,err_url,function (){ + if(!th.data.ok_order_sn) return false; + getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pay_time){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to(ok_url); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().re_to(err_url); + },1000) + } + } + }) + }); + } + if (th.data.isclose == 0) { wx.navigateTo({ url: "/pages/index/index/index" @@ -918,6 +954,8 @@ Page({ //要进行判断,如果是用微信支付,就要跳转到支付界面 if (order_amount && parseFloat(order_amount) > 0) { th.setData({ isclose: 0 }); + + th.data.ok_order_sn=data.data; util_pay.pay(data.data, function () { var url = "/packageC/pages/presell/cart/cart?order_sn=" + data.data; setTimeout(function () { diff --git a/packageD/pages/user/deposit/prepaid/msg/msg.js b/packageD/pages/user/deposit/prepaid/msg/msg.js index 99706f5..96a717e 100644 --- a/packageD/pages/user/deposit/prepaid/msg/msg.js +++ b/packageD/pages/user/deposit/prepaid/msg/msg.js @@ -68,10 +68,7 @@ Page({ }) }, homepage:function(){ - - wx.navigateTo({ - url: "../../../../index/index/index", - }) + getApp().goto('/pages/index/index/index'); }, /** diff --git a/packageD/pages/user/deposit/prepaid/prepaid.js b/packageD/pages/user/deposit/prepaid/prepaid.js index c5c1215..4aaf90e 100644 --- a/packageD/pages/user/deposit/prepaid/prepaid.js +++ b/packageD/pages/user/deposit/prepaid/prepaid.js @@ -15,6 +15,10 @@ Page({ perpaid: [], //数据, paying:0 }, + onLoad:function (){ + //定义第一次进入 + this.data.fir_in=1; + }, /* 生命周期函数--监听页面初次渲染完成*/ onReady: function() { var th=this; @@ -96,19 +100,49 @@ Page({ */ onShow: function () { + var th=this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //-- 富友插件 -- + ut.fy_back('',0) + t_pay.set_fir(); + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"/packageD/pages/user/deposit/prepaid/msg/msg","none",function (){ + if(!th.data.ok_order_sn) return false; + var ck_url="/api/weshop/recharge/get/"+os.stoid+"/"+th.data.ok_order_sn; + getApp().request.promiseGet(ck_url,{}).then(res=>{ + if(res.data.code==0 && res.data.data){ + var item=res.data.data; + if(item.pay_status==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to("/packageD/pages/user/deposit/prepaid/msg/msg"); + },1000) + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + + } + } + }) + }); + } wx.setNavigationBarTitle({ title: "流动资金转预存", }) this.data.paying=0; - ut.fy_back('',0) - t_pay.set_fir(); - if(getApp().globalData.user_id && !this.data.is_get){ - this.yuck(); - } + + if(getApp().globalData.user_id && !this.data.is_get){ + this.yuck(); + } }, //确定充值 @@ -170,6 +204,8 @@ Page({ var parentSn = msg.order_sn; var store_id = os.stoid; t_pay.set_pay_url("/api/weshop/order/pay/createRechargeOrder"); + + e.data.ok_order_sn=parentSn; t_pay.pay({ parentSn: parentSn, store_id: store_id diff --git a/packageD/pages/user/integral/integral.js b/packageD/pages/user/integral/integral.js index 048e1a3..5525f1b 100644 --- a/packageD/pages/user/integral/integral.js +++ b/packageD/pages/user/integral/integral.js @@ -208,6 +208,9 @@ Page({ */ onLoad: function (options) { + //定义第一次进入 + this.data.fir_in=1; + var th=this; getApp().request.get("/api/wx/weappSendlist/page", { data: { @@ -258,6 +261,8 @@ Page({ var store_id = os.stoid; t_pay.set_pay_url("/api/weshop/order/pay/createRechargeOrder"); + + th.data.ok_order_sn=parentSn; t_pay.pay({ parentSn: parentSn, store_id: store_id @@ -290,10 +295,8 @@ Page({ // }) }) }) - - - - }, + + }, //------支付成功页面-------- jumpPaymentPage: function () { console.log("支付成功页面2333"); @@ -331,9 +334,44 @@ Page({ */ onShow: function () { - ut.fy_back('',0); + + var th=this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //-- 富友的插件 -- + ut.fy_back('',0); + t_pay.set_fir(); + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"/packageD/pages/user/integral/msg/msg",'none',function (){ + + console.log('show--11') + console.log(th.data.ok_order_sn); + + if(!th.data.ok_order_sn) return false; + var ck_url="/api/weshop/recharge/get/"+os.stoid+"/"+th.data.ok_order_sn; + getApp().request.promiseGet(ck_url,{}).then(res=>{ + if(res.data.code==0 && res.data.data){ + var item=res.data.data; + if(item.pay_status==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to("/packageD/pages/user/integral/msg/msg"); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + } + } + }) + }); + } + this.data.paying=0; - t_pay.set_fir(); getApp().check_can_share(); //--先判断会员状态-- var user_info = getApp().globalData.userInfo; diff --git a/packageD/pages/user/integral/msg/msg.js b/packageD/pages/user/integral/msg/msg.js index 9482b8e..10fb86f 100644 --- a/packageD/pages/user/integral/msg/msg.js +++ b/packageD/pages/user/integral/msg/msg.js @@ -68,7 +68,6 @@ Page({ }) }, homepage:function(){ - getApp().goto('/pages/index/index/index'); }, diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index 5607945..394ba31 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -196,6 +196,8 @@ Page({ onLoad: function (t) { + this.data.fir_in=1; + wx.setNavigationBarTitle({ title: "填写订单", }) var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); @@ -271,15 +273,47 @@ Page({ //----------子页返回父页触发---------- onShow: function () { - //富友支付取消支付强行回去 - var fy=ut.fy_back("/pages/user/order_list/order_list",1); - if(fy) return false; - - util_pay.set_fir(); var th = this; - th.data.g_cart_q_time = null; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //富友支付取消支付强行回去 + var fy=ut.fy_back("/pages/user/order_list/order_list",1); + if(fy) return false; + util_pay.set_fir(); + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn, + "/pages/user/order_list/order_list",function (){ + //支付信息会先记录着 + if(!th.data.ok_order_sn) return false; + getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pay_status==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn); + },1000) + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().goto("/pages/index/index/index"); + },1000) + } + } + }) + }); + } + + + th.data.g_cart_q_time = null; if (th.data.isclose == 0) { wx.navigateTo({ url: "/pages/index/index/index" @@ -5183,8 +5217,7 @@ Page({ // order_sn: data.data, //}, 1); - - + th.data.ok_order_sn=data.data; util_pay.pay(data.data, async function () { //app.my_warnning("支付成功",1,th); //setTimeout(function () { @@ -5210,17 +5243,10 @@ Page({ }, function () { - // return false; //支付失败 setTimeout(function () { - var cps = getCurrentPages(); - if (cps.length > 1) { - wx.navigateBack({ delta: 1 }) - } else { - getApp().goto("/pages/index/index/index"); - } - + getApp().re_to("/pages/user/order_list/order_list"); }, 1000) }, oo.stoid); diff --git a/packageE/pages/cart/cart2_inte/cart2_inte.js b/packageE/pages/cart/cart2_inte/cart2_inte.js index fb09df7..39296e5 100644 --- a/packageE/pages/cart/cart2_inte/cart2_inte.js +++ b/packageE/pages/cart/cart2_inte/cart2_inte.js @@ -110,6 +110,8 @@ Page({ }) }, onLoad: function (t) { + + this.data.fir_in=1; wx.setNavigationBarTitle({ title: "填写订单", }) var th = this; th.data.param = t; @@ -204,20 +206,52 @@ Page({ //----------子页返回父页触发---------- onShow: function () { - var fy=ut.fy_back('',1,function (){ - var cps = getCurrentPages(); - if (cps.length > 1) { - wx.navigateBack({ delta: 1 }) - } else { - getApp().goto("/pages/index/index/index"); - } - }); - if(fy) return false; + var th = this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //-- 富有的支付插件 -- + var fy=ut.fy_back('',1,function (){ + var cps = getCurrentPages(); + if (cps.length > 1) { + wx.navigateBack({ delta: 1 }) + } else { + getApp().goto("/pages/index/index/index"); + } + }); + if(fy) return false; + util_pay.set_fir(); + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn, + "/pages/user/order_list/order_list",function (){ + if(!th.data.ok_order_sn) return false; + getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pay_status==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().goto("/pages/index/index/index"); + },1000) + } + } + }) + }); + } - util_pay.set_fir(); - var th = this; th.data.g_cart_q_time = null; if (th.data.isclose == 0) { @@ -1330,6 +1364,8 @@ Page({ //void e.jumpToCart4({ // order_sn: data.data, //}, 1); + + th.data.ok_order_sn=data.data; util_pay.pay(data.data, function () { //app.my_warnning("支付成功",1,th); //setTimeout(function () { @@ -1341,7 +1377,7 @@ Page({ }, function () { //支付失败 setTimeout(function () { - wx.navigateBack({ delta: 1 }) + getApp().re_to("/pages/user/order_list/order_list"); }, 1000) }, oo.stoid); diff --git a/pages/cart/cart2_pt/cart2_pt.js b/packageE/pages/cart/cart2_pt/cart2_pt.js index 5c093b8..94d3cc8 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/packageE/pages/cart/cart2_pt/cart2_pt.js @@ -1,8 +1,8 @@ -var t = getApp(), app = t, a = t.request, e = require("../../../utils/common.js"), - s = require("../../../utils/util.js"), ut = s, o = require("../../../utils/md5.js"), to = getApp(); +var t = getApp(), app = t, a = t.request, e = require("../../../../utils/common.js"), + s = require("../../../../utils/util.js"), ut = s, o = require("../../../../utils/md5.js"), to = getApp(); var oo = t.globalData.setting, os = oo; -var regeneratorRuntime = require('../../../utils/runtime.js'); -var util_pay = require("../../../utils/pay.js"); +var regeneratorRuntime = require('../../../../utils/runtime.js'); +var util_pay = require("../../../../utils/pay.js"); Page({ @@ -101,7 +101,7 @@ Page({ }) }, onLoad: function (t) { - console.log("onLoad_pt_cart"); + this.data.fir_in=1; var th = this; getApp().getConfig2(function (e) { th.setData({ @@ -575,12 +575,45 @@ Page({ //----------子页返回父页触发---------- onShow: function () { - var fy=ut.fy_back("/pages/user/order_list/order_list",1); - if(fy) return false; + var th = this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //-- 富有的支付 -- + var fy=ut.fy_back("/pages/user/order_list/order_list",1); + if(fy) return false; + util_pay.set_fir(); + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"/pages/team/team_success/team_success?ordersn=" + th.data.ok_order_sn, + "/pages/user/order_list/order_list",function (){ + if(!th.data.ok_order_sn) return false; + getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + //拼团成功的判断 + if(item.pt_status==1 || item.pt_status==2){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to("/pages/team/team_success/team_success?ordersn=" + th.data.ok_order_sn); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().goto("/pages/index/index/index"); + },1000) + } + } + }) + }); + + } - util_pay.set_fir(); - var th = this; if (th.data.isclose == 0) { wx.navigateTo({ url: "/pages/index/index/index" @@ -1339,6 +1372,7 @@ Page({ // order_sn: data.data, // type:1, // }, 1); + th.data.ok_order_sn=data.data; util_pay.pay(data.data, function () { setTimeout(function () { wx.reLaunch({ diff --git a/pages/cart/cart2_pt/cart2_pt.json b/packageE/pages/cart/cart2_pt/cart2_pt.json index 0cfb931..0cfb931 100644 --- a/pages/cart/cart2_pt/cart2_pt.json +++ b/packageE/pages/cart/cart2_pt/cart2_pt.json diff --git a/pages/cart/cart2_pt/cart2_pt.wxml b/packageE/pages/cart/cart2_pt/cart2_pt.wxml index b464fc2..35d9a8e 100644 --- a/pages/cart/cart2_pt/cart2_pt.wxml +++ b/packageE/pages/cart/cart2_pt/cart2_pt.wxml @@ -1,4 +1,4 @@ - +
diff --git a/pages/cart/cart2_pt/cart2_pt.wxss b/packageE/pages/cart/cart2_pt/cart2_pt.wxss index 24414fd..24414fd 100644 --- a/pages/cart/cart2_pt/cart2_pt.wxss +++ b/packageE/pages/cart/cart2_pt/cart2_pt.wxss diff --git a/packageE/pages/user/cardinfo/cardinfo.js b/packageE/pages/user/cardinfo/cardinfo.js index 416b6eb..46534e3 100644 --- a/packageE/pages/user/cardinfo/cardinfo.js +++ b/packageE/pages/user/cardinfo/cardinfo.js @@ -50,6 +50,9 @@ Page({ */ onLoad: function (options) { + //定义第一次进入 + this.data.fir_in=1; + //--先判断会员状态-- var user_info = getApp().globalData.userInfo; if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { @@ -683,8 +686,50 @@ Page({ */ onShow: function () { this.data.paying=0; - ut.fy_back('',0); - t_pay.set_fir(); + var th=this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //-- 富友支付插件的优化 -- + ut.fy_back('',0); + t_pay.set_fir(); + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"func",'none',function (){ + + console.log('1111'); + console.log(th.data.ok_order_sn); + + if(!th.data.ok_order_sn) return false; + + var ck_url="/api/weshop/recharge/get/"+os.stoid+"/"+th.data.ok_order_sn; + getApp().request.promiseGet(ck_url,{}).then(res=>{ + if(res.data.code==0 && res.data.data){ + + var item=res.data.data; + + console.log('222'); + console.log(item); + + if(item.pay_status==1){ + //支付支付,返回首页 + th.success(); //支付成功提示 + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + } + } + }) + }, + //支付成功后的提示 + function (){ + //-- 2就不提示俩遍 -- + th.success(2); //支付成功提示 + }); + } + + //同步初始化 this.init(); @@ -748,10 +793,7 @@ Page({ //-----立即续费的功能------ xufei:async function(){ - - - - var th = this,is_card = 0,end_time=0; + var th = this,is_card = 0,end_time=0; await getApp().request.promiseGet("/store/storemoduleendtime/page?store_id="+os.stoid+"&type=3", {1:1}).then(res => { if (ut.ajax_ok(res)) { @@ -789,7 +831,6 @@ Page({ if(this.data.paying) return false; this.data.paying=1; - var item = th.data.user_card; var req = {}; req.cardId = item.CardId; @@ -801,7 +842,7 @@ Page({ t_pay.pay(req, th.success, function (e) { th.data.paying=0; getApp().my_warnning("支付失败", 0, th); - }); + },th); }, @@ -810,7 +851,7 @@ Page({ this.data.paying=0; if(ind==1){ getApp().my_warnning("升级成功",0,this); - }else{ + }else if(ind!=2){ getApp().my_warnning("支付成功",0,this); } this.init(); @@ -872,7 +913,7 @@ Page({ t_pay.pay(req, th.success, function () { th.data.paying=0; getApp().my_warnning("支付失败", 0, th); - }); + },th); }, //显示弹出框 show_change:function () { this.setData({is_show_change_pop:1}); }, diff --git a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js index cee8739..519ee16 100644 --- a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js +++ b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js @@ -1,4 +1,5 @@ var i = require("../../../../../utils/util.js"); +var ut=i; var com = require("../public/buy_com.js"); var e = getApp(), a = e.globalData.setting, @@ -74,6 +75,9 @@ Page({ onLoad: function (options) { var th=this; + //定义第一次进入 + this.data.fir_in=1; + this.setData({ params: options, now:Date.parse(new Date()) / 1000, @@ -143,10 +147,9 @@ Page({ onShow: function () { var th=this; this.setData({submit:0}) - - com.set_py_fir(); + getApp().check_can_share(); - var th=this; + //--先判断会员状态-- getApp().is_Single_page(this, function () { var user_info = getApp().globalData.userInfo; @@ -164,23 +167,71 @@ Page({ }) this.init(); - setTimeout(()=> { - i.fy_back('', 0, function () { + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //富友支付插件 + com.set_py_fir(); + + setTimeout(() => { + i.fy_back('', 0, function () { - console.log(getApp().globalData.py_month_bg, '111111'); - console.log(th.data.back_ord, '22222'); + console.log(getApp().globalData.py_month_bg, '111111'); + console.log(th.data.back_ord, '22222'); - if (getApp().globalData.py_month_bg && th.data.back_ord) { - getApp().globalData.fuyou_clear = 1; - var b_ord = th.data.back_ord; - com.reduce(b_ord, os.stoid); - //要进行清空粗粒 - getApp().globalData.py_month_bg = 0; - th.data.back_ord = null; + if (getApp().globalData.py_month_bg && th.data.back_ord) { + getApp().globalData.fuyou_clear = 1; + var b_ord = th.data.back_ord; + com.reduce(b_ord, os.stoid); + //要进行清空粗粒 + getApp().globalData.py_month_bg = 0; + th.data.back_ord = null; + } + }) + + + if(th.data.back_ord){ + var money = th.data.payMoney; + var bk_url = "/packageE/pages/user/monthgiftbag/payment/payment?money=" + money + "&order_sn=" + th.data.back_ord; + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.back_ord,bk_url, "none", function () { + if (!th.data.back_ord) return false; + //订单查询的接口 + getApp().request.promiseGet("/api/weshop/marketing/marketingMonthgiftbagRecord/page", + { + data: { + store_id: os.stoid, + order_sn: th.data.back_ord, + user_id: getApp().globalData.user_id + } + }).then(res => { + if (ut.ajax_ok(res)) { + + var item = res.data.data.pageData[0]; + if (item.pay_state == 1) { + //支付支付,返回首页 + ut.m_toast('支付成功'); + th.data.back_ord=null; + setTimeout(()=>{ + getApp().goto(bk_url); + },1500) + + } else { + //支付支付,返回首页 + ut.m_toast('支付失败'); + } + } + }) + }, null, null, 1); + + th.data.back_ord=null; } - }) - },1000) + + + }, 1000) + } }, //获取搜索门店输入的值 input_store: function(e) { diff --git a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js index aabc5dd..d847d98 100644 --- a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js +++ b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js @@ -83,6 +83,8 @@ Page({ sec_i:-1,//选中分类门店 下标 }, onLoad: function (options) { + //定义第一次进入 + this.data.fir_in=1; var th = this; console.log('分享参数---'); @@ -412,7 +414,10 @@ Page({ onShow: function () { var th=this; this.setData({submit:0}) - com.set_py_fir(); + + //res = res.data.data.result; + //if (!res) return false; + getApp().check_can_share(this); getApp().is_Single_page(this, function () { //--先判断会员状态-- @@ -429,25 +434,70 @@ Page({ } }) - setTimeout(()=>{ - ut.fy_back('',0,function (){ - if(getApp().globalData.py_month_bg && th.data.back_ord){ - getApp().globalData.fuyou_clear=1; - var b_ord=th.data.back_ord; - com.reduce(b_ord,os.stoid); - //要进行清空粗粒 - getApp().globalData.py_month_bg=0; - th.data.back_ord=null; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else { + com.set_py_fir(); + + setTimeout(() => { + ut.fy_back('', 0, function () { + if (getApp().globalData.py_month_bg && th.data.back_ord) { + getApp().globalData.fuyou_clear = 1; + var b_ord = th.data.back_ord; + com.reduce(b_ord, os.stoid); + //要进行清空粗粒 + getApp().globalData.py_month_bg = 0; + th.data.back_ord = null; + + } + }) + + + if(th.data.back_ord){ + + var money=th.data.payMoney; + var bk_url = "/packageE/pages/user/monthgiftbag/payment/payment?money=" + money + "&order_sn=" + th.data.back_ord; + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.back_ord,bk_url,"none",function (){ + if(!th.data.back_ord) return false; + getApp().request.promiseGet("/api/weshop/marketing/marketingMonthgiftbagRecord/page", + {data:{store_id:os.stoid,order_sn:th.data.back_ord,user_id:getApp().globalData.user_id}}).then(res=>{ + + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pay_state==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + th.data.back_ord=null; + setTimeout(()=>{ + getApp().goto(bk_url); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().goto("/pages/index/index/index"); + },1000) + } + } + }) + },null,null,1); + + th.data.back_ord=null; } - }) - },1000) + + + }, 1000) + } }, GetBuyPrice: function (e) { var that = this.data; var th = this; - let scene =this.data.scene; + let scene=this.data.scene; if (scene==1154) { wx.navigateTo({ url: '/packageE/pages/togoin/togoin', diff --git a/pages/cart/cart_wk/cart_wk.js b/pages/cart/cart_wk/cart_wk.js index 12d0f9f..a8ed543 100644 --- a/pages/cart/cart_wk/cart_wk.js +++ b/pages/cart/cart_wk/cart_wk.js @@ -60,6 +60,9 @@ Page({ */ onLoad: function (options) { + //定义第一次进入 + this.data.fir_in=1; + //清空is_pick_up getApp().request.put("/api/weshop/useraddress/updatePickUp", { data: { user_id: getApp().globalData.user_id, is_pickup: 0 }, @@ -94,11 +97,47 @@ Page({ */ onShow: function () { - ut.fy_back('',0); - this.data.paying=0; - util_pay.set_fir(); - getApp().check_can_share(); var th = this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //-- 富友插件的优化 -- + ut.fy_back('',0); + this.data.paying=0; + util_pay.set_fir(); + + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"/pages/payment/pay_success/pay_success?type=1&order_sn=" + this.data.ok_order_sn,'back',function (){ + if(!th.data.ok_order_sn) return false; + getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ + + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + //已经支付尾款,或者所有的会员都已经支付尾款 + if(item.pt_status==4 || item.pt_status==5){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().re_to("/pages/payment/pay_success/pay_success?type=1&order_sn=" + th.data.ok_order_sn); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + getApp().goto("/pages/index/index/index"); + },1000) + } + } + }) + }); + + } + + getApp().check_can_share(); + if (th.data.isclose == 0) { wx.navigateTo({ url: "/pages/index/index/index" @@ -652,6 +691,8 @@ Page({ return false; } + //-- 把订单号记录起来 -- + th.data.ok_order_sn=th.data.order.order_sn; util_pay.pay_data(t,function (){ var allmoney = th.data.allpice; th.jumpPaymentPage(th.data.order.order_sn, allmoney); diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index 4e65afb..a6105eb 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -1,4 +1,5 @@ var i = require("../../../utils/util.js"); +var ut=i; var com = require("../public/buy_com.js"); var e = getApp(), a = e.globalData.setting, @@ -74,6 +75,9 @@ Page({ onLoad: function (options) { var th=this; + //定义第一次进入 + this.data.fir_in=1; + this.setData({ params: options, now:Date.parse(new Date()) / 1000, @@ -143,10 +147,58 @@ Page({ onShow: function () { this.setData({submit:0}) - i.fy_back('',0); - com.set_py_fir(); - getApp().check_can_share(); var th=this; + + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //富友支付插件 + i.fy_back('',0); + com.set_py_fir(); + + + if(th.data.ok_order_sn){ + //-- 通联的第三方支付的返回优化 -- + var money=th.data.payMoney; + var back_url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + th.data.ok_order_sn; + + ut.is_pay_ok(th.data.ok_order_sn,back_url,'none',function (){ + if(!th.data.ok_order_sn) return false; + getApp().request.promiseGet("/api/weshop/marketing/my/giftbag/detail/get", + {data:{storeId:os.stoid,orderSn:th.data.ok_order_sn,userId:getApp().globalData.user_id}}).then(res=>{ + + th.data.ok_order_sn=null; + + if(res.data.code==0 && res.data.data){ + var item=res.data.data; + if(item.payState==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().goto(back_url); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + } + } + }) + },null,null,1); + + th.data.ok_order_sn=null; + } + + + + + } + + + + getApp().check_can_share(); + //--先判断会员状态-- getApp().is_Single_page(this, function () { var user_info = getApp().globalData.userInfo; diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 8e94a5d..f86d8ed 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -82,6 +82,9 @@ Page({ }, onLoad: function (options) { + //定义第一次进入 + this.data.fir_in=1; + var th = this; this.setData({ @@ -170,8 +173,48 @@ Page({ onShow: function () { this.setData({submit:0}) - ut.fy_back('',0); - com.set_py_fir(); + + var th=this; + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //富友支付插件的判断 + ut.fy_back('',0); + com.set_py_fir(); + + if(th.data.ok_order_sn){ + //-- 通联的第三方支付的返回优化 -- + var money=th.data.payMoney; + var back_url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + th.data.ok_order_sn; + ut.is_pay_ok(th.data.ok_order_sn,back_url,'none',function (){ + if(!th.data.ok_order_sn) return false; + getApp().request.promiseGet("/api/weshop/marketing/my/giftbag/detail/get", + {data:{storeId:os.stoid,orderSn:th.data.ok_order_sn,userId:getApp().globalData.user_id}}).then(res=>{ + + th.data.ok_order_sn=null; + if(res.data.code==0 && res.data.data){ + var item=res.data.data; + if(item.payState==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + getApp().goto(back_url); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + } + } + }) + },null,null,1); + th.data.ok_order_sn=null; + } + + } + + getApp().check_can_share(this); getApp().is_Single_page(this, function () { //--先判断会员状态-- diff --git a/pages/giftpack/public/buy_com.js b/pages/giftpack/public/buy_com.js index 4c127b5..112d068 100644 --- a/pages/giftpack/public/buy_com.js +++ b/pages/giftpack/public/buy_com.js @@ -251,9 +251,6 @@ module.exports = { function (res) { if (res.data.code == 0 && res.data.data) { - - - switch(that.data.buyType){ case 1://立即兑换 var order_sn = res.data.data; @@ -266,6 +263,7 @@ module.exports = { case 2://立即购买 var order_sn = res.data.data.orderSn; + that.data.ok_order_sn=order_sn; var money=that.data.payMoney; var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 009512f..0ca5cc1 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -911,7 +911,7 @@ Page({ //-- 要清空,因为有回退。优惠促的数组,购买数量要清理成1 -- this.data.cx_prom_group=[]; - this.data.goodsInputNum=1; + this.setData({goodsInputNum:1}); var goods_list = null, th = this, @@ -3986,6 +3986,7 @@ Page({ em.data.data = {}; em.data.data.total = new_list.length; em.data.data.pageData = new_list; + em.his_cate_num=e.his_cate_num; //--如果找到默认门店,同时也应该判断配送方式对不对-- @@ -5307,7 +5308,7 @@ Page({ buyNow_pt: function (e) { s.set_b_now(e); wx.navigateTo({ - url: "/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + e.goods_id, + url: "/packageE/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + e.goods_id, }); }, diff --git a/pages/index/index/index.json b/pages/index/index/index.json index 5cc0ca5..4269168 100644 --- a/pages/index/index/index.json +++ b/pages/index/index/index.json @@ -9,6 +9,7 @@ "searchbox":"/components/diy_searchbox/diy_searchbox", "shopname": "/components/diy_shopname/diy_shopname", "pingd_buy": "/components/diy_pingd_buy/diy_pingd_buy", + "div_public": "/components/diy_public/diy_public", "title": "/components/diy_title/diy_title", "notice": "/components/diy_notice/diy_notice", "voice": "/components/diy_voice/diy_voice", diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index 0766a90..5c9ab1d 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -480,6 +480,9 @@ + + + diff --git a/pages/team/team_show/team_show.js b/pages/team/team_show/team_show.js index 2e3fcb4..ea894dd 100644 --- a/pages/team/team_show/team_show.js +++ b/pages/team/team_show/team_show.js @@ -850,7 +850,7 @@ Page({ s.set_b_now(newd); wx.navigateTo({ - url: "/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + th.data.goods.goods_id, + url: "/packageE/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + th.data.goods.goods_id, }); }); }, diff --git a/pages/template/index.json b/pages/template/index.json index dca47df..42bc7a2 100644 --- a/pages/template/index.json +++ b/pages/template/index.json @@ -11,6 +11,7 @@ "searchbox":"/components/diy_searchbox/diy_searchbox", "shopname": "/components/diy_shopname/diy_shopname", "pingd_buy": "/components/diy_pingd_buy/diy_pingd_buy", + "diy_public": "/components/diy_public/diy_public", "title": "/components/diy_title/diy_title", "notice": "/components/diy_notice/diy_notice", "voice": "/components/diy_voice/diy_voice", diff --git a/pages/template/index.wxml b/pages/template/index.wxml index 7ca759f..5ac9144 100644 --- a/pages/template/index.wxml +++ b/pages/template/index.wxml @@ -37,6 +37,9 @@ + + + diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js index 3c8276e..b47b72d 100644 --- a/pages/user/order_detail/order_detail.js +++ b/pages/user/order_detail/order_detail.js @@ -16,6 +16,9 @@ Page({ }, onLoad: function(e) { + //定义第一次进入 + this.data.fir_in=1; + var th=this; var r = void 0 !== e.isGoup && e.isGoup; @@ -64,9 +67,44 @@ Page({ }), this.requestOrderDetail(e.order_id), wx.removeStorageSync("order:order_detail:update"); }, onShow: function() { - ut.fy_back('',0) + + var th=this; this.setData({paying:0}); - py.set_fir(); + + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //富友支付 + ut.fy_back('',0) + py.set_fir(); + + //通联第三方 + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"back","none",function (){ + getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:os.stoid,order_sn:th.data.ok_order_sn}}).then(res=>{ + if(ut.ajax_ok(res)){ + var item=res.data.data.pageData[0]; + if(item.pay_status==1){ + //支付支付,返回首页 + ut.m_toast('支付成功'); + setTimeout(()=>{ + wx.navigateBack(); + },1000) + + }else{ + //支付支付,返回首页 + ut.m_toast('支付失败'); + setTimeout(()=>{ + wx.navigateBack(); + },1000) + } + } + }) + }); + } + wx.getStorageSync("order:order_detail:update") && (wx.removeStorageSync("order:order_detail:update"), this.requestOrderDetail(this.data.order.order_id)); }, @@ -544,7 +582,6 @@ Page({ }) if (presellList) { - if (good.goods_num > presellList.presell_sumqty - presellList.buy_goodnum) { var content = good.goods_name + '购买数量超出商品库存,请取消订单'; th.toast(content); @@ -1132,6 +1169,7 @@ Page({ } + th.data.ok_order_sn=this.data.order.order_sn; py.pay(this.data.order.order_sn, function() { th.setData({paying:0}); wx.showToast({title: '支付成功'}) diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index d544170..8a68f5e 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -244,182 +244,191 @@ Page({ th.setData({ is_get: 1 }); var data = e.data.orderList; - data.forEach(async function (item, ind) { - var tt = null; - await getApp().request.promiseGet('/api/weshop/ordergoods/list', { - data: { order_id: item.order_id, store_id: os.stoid, pageSize: 600 }, - }).then(res => { - tt = res; - }) - var glist = tt.data.data.pageData; - for (var i in glist) { - if (glist[i].is_gift) { - data[ind].is_prom = 1; - } - } - data[ind]['ord_url'] = '/pages/user/order_detail/order_detail'; - //-- 如果是优惠活动 -- - if (glist[0].prom_type == 8) { - await getApp().request.promiseGet('/api/weshop/order/orderPresell/get/' + os.stoid + '/' + item.order_id, { + //-- 如果有值的时候 -- + if(data && data.length){ + data.forEach(async function (item, ind) { + var tt = null; + await getApp().request.promiseGet('/api/weshop/ordergoods/list', { + data: { order_id: item.order_id, store_id: os.stoid, pageSize: 600 }, }).then(res => { - if (res.data.code == 0) { - data[ind]['presell'] = res.data.data; - data[ind]['ord_url'] = '/packageC/pages/presell/cart/cart'; - } + tt = res; }) - } - // 如果是幸运购活动 - if (glist[0].prom_type == 9) { - await getApp().request.promiseGet('/api/weshop/prom/luckyOrder/list', { - data: { - store_id: os.stoid, - user_id: oo.user_id, - order_id: item.order_id, + var glist = tt.data.data.pageData; + for (var i in glist) { + if (glist[i].is_gift) { + data[ind].is_prom = 1; } - }).then(res => { - if (res.data.code == 0) { - // console.log('luckyGo+++++++++>>>', res.data.data); - // data[ind]['team_status'] = res.data.data[0]['team_status']; - if (res.data.data[0] && res.data.data[0]['team_status']) { - data[ind]['team_status'] = res.data.data[0]['team_status']; - } else { - data[ind]['team_status'] = 0; - }; + } - // data[ind]['ord_url']='/packageC/pages/presell/cart/cart'; + data[ind]['ord_url'] = '/pages/user/order_detail/order_detail'; + //-- 如果是优惠活动 -- + if (glist[0].prom_type == 8) { + await getApp().request.promiseGet('/api/weshop/order/orderPresell/get/' + os.stoid + '/' + item.order_id, { + }).then(res => { + if (res.data.code == 0) { + data[ind]['presell'] = res.data.data; + data[ind]['ord_url'] = '/packageC/pages/presell/cart/cart'; + } + }) + } + // 如果是幸运购活动 + if (glist[0].prom_type == 9) { + await getApp().request.promiseGet('/api/weshop/prom/luckyOrder/list', { + data: { + store_id: os.stoid, + user_id: oo.user_id, + order_id: item.order_id, + } + }).then(res => { + if (res.data.code == 0) { + // console.log('luckyGo+++++++++>>>', res.data.data); + // data[ind]['team_status'] = res.data.data[0]['team_status']; + if (res.data.data[0] && res.data.data[0]['team_status']) { + data[ind]['team_status'] = res.data.data[0]['team_status']; + } else { + data[ind]['team_status'] = 0; + }; + + // data[ind]['ord_url']='/packageC/pages/presell/cart/cart'; + } + }) + } + //------------对比一下有没有退款记录------------ + await getApp().request.promiseGet("/api/weshop/order/returngoods/page", { + data: { + order_id: item.order_id, store_id: os.stoid, + user_id: oo.user_id, pageSize: 20 } - }) - } - //------------对比一下有没有退款记录------------ - await getApp().request.promiseGet("/api/weshop/order/returngoods/page", { - data: { - order_id: item.order_id, store_id: os.stoid, - user_id: oo.user_id, pageSize: 20 - } - }).then(rs => { - var ttd = rs; - //--看一下订单的总数量-- - var gtype_num = tt.data.data.total; - if (ttd.data.data.pageData == undefined) return false; - var goodslist = tt.data.data.pageData; - - //----没有相关的退款记录---- - if (ttd.data.data.total == 0) { - data[ind]['is_all_return'] = 0; - goodslist.forEach(function (ee, ii) { - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1 && gtype_num > 1) { - item.goodslist = goodslist; - if (th.check_for_return_btn(item)) { - goodslist[ii]['return_btn'] = 1; + }).then(rs => { + var ttd = rs; + //--看一下订单的总数量-- + var gtype_num = tt.data.data.total; + if (ttd.data.data.pageData == undefined) return false; + var goodslist = tt.data.data.pageData; + + //----没有相关的退款记录---- + if (ttd.data.data.total == 0) { + data[ind]['is_all_return'] = 0; + goodslist.forEach(function (ee, ii) { + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1 && gtype_num > 1) { + item.goodslist = goodslist; + if (th.check_for_return_btn(item)) { + goodslist[ii]['return_btn'] = 1; + } } - } - }); - } else { - //--------整单退-------- - if (ttd.data.data.pageData[0]['goods_id_list'] != null - && ttd.data.data.pageData[0]['goods_id_list'] != '') { - var eea = ttd.data.data.pageData[0]; - //1.退款正在进行中, - //2.退款被拒绝就要显示可以退款 - //3.退款已经完成 - data[ind]['is_all_return'] = 1; - data[ind]['is_all_return_status'] = ttd.data.data.pageData[0].status; - - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { - switch (eea.status) { - case 0: - case 1: - data[ind]['return_btn'] = 2; - break; - case 2: - data[ind]['return_btn'] = 4; - break; - case 3: - data[ind]['return_btn'] = 3; - break; - default: - data[ind]['return_btn'] = 0; - } - } + }); } else { - //1.退款正在进行中, - //2.退款被拒绝就要显示可以退款 - //3.退款已经完成 - data[ind]['is_all_return'] = 0; - var rt_ok_num = 0; - //if(data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { - goodslist.forEach(function (eeb, iii) { - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) - goodslist[iii]['return_btn'] = 1; //申请退款 - ttd.data.data.pageData.forEach(function (eea, ii) { - var st = eea.status; - if (eea.goods_id == eeb.goods_id) { - switch (eea.status) { - case 0: - case 1://退款处理中 - data[ind]['has_rt'] = 1; //有部分退 - goodslist[iii]['return_btn'] = 2; - break; - case 2://退款完成 - data[ind]['has_rt'] = 1; //有部分退 - goodslist[iii]['return_btn'] = 4; - rt_ok_num++; - break; - case 3://已拒绝,重新退款 - goodslist[iii]['return_btn'] = 3; - break; - default: - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) - goodslist[iii]['return_btn'] = 1; //申请退款 - } - return; + //--------整单退-------- + if (ttd.data.data.pageData[0]['goods_id_list'] != null + && ttd.data.data.pageData[0]['goods_id_list'] != '') { + var eea = ttd.data.data.pageData[0]; + //1.退款正在进行中, + //2.退款被拒绝就要显示可以退款 + //3.退款已经完成 + data[ind]['is_all_return'] = 1; + data[ind]['is_all_return_status'] = ttd.data.data.pageData[0].status; + + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { + switch (eea.status) { + case 0: + case 1: + data[ind]['return_btn'] = 2; + break; + case 2: + data[ind]['return_btn'] = 4; + break; + case 3: + data[ind]['return_btn'] = 3; + break; + default: + data[ind]['return_btn'] = 0; } + } + } else { + //1.退款正在进行中, + //2.退款被拒绝就要显示可以退款 + //3.退款已经完成 + data[ind]['is_all_return'] = 0; + var rt_ok_num = 0; + //if(data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { + goodslist.forEach(function (eeb, iii) { + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) + goodslist[iii]['return_btn'] = 1; //申请退款 + ttd.data.data.pageData.forEach(function (eea, ii) { + var st = eea.status; + if (eea.goods_id == eeb.goods_id) { + switch (eea.status) { + case 0: + case 1://退款处理中 + data[ind]['has_rt'] = 1; //有部分退 + goodslist[iii]['return_btn'] = 2; + break; + case 2://退款完成 + data[ind]['has_rt'] = 1; //有部分退 + goodslist[iii]['return_btn'] = 4; + rt_ok_num++; + break; + case 3://已拒绝,重新退款 + goodslist[iii]['return_btn'] = 3; + break; + default: + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) + goodslist[iii]['return_btn'] = 1; //申请退款 + } + return; + } + }); }); - }); - //} + //} + } } - } - //--如果是全部退款,也就可以删除-- - if (rt_ok_num == goodslist.length) { - data[ind]['is_all_return_status'] = 2; - } + //--如果是全部退款,也就可以删除-- + if (rt_ok_num == goodslist.length) { + data[ind]['is_all_return_status'] = 2; + } - data[ind]['order_goods'] = goodslist; - var g_num = 0; - goodslist.forEach(function (ee, ii) { - if (ee.return_btn != 4) - g_num += ee.goods_num; - }); - data[ind]['g_num'] = g_num; - }) + data[ind]['order_goods'] = goodslist; + var g_num = 0; + goodslist.forEach(function (ee, ii) { + if (ee.return_btn != 4) + g_num += ee.goods_num; + }); + data[ind]['g_num'] = g_num; + }) - data[ind].use_commission = 0; - //-- 如果有数据的话 -- - await getApp().request.promiseGet("/api/weshop/orderMore/get/" + os.stoid + "/" + item.order_sn, { + data[ind].use_commission = 0; + //-- 如果有数据的话 -- + await getApp().request.promiseGet("/api/weshop/orderMore/get/" + os.stoid + "/" + item.order_sn, { + + }).then(res => { + if (res.data.code == 0 && res.data.data) { + data[ind].use_commission = res.data.data.use_commission; + data[ind].pre_cut = res.data.data.pre_cut; //是否使用预存,如果是使用预存不能单品退,只能整单退 + data[ind].pre_json = res.data.data.pre_json; //是否使用预存,如果是使用预存不能单品退,只能整单退 + } + }) - }).then(res => { - if (res.data.code == 0 && res.data.data) { - data[ind].use_commission = res.data.data.use_commission; - data[ind].pre_cut = res.data.data.pre_cut; //是否使用预存,如果是使用预存不能单品退,只能整单退 - data[ind].pre_json = res.data.data.pre_json; //是否使用预存,如果是使用预存不能单品退,只能整单退 - } - }) + th.setData({ orderList: data, }); - th.setData({ orderList: data, }); + wx.hideLoading(); + }); + e.data.currentPage++, wx.stopPullDownRefresh(); + } + else { + //直接关闭加载中的动画 wx.hideLoading(); + } + - }); - e.data.currentPage++, - wx.stopPullDownRefresh(); }, null, { store_id: os.stoid, user_id: oo.user_id }); }, diff --git a/pages/user/plus/plus.js b/pages/user/plus/plus.js index 5d38a14..976697a 100644 --- a/pages/user/plus/plus.js +++ b/pages/user/plus/plus.js @@ -56,8 +56,11 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - var that = this, - th = that; + + //定义第一次进入 + this.data.fir_in=1; + + var that = this,th = that; var store_id = getApp().globalData.setting.stoid; //获取用户设备信息,屏幕宽度 wx.getSystemInfo({ @@ -130,17 +133,58 @@ Page({ onShow: function () { var user_info = getApp().globalData.userInfo; if (!user_info) return false; - ut.fy_back('',0); + + var th = this,that = th; + + //判断是不是第一次进入 + if(this.data.fir_in){ + this.data.fir_in=0; + }else{ + //富友插件支付 + ut.fy_back('',0); + t_pay.set_fir(); + //-- 通联的第三方支付的返回优化 -- + ut.is_pay_ok(th.data.ok_order_sn,"func","func",function (){ + + if(!th.data.ok_order_sn) return false; + var ck_url="/api/weshop/recharge/get/"+os.stoid+"/"+th.data.ok_order_sn; + getApp().request.promiseGet(ck_url,{}).then(res=>{ + + if(res.data.code==0 && res.data.data){ + var item=res.data.data; + if(item.pay_status==1){ + //支付支付,返回首页 + th.success() + + }else{ + //支付支付,返回首页 + getApp().my_warnning('支付失败', 0, th); + th.setData({ + is_select:0, + focus:true, + }) + } + } + }) + }, //成功的回调 + function (){ + th.success(); + },//失败的回调 + function (){ + th.setData({ + is_select:0, + focus:true, + }) + + }); + } this.setData({ is_select:0, focus:true, }) - t_pay.set_fir(); - var th = this, - that = th, - app_d = getApp().globalData; + var app_d = getApp().globalData; var store_id = os.stoid; var fir_leader = this.data.fir_leader; @@ -196,9 +240,9 @@ Page({ var userInfo = e.data.data; if (userInfo['card_field'] && !getApp().globalData.is_card_back) { var u_url = "/packageE/pages/user/cardinfo/cardinfo"; - wx.reLaunch({ - url: u_url - }) + // wx.reLaunch({ + // url: u_url + // }) } }, }); @@ -476,7 +520,7 @@ Page({ is_select:0, focus:true, }) - }); + },th); } }, //返回会员页面 @@ -506,13 +550,12 @@ Page({ t_pay.set_pay_url('/api/weshop/plus/create/plus/order'); t_pay.pay(req, th.success, function (msg) { if(!msg) msg="支付失败"; - getApp().my_warnning(msg, 0, th); th.setData({ is_select:0, focus:true, }) - }); + },th); } } else { getApp().my_warnning(res.data.msg, 0, th); diff --git a/utils/pay.js b/utils/pay.js index 85934a7..05e7fb2 100644 --- a/utils/pay.js +++ b/utils/pay.js @@ -49,6 +49,9 @@ module.exports = { wx.hideLoading(); if(t.data.code==0){ + + var is_pos_pay=t.data.data.is_pos_pay; + //-- 富有的插件支付 -- if(t.data.data.is_fuioupay){ const plugin = requirePlugin('fuiou-pay') getApp().globalData.no_clear=1; @@ -84,12 +87,26 @@ module.exports = { },1000) }) + } + //-- 通联的支付插件 -- + else if(is_pos_pay){ + + var p_data=t.data.data; + delete p_data.is_pos_pay; //清理掉,不然签名不通过 + wx.openEmbeddedMiniProgram({ + appId: 'wxef277996acc166c3', + extraData: p_data, + fail(){ + //-- 取消不支付 -- + i.wx_paying=0; + "function" == typeof a && a(); + } + }) + }else{ i.weixinPay(t.data.data, e, a); } - - }else{ i.wx_paying=0; getApp().confirmBox(t.data.msg); @@ -125,6 +142,7 @@ module.exports = { fail('支付参数错误'); return false; } + //富友插件的优化 if(ob.is_fuioupay){ const plugin = requirePlugin('fuiou-pay') @@ -150,7 +168,24 @@ module.exports = { fail(msg) }) - }else { + } + //-- 通联的支付插件 -- + else if(ob.is_pos_pay){ + + var p_data=t.data.data; + delete p_data.is_pos_pay; //清理掉,不然签名不通过 + wx.openEmbeddedMiniProgram({ + appId: 'wxef277996acc166c3', + extraData: p_data, + fail(){ + //-- 取消不支付 -- + i.wx_paying=0; + "function" == typeof a && a(); + } + }) + + } + else { this.weixinPay(ob, succ, fail); } }, diff --git a/utils/pay2.js b/utils/pay2.js index 632ea14..8382532 100644 --- a/utils/pay2.js +++ b/utils/pay2.js @@ -10,7 +10,8 @@ module.exports = { this.wx_paying=0; }, //-- createRechargeOrder create/plus/order -- - pay: function(dd, succ,fail) { + // get_order是通联专用,获取订单号 + pay: function(dd, succ,fail,th) { if(this.wx_paying) return false; this.wx_paying=1; wx.showLoading(); @@ -24,6 +25,7 @@ module.exports = { "function" == typeof succ && succ(1); }else{ + var is_pos_pay=t.data.data.is_pos_pay; if(t.data.data.is_fuioupay){ const plugin = requirePlugin('fuiou-pay') getApp().globalData.no_clear=1; @@ -51,6 +53,32 @@ module.exports = { fail(msg) i.wx_paying=0; }) + } + //-- 通联的支付插件 -- + else if(is_pos_pay){ + var p_data=t.data.data; + delete p_data.is_pos_pay; //清理掉,不然签名不通过 + + if(th){ + + var ordno=p_data.reqsn; + if(ordno.indexOf('_')){ + var str_arr=ordno.split('_'); + ordno=str_arr[0]; + } + th.data.ok_order_sn=ordno; + } + + wx.openEmbeddedMiniProgram({ + appId: 'wxef277996acc166c3', + extraData: p_data, + fail(){ + + //-- 取消不支付 -- + i.wx_paying=0; + "function" == typeof fail && fail('取消支付'); + } + }) }else { i.weixinPay(t.data.data, succ, fail); } @@ -75,9 +103,11 @@ module.exports = { }, //-- 这里是专享礼包的调用 -- - pay_data:function (t,succ,fail){ + pay_data:function (t,succ,fail,get_order){ var th=this; var ob=t.data.data.result; + this.wx_paying=1; + if(!ob){ this.set_fir(); fail('支付参数错误'); @@ -113,7 +143,28 @@ module.exports = { fail(msg) }) - }else { + } + + //-- 通联的支付插件 -- + else if(ob.is_pos_pay){ + var p_data=ob; + delete p_data.is_pos_pay; //清理掉,不然签名不通过 + if(get_order){ + get_order(p_data.reqsn); //把单号返回 + } + + wx.openEmbeddedMiniProgram({ + appId: 'wxef277996acc166c3', + extraData: p_data, + fail(){ + //-- 取消不支付 -- + th.wx_paying=0; + "function" == typeof a && a(); + } + }) + } + + else { this.weixinPay(ob, succ, fail); } }, diff --git a/utils/util.js b/utils/util.js index d024b94..1a9bd6f 100644 --- a/utils/util.js +++ b/utils/util.js @@ -799,7 +799,7 @@ module.exports = { return false }, - //优惠促销的数据的格式话 + //-- 优惠促销的数据的格式话 -- format_yh_act(fir_act){ var more_arr = []; if(fir_act){ @@ -874,6 +874,109 @@ module.exports = { } return more_arr }, + + //-- 长的提示框 -- + m_toast(txt){ + wx.showToast({ + title: txt, + icon: 'none', + duration: 2500 + }) + }, + //-- 支付的结果判断是不是完成了,通联支付pos收银的返回 -- + /** + * @param ok_order_sn 判断是不是有支付过 + * @param back_url 如果是地址,就跳转,如果是back,就返回。如果是func,就是要回调 + * @param err_url 如果是地址,就跳转,如果是back,就返回。如果是func,就是要回调,如果是none,就没有反应,提示而已 + * @param func 因为是物理键的返回,所以要调用结果,查询结果 + * @param success //成功的回调函数, 当back_url是func + * @param fail //失败的回调函数, 当err_url是func + * @param is_navigateTo //跳转的页面是不是要is_re_to + */ + is_pay_ok(ok_order_sn,back_url,err_url,func,success,fail,is_navigateTo){ + + if(!ok_order_sn) { + return false; + } + if(!err_url){ + err_url="/pages/index/index/index"; + } + //-- getEnterOptionsSync的信息会一直存在,很恶心 -- + let options = wx.getEnterOptionsSync(); + + console.log("is_pay_ok"); + console.log(options); + + if (options.scene == '1038' && options.referrerInfo.appId=='wxef277996acc166c3') { + let extraData = options.referrerInfo.extraData; + if (!extraData) { + if(func) func(); + } else { + // "支付成功"; + if (extraData.code == 'success') { + this.m_toast("支付成功") + //支付失败 + setTimeout(function () { + if(back_url=='back') { + wx.navigateBack(); + } + else if(back_url=='func'){ + success(); + } + else if(back_url!='none'){ + + if(is_navigateTo){ + getApp().goto(back_url) //跳到tabbar页 + }else{ + wx.redirectTo({ url: back_url}); + } + + + } + },2000) + } + // "支付已取消"; + else if (extraData.code == 'cancel') { + this.m_toast("取消支付") + + console.log('err_url-11'); + console.log(err_url); + + //支付失败 + setTimeout(function () { + if(err_url=='back'){ + wx.navigateBack(); + } + else if(err_url=='func'){ + fail(); + } + else if(err_url!='none'){ + if(is_navigateTo){ + getApp.goto({ url: err_url, }) //跳到tabbar页 + }else { + wx.redirectTo({ url: err_url}); + } + } + + },2000) + } + // "支付失败:" + extraData.errmsg; + else { + this.m_toast("支付失败:" + extraData.errmsg) + //支付失败 + setTimeout(function () { + if(err_url=='back'){ + wx.navigateBack(); + }else{ + getApp().goto(err_url); + } + },2000) + } + + } + + } + }, unserialize: unserialize, _throttle:_throttle,