Commit 044a39c302e91f836deeecfc618d4fd0956757e2

Authored by season
2 parents 00672529 ee0c91ec

Merge branch 'qa' of http://git.vipzhuang.cn/wxd/MShopWeApp

Showing 59 changed files with 1800 additions and 775 deletions
... ... @@ -2,8 +2,8 @@ var t = require("setting.js"), o = require("./utils/auth.js"), a = require("./ut
2 2 var os = t;
3 3 var regeneratorRuntime = require('./utils/runtime.js');
4 4 var api = require("./api/api.js");
5   -
6 5 var wxlog = require("./utils/wxlog.js");
  6 +var md5 = require("./utils/md5.min.js");
7 7  
8 8  
9 9 //公共方法和变量
... ... @@ -99,6 +99,9 @@ App({
99 99 //检查更新
100 100 this.checkUpdateVersion();
101 101  
  102 + wx.removeStorageSync('ukey');
  103 + wx.removeStorageSync('api_token');
  104 +
102 105 var t = this.globalData.setting;
103 106 //console.log(t)
104 107 t.resourceUrl = t.url + "/template/mobile/rainbow";
... ... @@ -149,7 +152,7 @@ App({
149 152 // })
150 153 // }
151 154 // if(app.globalData.user_id){ //-- 启用默认的user_id --
152   -
  155 + //
153 156 // app.promiseGet("/api/weshop/users/get/" + app.globalData.setting.stoid + "/" + app.globalData.user_id,{}).then(res=>{
154 157 // app.globalData.is_get_login=1;
155 158 // if(res.data.code==0){
... ... @@ -217,7 +220,6 @@ App({
217 220 }
218 221 })
219 222 //}
220   -
221 223 }
222 224  
223 225 wx.getSystemInfo({
... ... @@ -959,44 +961,91 @@ App({
959 961  
960 962 },
961 963  
962   - //---promise的使用get----
  964 +
  965 + //---promise的使用get,data里面加一个参数,不需要默认带----
963 966 promiseGet: function (url, data) {
  967 +
  968 + var th=this;
  969 +
  970 +
964 971 if (url.indexOf("http") == -1) url = this.globalData.setting.url + url;
965 972 return new Promise((resolve, reject) => {
  973 +
  974 + th.ck_api_token((api_tk)=>{
966 975 data.isShowLoading && wx.showLoading();
  976 + //增加门店id和配送方式
  977 + //is_no_def不需要默认参数
  978 +
  979 + var url1=url;
  980 + var arr_in_url=ut.getParams(url1);
  981 +
  982 + var header={ "content-type": "application/x-www-form-urlencoded" };
  983 + var now=ut.gettimestamp();
  984 +
  985 + var new_data={...arr_in_url,...data.data};
  986 + var tk=a.set_req_sign(new_data,url1,now,api_tk);
  987 + if(tk){
  988 + header.reqtime=now;
  989 + header.token=tk;
  990 + header.ukey=api_tk.userkey
  991 + }
  992 +
967 993 wx.request({
968   - url,
969   - method: 'GET',
970   - header: { "content-type": "application/x-www-form-urlencoded" },
971   - data: data.data,
972   - success(res) {
973   - data.isShowLoading && wx.hideLoading();
974   - resolve(res);
975   - },
976   - fail(err) { data.isShowLoading && wx.hideLoading(); reject(err); }
  994 + url,
  995 + method: 'GET',
  996 + header: header,
  997 + data: data.data,
  998 + success(res) {
  999 + data.isShowLoading && wx.hideLoading();
  1000 + resolve(res);
  1001 + },
  1002 + fail(err) { data.isShowLoading && wx.hideLoading(); reject(err); }
977 1003 })
978 1004 })
  1005 +
  1006 +
  1007 + })
979 1008 },
980 1009  
981 1010  
982 1011 //---promise的使用get----
983 1012 requestGet: function (url, data) {
  1013 +
  1014 + var url1=url;
  1015 + var arr_in_url=ut.getParams(url1);
984 1016 if (url.indexOf("http") == -1) url = this.globalData.setting.url + url;
  1017 +
  1018 + this.ck_api_token((api_tk)=> {
  1019 +
985 1020 data.isShowLoading && wx.showLoading();
  1021 +
  1022 + var header= {"content-type": "application/x-www-form-urlencoded"};
  1023 + var now=ut.gettimestamp();
  1024 +
  1025 + var new_data={...arr_in_url,...data.data};
  1026 + var tk=a.set_req_sign(new_data,url1,now,api_tk);
  1027 +
  1028 + if(tk){
  1029 + header.reqtime=now;
  1030 + header.token=tk;
  1031 + header.ukey=api_tk.userkey
  1032 + }
  1033 +
986 1034 wx.request({
987 1035 url,
988 1036 method: 'GET',
989   - header: { "content-type": "application/x-www-form-urlencoded" },
  1037 + header:header,
990 1038 data: data.data,
991 1039 success(res) {
992   - data.isShowLoading && wx.hideLoading();
993   - data.success(res);
  1040 + data.isShowLoading && wx.hideLoading();
  1041 + data.success(res);
994 1042 },
995 1043 fail(err) {
996   - data.isShowLoading && wx.hideLoading();
997   - if (data.fail) data.fail(err);
  1044 + data.isShowLoading && wx.hideLoading();
  1045 + if (data.fail) data.fail(err);
998 1046 }
999 1047 })
  1048 + })
1000 1049 },
1001 1050  
1002 1051  
... ... @@ -1792,8 +1841,150 @@ App({
1792 1841 if(type)
1793 1842 url += "&type=1";
1794 1843 this.goto(url);
  1844 + },
  1845 +
  1846 +
  1847 +
  1848 + //判断有没有获取到api_token
  1849 + ck_api_token(func){
  1850 + var api_token = wx.getStorageSync('api_token');
  1851 + var api_token_time = wx.getStorageSync('api_token_time');
  1852 + //token有存在本地的时候
  1853 + if(api_token){
  1854 + //判断有没有超出token的时间,超出的话就要重头拿token
  1855 + var now=ut.formar_day();
  1856 + if(now!=api_token_time){
  1857 + //调用接口获取token
  1858 + this.get_api_token(func);
  1859 + return false;
  1860 + }
  1861 + func(api_token);
  1862 + return false;
1795 1863 }
  1864 + this.get_api_token(func);
  1865 + },
  1866 +
  1867 + //获取api_token
  1868 + get_api_token(func){
  1869 +
  1870 + var api_token = wx.getStorageSync('api_token');
  1871 + var api_token_time = wx.getStorageSync('api_token_time');
  1872 + //token有存在本地的时候
  1873 + if(api_token){
  1874 + //判断有没有超出token的时间,超出的话就要重头拿token
  1875 + var now=ut.formar_day();
  1876 + if(now==api_token_time){
  1877 + if(func) func(api_token);
  1878 + return false;
  1879 + }
  1880 + }
  1881 +
  1882 + if(this.globalData.get_tking){
  1883 + setTimeout(()=>{
  1884 + this.get_api_token(func);
  1885 + },1000)
  1886 + return false;
  1887 + }
  1888 +
  1889 + this.globalData.get_tking=1;
  1890 + var th=this;
  1891 + var ukey = wx.getStorageSync('ukey');
  1892 + if(!ukey){
  1893 + var url = th.globalData.setting.url + '/api/weshop/store/geStoreKey';
  1894 + var data={
  1895 + store_id:th.globalData.setting.stoid
  1896 + }
  1897 + var token1=md5(JSON.stringify(data)).toUpperCase();
  1898 +
  1899 + console.log('tk1_fir:'+token1);
  1900 + console.log('tk1_fir1:'+'GETSTOREKEY'+token1+th.globalData.setting.environment_key);
  1901 +
  1902 + var str = md5('GETSTOREKEY'+token1+th.globalData.setting.environment_key).toUpperCase();
  1903 + data.token=str;
  1904 +
  1905 + wx.request({
  1906 + url: url,
  1907 + data: JSON.stringify(data),
  1908 + method: "POST",
  1909 + header: {
  1910 + 'content-type': 'application/json'
  1911 + },// 设置请求的 header
  1912 + success: function (res) {
  1913 + if(res.data.code==0){
  1914 + wx.setStorageSync("ukey", res.data.data.ukey);
  1915 + th.get_api_token2(func);
  1916 + }else{
  1917 + th.confirmBox(res.data.msg)
  1918 + }
  1919 + },
  1920 + fail: function (res) {
  1921 + ut.m_toast('网络繁忙,请稍后重试');
  1922 + }
  1923 + })
  1924 + return false;
  1925 + }
  1926 +
  1927 + this.get_api_token2(func);
  1928 +
  1929 + },
  1930 +
  1931 + get_api_token2(func){
  1932 + var th=this;
  1933 + var ukey = wx.getStorageSync('ukey');
  1934 + var dd_json={
  1935 + store_id:th.globalData.setting.stoid,
  1936 + ukey:ukey
  1937 + }
  1938 +
  1939 + var ty= new Date();
  1940 + var c="-";
  1941 +
  1942 + var m=ty.getMonth() + 1;
  1943 + if(m<10) m="0"+m;
  1944 + var day=ty.getDate();
  1945 + if(day<10) day="0"+day;
  1946 +
  1947 + var nday=ty.getFullYear() +c+m+c+day;
  1948 +
  1949 + //console.log('tk1_str:'+JSON.stringify(dd_json));
  1950 + var tk1=md5(JSON.stringify(dd_json)).toUpperCase();
  1951 + //console.log(tk1)
  1952 + var tk2_str='GETAPITOKEN'+tk1+nday+th.globalData.setting.environment_key;
  1953 + //console.log("tk2_str:"+tk2_str);
  1954 + var tk2=md5(tk2_str).toUpperCase();
  1955 + //console.log(tk1)
  1956 + var url = th.globalData.setting.url + '/api/weshop/store/getApiToken';
  1957 + var data1={
  1958 + 'store_id':th.globalData.setting.stoid,
  1959 + 'ukey':ukey,
  1960 + 'token':tk2
  1961 + }
  1962 + wx.request({
  1963 + url: url,
  1964 + data: JSON.stringify(data1),
  1965 + method: "POST",
  1966 + header: {
  1967 + 'content-type': 'application/json'
  1968 + },// 设置请求的 header
  1969 + success: function (res) {
  1970 + if(res.data.code==0){
  1971 + //记录当天,隔天就要重新刷新
  1972 + var now=ut.formar_day();
  1973 + var api_token =res.data.data;
  1974 + wx.setStorageSync('api_token',api_token);
  1975 + wx.setStorageSync('api_token_time',now);
  1976 + th.globalData.get_tking=0;
  1977 + if(func) func(api_token);
  1978 + }else{
  1979 + getApp().confirmBox(res.data.msg)
  1980 + }
  1981 + },
  1982 + fail: function (res) {
  1983 + ut.m_toast('网络繁忙,请稍后重试');
  1984 + }
  1985 + })
1796 1986  
  1987 + }
1797 1988  
1798 1989  
1799 1990  
... ...
components/diy_user_tools_services/diy_user_tools_services.js
... ... @@ -232,12 +232,14 @@ Component({
232 232 }
233 233 //-- 如果是有新的tool要添加进去 --
234 234 for (let ig = 0; ig <f_user_tool.length ; ig++) {
  235 +
  236 + var item=f_user_tool[ig];
235 237 let fd= list.find(function (e){
236 238 return e.id==f_user_tool[ig].id;
237 239 })
238 240 if(fd) continue;
239 241 let ob={
240   - show:true,id:fd.id,icoimg:fd.icoimg,name:item.name,new_weappurl:item.new_weappurl
  242 + show:true,id:item.id,icoimg:item.icoimg,name:item.name,new_weappurl:item.new_weappurl
241 243 }
242 244 list.push(ob);
243 245 }
... ...
components/nodata/nodata.js
... ... @@ -7,7 +7,7 @@ Component({
7 7 // 完整的定义方式
8 8 title:{
9 9 type:String,
10   - value:10
  10 + value:''
11 11 }
12 12 },
13 13 /*** 页面的初始数据***/
... ...
components/nodata/nodata.wxss
... ... @@ -13,4 +13,5 @@
13 13 padding-bottom: 40rpx;
14 14 color: #bbb;
15 15 font-size: 28rpx;
  16 + text-align: center;
16 17 }
17 18 \ No newline at end of file
... ...
packageA/pages/cart2_ser/cart2_ser.js
... ... @@ -640,142 +640,136 @@ Page({
640 640  
641 641  
642 642 pdata = item;
643   - var str = JSON.stringify(pdata);
644   - console.log("支付数据");
645   - console.log(str);
  643 + //var str = JSON.stringify(pdata);
  644 + //console.log("支付数据");
  645 + //console.log(str);
646 646 //return false;
647 647 wx.showLoading({
648 648 title: "加载中"
649 649 });
650   - wx.request({
651   - url: oo.url + '/api/weshop/recharge/saveRecharge',
652   - data: str,
653   - method: 'POST',
654   - header: {
655   - 'content-type': 'application/json'
656   - }, // 设置请求的 header
657   - success: function(res) {
658   -
659   - wx.hideLoading();
660   - if (res.statusCode == 200) {
661   - var data = res.data;
662   - if (data.code == 0) {
663   - th.data.order_id = data.data.order_id;
664   - // console.log('myyyyyyyyyyyyyyyyyy', data.data);
665   - if (th.data.is_cart) {
666   - var list = th.data.cartlist_y;
667   - for (var i = 0; i < list.length; i++) {
668   - //删除购物车
669   - a.delete("/api/weshop/cartService/del/" + oo.stoid + "/" + list[i].id, {});
670   - }
671   - }
672   - var order_amount = pdata.account;
673   - //要进行判断,如果是用微信支付,就要跳转到支付界面
674   - if (order_amount > 0) {
675   - th.setData({
676   - isclose: 0
677   - });
678 650  
679   - t_pay.set_pay_url("/api/weshop/order/pay/createRechargeOrder")
680   - t_pay.pay(
681   - {
682   - parentSn: data.data.order_sn,
683   - store_id: oo.stoid
684   - },function (){
685   - wx.showToast({
686   - title: '购买成功',
687   - icon: 'success',
688   - duration: 2000
689   - });
690   - setTimeout(function () {
691   - wx.reLaunch({
692   - url: "/packageG/pages/payment/pay_success/pay_success?card=1&order_id=" + th.data.order_id,
693   - })
694   - }, 1000)
695   -
696   - },function (e){
697   -
698   - console.log('kkkkkkk');
  651 + getApp().request.promisePost("/api/weshop/recharge/saveRecharge", {
  652 + data: pdata,
  653 + is_json:1
  654 + }).then(res => {
  655 + wx.hideLoading();
  656 + if (res.statusCode == 200) {
  657 + var data = res.data;
  658 + if (data.code == 0) {
  659 + th.data.order_id = data.data.order_id;
  660 + // console.log('myyyyyyyyyyyyyyyyyy', data.data);
  661 + if (th.data.is_cart) {
  662 + var list = th.data.cartlist_y;
  663 + for (var i = 0; i < list.length; i++) {
  664 + //删除购物车
  665 + a.delete("/api/weshop/cartService/del/" + oo.stoid + "/" + list[i].id, {});
  666 + }
  667 + }
  668 + var order_amount = pdata.account;
  669 + //要进行判断,如果是用微信支付,就要跳转到支付界面
  670 + if (order_amount > 0) {
  671 + th.setData({
  672 + isclose: 0
  673 + });
699 674  
  675 + t_pay.set_pay_url("/api/weshop/order/pay/createRechargeOrder")
  676 + t_pay.pay(
  677 + {
  678 + parentSn: data.data.order_sn,
  679 + store_id: oo.stoid
  680 + },function (){
700 681 wx.showToast({
701   - title: e,
702   - icon: 'none',
  682 + title: '购买成功',
  683 + icon: 'success',
703 684 duration: 2000
704 685 });
705   -
706 686 setTimeout(function () {
707 687 wx.reLaunch({
708   - url: "/pages/user/order_list/order_list?index=2&tabindex=1",
  688 + url: "/packageG/pages/payment/pay_success/pay_success?card=1&order_id=" + th.data.order_id,
709 689 })
710 690 }, 1000)
711 691  
712   - }
713   - )
714   -
  692 + },function (e){
715 693  
716   - // getApp().request.post("/api/weshop/order/pay/createRechargeOrder", {
717   - // data: {
718   - // parentSn: data.data.order_sn,
719   - // store_id: oo.stoid
720   - // },
721   - // success: function(su) {
722   - //
723   - // if(su.data.code==0) {
724   - //
725   - // var n = su.data.data;
726   - // // console.log('su---->', n);
727   - // let order_id = data.data.order_id;
728   - // th.weixinPay(n,
729   - // function () {
730   - // // getApp().showWarning("购买成功");
731   - // wx.showToast({
732   - // title: '购买成功',
733   - // icon: 'success',
734   - // duration: 2000
735   - // });
736   - // setTimeout(function () {
737   - // wx.reLaunch({
738   - // url: "/packageG/pages/payment/pay_success/pay_success?card=1&order_id=" + order_id,
739   - // })
740   - // }, 1000)
741   - // },
742   - // function () {
743   - // getApp().showWarning("支付失败");
744   - // setTimeout(function () {
745   - // wx.reLaunch({
746   - // url: "/pages/user/order_list/order_list?index=2&tabindex=1",
747   - // })
748   - // }, 1000)
749   - // })
750   - // }else{
751   - //
752   - // this.data.is_summit_ing = 0;
753   - //
754   - // wx.showToast({
755   - // title: su.data.msg,
756   - // icon: 'none',
757   - // duration: 2000
758   - // });
759   - // }
760   - // }
761   - // })
762   - }
763   - } else {
764   - th.data.is_summit_ing = 0; //是否提交中
765   - getApp().confirmBox(data.msg);
  694 + console.log('kkkkkkk');
  695 +
  696 + wx.showToast({
  697 + title: e,
  698 + icon: 'none',
  699 + duration: 2000
  700 + });
  701 +
  702 + setTimeout(function () {
  703 + wx.reLaunch({
  704 + url: "/pages/user/order_list/order_list?index=2&tabindex=1",
  705 + })
  706 + }, 1000)
  707 +
  708 + }
  709 + )
  710 +
  711 +
  712 + // getApp().request.post("/api/weshop/order/pay/createRechargeOrder", {
  713 + // data: {
  714 + // parentSn: data.data.order_sn,
  715 + // store_id: oo.stoid
  716 + // },
  717 + // success: function(su) {
  718 + //
  719 + // if(su.data.code==0) {
  720 + //
  721 + // var n = su.data.data;
  722 + // // console.log('su---->', n);
  723 + // let order_id = data.data.order_id;
  724 + // th.weixinPay(n,
  725 + // function () {
  726 + // // getApp().showWarning("购买成功");
  727 + // wx.showToast({
  728 + // title: '购买成功',
  729 + // icon: 'success',
  730 + // duration: 2000
  731 + // });
  732 + // setTimeout(function () {
  733 + // wx.reLaunch({
  734 + // url: "/packageG/pages/payment/pay_success/pay_success?card=1&order_id=" + order_id,
  735 + // })
  736 + // }, 1000)
  737 + // },
  738 + // function () {
  739 + // getApp().showWarning("支付失败");
  740 + // setTimeout(function () {
  741 + // wx.reLaunch({
  742 + // url: "/pages/user/order_list/order_list?index=2&tabindex=1",
  743 + // })
  744 + // }, 1000)
  745 + // })
  746 + // }else{
  747 + //
  748 + // this.data.is_summit_ing = 0;
  749 + //
  750 + // wx.showToast({
  751 + // title: su.data.msg,
  752 + // icon: 'none',
  753 + // duration: 2000
  754 + // });
  755 + // }
  756 + // }
  757 + // })
766 758 }
767 759 } else {
768 760 th.data.is_summit_ing = 0; //是否提交中
769   - console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
  761 + getApp().confirmBox(data.msg);
770 762 }
771   - },
772   - fail: function() {
773   - th.data.is_summit_ing = 0; //是否提交中
774   - wx.hideLoading();
775   - console.log("index.js wx.request CheckCallUser fail");
776   - },
777   - complete: function() {}
778   - })
  763 + } else {
  764 + th.data.is_summit_ing = 0; //是否提交中
  765 + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
  766 + }
  767 + }).catch(function(err) {
  768 + // error
  769 + th.data.is_summit_ing = 0; //是否提交中
  770 + wx.hideLoading();
  771 + console.log("index.js wx.request CheckCallUser fail");
  772 + });
779 773 },
780 774  
781 775 cart_set_err: function(e) {
... ...
packageA/pages/my_service/appment_main.js
... ... @@ -117,15 +117,11 @@ Page({
117 117 "isxz": 1
118 118  
119 119 }
120   - var data = JSON.stringify(json);
121   - wx.request({
122   - url: url,
123   - data: json,
124   - method: 'post',
125   - header: {
126   - 'content-type': 'application/json'
127   - }, // 设置请求的 header
128   - success: function(res) {
  120 + //var data = JSON.stringify(json);
  121 +
  122 + getApp().request.promisePost(url, {
  123 + data: json,is_json:1,is_normal:1
  124 + }).then(res => {
129 125 th.setData({
130 126 is_sub: 0
131 127 })
... ... @@ -177,7 +173,6 @@ Page({
177 173 getApp().my_warnning(res.data.msg, 0, th);
178 174 th.settime();
179 175 }
180   - }
181 176 })
182 177  
183 178 },
... ...
packageA/pages/my_service/beauty_deta.js
... ... @@ -170,14 +170,10 @@ Page({
170 170 };
171 171 var data = JSON.stringify(json);
172 172 var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
173   - wx.request({
174   - url: url,
175   - data: data,
176   - method: 'put',
177   - header: {
178   - 'content-type': 'application/json'
179   - }, // 设置请求的 header
180   - success: function(res) {
  173 +
  174 + getApp().request.promisePut(url, {
  175 + data: json,is_json:1,is_normal:1
  176 + }).then(res => {
181 177 if (res.data.code == 0) {
182 178 getApp().my_warnning(res.data.data, 1, th);
183 179 setTimeout(function() {
... ... @@ -189,7 +185,7 @@ Page({
189 185 } else {
190 186 getApp().my_warnning(res.data.msg, 0, th);
191 187 }
192   - }
  188 +
193 189 })
194 190 } else {
195 191 var pages = getCurrentPages(); //当前页面
... ... @@ -374,20 +370,16 @@ Page({
374 370 };
375 371 var data = JSON.stringify(json);
376 372 var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
377   - wx.request({
378   - url: url,
379   - data: data,
380   - method: 'put',
381   - header: {
382   - 'content-type': 'application/json'
383   - }, // 设置请求的 header
384   - success: function(res) {
  373 +
  374 + getApp().request.promisePut(url, {
  375 + data: json,is_json:1,is_normal:1
  376 + }).then(res => {
385 377 if (res.data.code == 0) {
386 378 getApp().my_warnning("更改成功", 0, th);
387 379 } else {
388 380 getApp().my_warnning(res.data.msg, 0, th);
389 381 }
390   - }
  382 +
391 383 })
392 384 },
393 385 //预览头像
... ...
packageA/pages/my_service/tment_details.js
... ... @@ -41,14 +41,9 @@ Page({
41 41 };
42 42 var data = JSON.stringify(json);
43 43 var url = th.data.url + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
44   - wx.request({
45   - url: url,
46   - data: data,
47   - method: 'put',
48   - header: {
49   - 'content-type': 'application/json'
50   - }, // 设置请求的 header
51   - success: function(res) {
  44 + getApp().request.promisePut(url, {
  45 + data: json,is_json:1,is_normal:1
  46 + }).then(res => {
52 47 my_confirm.open_cancel(0);
53 48 if (res.data.code == 0) {
54 49 getApp().my_warnning("取消成功", 1, th);
... ... @@ -59,7 +54,7 @@ Page({
59 54 } else {
60 55 getApp().my_warnning(res.data.msg, 0, th);
61 56 }
62   - }
  57 +
63 58 })
64 59 }
65 60 );
... ...
packageA/pages/my_service/tment_eval.js
... ... @@ -177,15 +177,12 @@ Page({
177 177 "star": stars + 1,
178 178 "storeId": a.stoid,
179 179 };
180   - var data = JSON.stringify(json); //转换成json格式
181   - wx.request({
182   - url: url,
183   - data: data,
184   - method: 'POST',
185   - header: {
186   - 'content-type': 'application/json'
187   - }, // 设置请求的 header
188   - success: function(res) {
  180 + //var data = JSON.stringify(json); //转换成json格式
  181 +
  182 +
  183 + getApp().request.promisePost(url, {
  184 + data: json,is_json:1,is_normal:1
  185 + }).then(res => {
189 186 wx.hideLoading();
190 187 if (res.data.code == 0) {
191 188 getApp().my_warnning("评价成功", 1, th);
... ... @@ -198,7 +195,7 @@ Page({
198 195 } else {
199 196 getApp().my_warnning(res.data.msg, 0, th);
200 197 }
201   - }
  198 +
202 199 })
203 200  
204 201 },
... ...
packageA/pages/my_service/tment_order_list.js
... ... @@ -154,14 +154,11 @@ Page({
154 154 };
155 155 var data = JSON.stringify(json);
156 156 var url = th.data.url + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
157   - wx.request({
158   - url: url,
159   - data: data,
160   - method: 'put',
161   - header: {
162   - 'content-type': 'application/json'
163   - }, // 设置请求的 header
164   - success: function(res) {
  157 +
  158 +
  159 + getApp().request.promisePut(url, {
  160 + data: json,is_json:1,is_normal:1
  161 + }).then(res => {
165 162 if (res.data.code == 0) {
166 163 getApp().my_warnning("取消成功", 1, th);
167 164 var id = th.data.activeCategoryId;
... ... @@ -180,7 +177,7 @@ Page({
180 177 } else {
181 178 getApp().my_warnning(res.data.msg, 0, th);
182 179 }
183   - }
  180 +
184 181 })
185 182 })
186 183  
... ...
packageA/pages/my_service2/appment_main.js
... ... @@ -137,17 +137,13 @@ Page({
137 137 req_arr.list.push(json);
138 138 }
139 139 }
140   - console.log(req_arr);
  140 + //console.log(req_arr);
141 141 //return false;
142   - var js_data = JSON.stringify(req_arr);
143   - wx.request({
144   - url: url,
145   - data: js_data,
146   - method: 'post',
147   - header: {
148   - 'content-type': 'application/json'
149   - }, // 设置请求的 header
150   - success: function(res) {
  142 + //var js_data = JSON.stringify(req_arr);
  143 +
  144 + getApp().request.promisePost(url, {
  145 + data: req_arr,is_json:1,is_normal:1
  146 + }).then(res => {
151 147 th.setData({ is_sub: 0})
152 148 wx.hideLoading();
153 149 if (res.data.code == 0) {
... ... @@ -170,7 +166,7 @@ Page({
170 166 getApp().my_warnning(res.data.msg, 0, th);
171 167 th.settime();
172 168 }
173   - }
  169 +
174 170 })
175 171 },
176 172  
... ...
packageA/pages/my_service2/beauty_deta.js
... ... @@ -170,14 +170,10 @@ Page({
170 170 };
171 171 var data = JSON.stringify(json);
172 172 var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
173   - wx.request({
174   - url: url,
175   - data: data,
176   - method: 'put',
177   - header: {
178   - 'content-type': 'application/json'
179   - }, // 设置请求的 header
180   - success: function(res) {
  173 +
  174 + getApp().request.promisePut(url, {
  175 + data: json,is_json:1,is_normal:1
  176 + }).then(res => {
181 177 if (res.data.code == 0) {
182 178 getApp().my_warnning(res.data.data, 1, th);
183 179 setTimeout(function() {
... ... @@ -189,7 +185,7 @@ Page({
189 185 } else {
190 186 getApp().my_warnning(res.data.msg, 0, th);
191 187 }
192   - }
  188 +
193 189 })
194 190 } else {
195 191 var pages = getCurrentPages(); //当前页面
... ... @@ -374,20 +370,16 @@ Page({
374 370 };
375 371 var data = JSON.stringify(json);
376 372 var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
377   - wx.request({
378   - url: url,
379   - data: data,
380   - method: 'put',
381   - header: {
382   - 'content-type': 'application/json'
383   - }, // 设置请求的 header
384   - success: function(res) {
  373 +
  374 + getApp().request.promisePut(url, {
  375 + data: json,is_json:1,is_normal:1
  376 + }).then(res => {
385 377 if (res.data.code == 0) {
386 378 getApp().my_warnning("更改成功", 0, th);
387 379 } else {
388 380 getApp().my_warnning(res.data.msg, 0, th);
389 381 }
390   - }
  382 +
391 383 })
392 384 },
393 385 //预览头像
... ...
packageA/pages/my_service2/tment_details.js
... ... @@ -41,14 +41,9 @@ Page({
41 41 };
42 42 var data = JSON.stringify(json);
43 43 var url = th.data.url + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
44   - wx.request({
45   - url: url,
46   - data: data,
47   - method: 'put',
48   - header: {
49   - 'content-type': 'application/json'
50   - }, // 设置请求的 header
51   - success: function(res) {
  44 + getApp().request.promisePut(url, {
  45 + data: json,is_json:1,is_normal:1
  46 + }).then(res => {
52 47 my_confirm.open_cancel(0);
53 48 if (res.data.code == 0) {
54 49 getApp().my_warnning("取消成功", 1, th);
... ... @@ -59,7 +54,7 @@ Page({
59 54 } else {
60 55 getApp().my_warnning(res.data.msg, 0, th);
61 56 }
62   - }
  57 +
63 58 })
64 59 }
65 60 );
... ...
packageA/pages/my_service2/tment_eval.js
... ... @@ -178,14 +178,10 @@ Page({
178 178 "storeId": a.stoid,
179 179 };
180 180 var data = JSON.stringify(json); //转换成json格式
181   - wx.request({
182   - url: url,
183   - data: data,
184   - method: 'POST',
185   - header: {
186   - 'content-type': 'application/json'
187   - }, // 设置请求的 header
188   - success: function(res) {
  181 +
  182 + getApp().request.promisePost(url, {
  183 + data: json,is_json:1,is_normal:1
  184 + }).then(res => {
189 185 wx.hideLoading();
190 186 if (res.data.code == 0) {
191 187 getApp().my_warnning("评价成功", 1, th);
... ... @@ -198,7 +194,7 @@ Page({
198 194 } else {
199 195 getApp().my_warnning(res.data.msg, 0, th);
200 196 }
201   - }
  197 +
202 198 })
203 199  
204 200 },
... ...
packageA/pages/my_service2/tment_order_list.js
... ... @@ -154,14 +154,10 @@ Page({
154 154 };
155 155 var data = JSON.stringify(json);
156 156 var url = th.data.url + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
157   - wx.request({
158   - url: url,
159   - data: data,
160   - method: 'put',
161   - header: {
162   - 'content-type': 'application/json'
163   - }, // 设置请求的 header
164   - success: function(res) {
  157 +
  158 + getApp().request.promisePut(url, {
  159 + data: json,is_json:1,is_normal:1
  160 + }).then(res => {
165 161 if (res.data.code == 0) {
166 162 getApp().my_warnning("取消成功", 1, th);
167 163 var id = th.data.activeCategoryId;
... ... @@ -180,7 +176,7 @@ Page({
180 176 } else {
181 177 getApp().my_warnning(res.data.msg, 0, th);
182 178 }
183   - }
  179 +
184 180 })
185 181 })
186 182  
... ...
packageA/pages/profile/profile.js
... ... @@ -1066,7 +1066,7 @@ Page({
1066 1066 return false;
1067 1067 }
1068 1068 else {
1069   - return ut.m_toast("授权登入失败!" + e.data.msg);
  1069 + return app.my_warnning("授权登入失败!" + e.data.msg,0,th);
1070 1070 }
1071 1071 getApp().globalData.login_back = 1;
1072 1072 wx.setStorageSync("userinfo", e.data.data);
... ...
packageA/pages/serviceCard_pd/cart/cart.js
... ... @@ -426,20 +426,17 @@ Page({
426 426 item.list.push(goods);
427 427 pdata=item;
428 428 if (pdata.length == 0) return false;
429   - var str = JSON.stringify(pdata);
430   - console.log(str,"----");
  429 + //var str = JSON.stringify(pdata);
  430 + //console.log(str,"----");
431 431  
432 432 wx.showLoading({
433 433 title: "加载中"
434 434 });
435   - wx.request({
436   - url: oo.url + '/api/weshop/recharge/saveRecharge',
437   - data: str,
438   - method: 'POST',
439   - header: {
440   - 'content-type': 'application/json'
441   - }, // 设置请求的 header
442   - success: function(res) {
  435 +
  436 + getApp().request.promisePost("/api/weshop/recharge/saveRecharge", {
  437 + data: pdata,is_json:1,is_normal:1
  438 + }).then(res => {
  439 +
443 440  
444 441 wx.hideLoading();
445 442 if (res.statusCode == 200) {
... ... @@ -492,13 +489,10 @@ Page({
492 489 th.data.is_summit_ing = 0; //是否提交中
493 490 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
494 491 }
495   - },
496   - fail: function() {
497   - th.data.is_summit_ing = 0; //是否提交中
498   - wx.hideLoading();
499   - console.log("index.js wx.request CheckCallUser fail");
500   - },
501   - complete: function() {}
  492 +
  493 + }).catch(function(err) {
  494 + th.data.is_summit_ing = 0; //是否提交中
  495 + wx.hideLoading();
502 496 })
503 497  
504 498 },
... ...
packageA/pages/serviceCard_pd/cart_wk/cart_wk.js
... ... @@ -627,16 +627,11 @@ Page({
627 627  
628 628 var arr = [];
629 629 arr.push(dd);
630   - console.log(JSON.stringify(arr));
  630 + //console.log(JSON.stringify(arr));
631 631  
632   - wx.request({
633   - url: oo.url + '/api/weshop/order/pay/payTuanWkCard',
634   - data: JSON.stringify(arr),
635   - method: 'POST',
636   - header: {
637   - 'content-type': 'application/json'
638   - },// 设置请求的 header
639   - success: function (t) {
  632 + getApp().request.promisePost("/api/weshop/order/pay/payTuanWkCard", {
  633 + data: arr,is_json:1,is_normal:1
  634 + }).then(t => {
640 635  
641 636 //---用微信支付---
642 637 if (dd.tail_pay_type == 0) {
... ... @@ -678,8 +673,12 @@ Page({
678 673 getApp().my_warnning(t.data.msg, 1, th);
679 674 }
680 675 }
681   - }
682   - });
  676 +
  677 + }).catch(function(err) {
  678 + th.data.paying=0;
  679 + wx.hideLoading();
  680 + })
  681 +
683 682 },
684 683  
685 684 //检查区域是不是包邮
... ...
packageB/pages/evaluate/evaluate.js
... ... @@ -199,6 +199,11 @@ Page({
199 199 getApp().my_warnning("给点建议呗", 0, th);
200 200 return false;
201 201 }
  202 +
  203 + if(this.data.lding) return false;
  204 + this.data.lding=1;
  205 +
  206 +
202 207 wx.showLoading({
203 208 title: '加载中',
204 209 })
... ... @@ -222,15 +227,12 @@ Page({
222 227 "star": stars + 1,
223 228 "storeId": a.stoid
224 229 };
225   - var data = JSON.stringify(json); //转换成json格式
226   - wx.request({
227   - url: url,
228   - data: data,
229   - method: 'POST',
230   - header: {
231   - 'content-type': 'application/json'
232   - }, // 设置请求的 header
233   - success: function(res) {
  230 +
  231 + //var data = JSON.stringify(json); //转换成json格式
  232 +
  233 + getApp().request.promisePost(url, {
  234 + data: json,is_json:1,is_normal:1
  235 + }).then(res => {
234 236 wx.hideLoading();
235 237 if (res.data.code == 0) {
236 238 getApp().my_warnning("评价成功", 1, th);
... ... @@ -247,9 +249,13 @@ Page({
247 249 });
248 250 }, 2000);
249 251 } else {
  252 + th.data.lding=0;
250 253 getApp().my_warnning(res.data.msg, 0, th);
251 254 }
252   - }
  255 +
  256 + }).catch(function(err) {
  257 + th.data.lding=0;
  258 + wx.hideLoading();
253 259 })
254 260 },
255 261  
... ...
packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
... ... @@ -2836,15 +2836,10 @@ Page({
2836 2836 var str = JSON.stringify(pdata);
2837 2837  
2838 2838 wx.showLoading({ title: "加载中" });
2839   - wx.request({
2840   - url: oo.url + '/api/weshop/order/createWxdOrder',
2841   - data: str,
2842   - method: 'POST',
2843   - header: {
2844   - 'content-type': 'application/json'
2845   - },// 设置请求的 header
2846   - success: function (res) {
2847 2839  
  2840 + getApp().request.promisePost("/api/weshop/order/createWxdOrder", {
  2841 + data: pdata,is_json:1,is_normal:1
  2842 + }).then(res => {
2848 2843  
2849 2844 wx.hideLoading();
2850 2845 if (res.statusCode == 200) {
... ... @@ -2951,14 +2946,11 @@ Page({
2951 2946 th.data.is_summit_ing = 0; //是否提交中
2952 2947 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
2953 2948 }
2954   - },
2955   - fail: function () {
2956   - th.data.is_summit_ing = 0;
2957   - wx.hideLoading();
2958   - console.log("index.js wx.request CheckCallUser fail");
2959   - },
2960   - complete: function () {
2961   - }
  2949 +
  2950 + }).catch(function(err) {
  2951 + th.data.is_summit_ing = 0;
  2952 + wx.hideLoading();
  2953 + console.log("index.js wx.request CheckCallUser fail");
2962 2954 })
2963 2955  
2964 2956 },
... ...
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... ... @@ -1620,21 +1620,18 @@ Page({
1620 1620 })
1621 1621 // pdata.keyid = th.data.bn_goods.keyid
1622 1622 }
1623   - var str = JSON.stringify(pdata);
1624   - console.log("支付数据");
1625   - console.log(str);
  1623 +
  1624 + //var str = JSON.stringify(pdata);
  1625 + //console.log("支付数据");
  1626 + //console.log(str);
1626 1627 //return false;
1627 1628 wx.showLoading({
1628 1629 title: "加载中"
1629 1630 });
1630   - wx.request({
1631   - url: oo.url + '/api/weshop/order/createWxdOrder',
1632   - data: str,
1633   - method: 'POST',
1634   - header: {
1635   - 'content-type': 'application/json'
1636   - }, // 设置请求的 header
1637   - success: function (res) {
  1631 +
  1632 + getApp().request.promisePost("/api/weshop/order/createWxdOrder", {
  1633 + data: pdata,is_json:1,is_normal:1
  1634 + }).then(res => {
1638 1635  
1639 1636 wx.hideLoading();
1640 1637 if (res.statusCode == 200) {
... ... @@ -1779,13 +1776,11 @@ Page({
1779 1776 th.data.is_summit_ing = 0; //是否提交中
1780 1777 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
1781 1778 }
1782   - },
1783   - fail: function () {
1784   - th.data.is_summit_ing = 0; //是否提交中
1785   - wx.hideLoading();
1786   - console.log("index.js wx.request CheckCallUser fail");
1787   - },
1788   - complete: function () { }
  1779 +
  1780 + }).catch(function(err) {
  1781 + th.data.is_summit_ing = 0; //是否提交中
  1782 + wx.hideLoading();
  1783 + console.log("index.js wx.request CheckCallUser fail");
1789 1784 })
1790 1785 },
1791 1786  
... ...
packageC/pages/payForAnother/payForAnother.js
... ... @@ -2512,15 +2512,10 @@ Page({
2512 2512 var str = JSON.stringify(pdata);
2513 2513  
2514 2514 wx.showLoading({title: "加载中"});
2515   - wx.request({
2516   - url: oo.url + '/api/weshop/order/createWxdOrder',
2517   - data: str,
2518   - method: 'POST',
2519   - header: {
2520   - 'content-type': 'application/json'
2521   - },// 设置请求的 header
2522   - success: function (res) {
2523 2515  
  2516 + getApp().request.promisePost("/api/weshop/order/createWxdOrder", {
  2517 + data: pdata,is_json:1,is_normal:1
  2518 + }).then(res => {
2524 2519  
2525 2520 wx.hideLoading();
2526 2521 if (res.statusCode == 200) {
... ... @@ -2627,16 +2622,14 @@ Page({
2627 2622 th.data.is_summit_ing = 0; //是否提交中
2628 2623 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
2629 2624 }
2630   - },
2631   - fail: function () {
2632   - th.data.is_summit_ing = 0;
2633   - wx.hideLoading();
2634   - console.log("index.js wx.request CheckCallUser fail");
2635   - },
2636   - complete: function () {
2637   - }
  2625 +
  2626 + }).catch(function(err) {
  2627 + th.data.is_summit_ing = 0;
  2628 + wx.hideLoading();
  2629 + console.log("index.js wx.request CheckCallUser fail");
2638 2630 })
2639 2631  
  2632 +
2640 2633 },
2641 2634 //---确认线下门店的数量足不足---
2642 2635 async check_store_num(goods_id, pick, goods_num, func){
... ...
packageC/pages/presell/cart/cart.js
... ... @@ -3183,14 +3183,11 @@ Page({
3183 3183 dd.scene = getApp().globalData.scene;
3184 3184  
3185 3185 console.log(JSON.stringify(dd));
3186   - wx.request({
3187   - url: wk_url,
3188   - data: JSON.stringify(dd),
3189   - method: 'POST',
3190   - header: {
3191   - 'content-type': 'application/json'
3192   - },// 设置请求的 header
3193   - success: function (t) {
  3186 +
  3187 + getApp().request.promisePost(wk_url, {
  3188 + data: dd,is_json:1,is_normal:1
  3189 + }).then(t => {
  3190 +
3194 3191 th.close_show_pay();
3195 3192  
3196 3193 //---用微信支付---
... ... @@ -3258,8 +3255,11 @@ Page({
3258 3255 }
3259 3256 th.data.paying = 0;
3260 3257 }
3261   - }
3262   - });
  3258 + }).catch(function(err) {
  3259 + th.data.paying = 0;
  3260 + wx.hideLoading();
  3261 + th.updateOrderCoupon()
  3262 + })
3263 3263 },
3264 3264  
3265 3265 //------调起支付框--------
... ...
packageC/pages/presell/cart/cart2.js
... ... @@ -1381,21 +1381,17 @@ Page({
1381 1381 item.list.push(goods);
1382 1382  
1383 1383 pdata = item;
1384   - var str = JSON.stringify(pdata);
1385   - console.log("支付数据");
1386   - console.log(str);
  1384 + //var str = JSON.stringify(pdata);
  1385 + //console.log("支付数据");
  1386 + //console.log(str);
1387 1387 //return false;
1388 1388 wx.showLoading({
1389 1389 title: "加载中"
1390 1390 });
1391   - wx.request({
1392   - url: oo.url + '/api/weshop/recharge/saveRecharge',
1393   - data: str,
1394   - method: 'POST',
1395   - header: {
1396   - 'content-type': 'application/json'
1397   - }, // 设置请求的 header
1398   - success: function (res) {
  1391 +
  1392 + getApp().request.promisePost("/api/weshop/recharge/saveRecharge", {
  1393 + data: pdata,is_json:1,is_normal:1
  1394 + }).then(res => {
1399 1395  
1400 1396 wx.hideLoading();
1401 1397 if (res.statusCode == 200) {
... ... @@ -1462,13 +1458,10 @@ Page({
1462 1458 th.data.is_summit_ing = 0; //是否提交中
1463 1459 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
1464 1460 }
1465   - },
1466   - fail: function () {
1467   - th.data.is_summit_ing = 0; //是否提交中
1468   - wx.hideLoading();
1469   - console.log("index.js wx.request CheckCallUser fail");
1470   - },
1471   - complete: function () { }
  1461 +
  1462 + }).catch(function(err) {
  1463 + th.data.is_summit_ing = 0; //是否提交中
  1464 + wx.hideLoading();
1472 1465 })
1473 1466 },
1474 1467  
... ... @@ -2030,15 +2023,9 @@ Page({
2030 2023 var str = JSON.stringify(pdata);
2031 2024  
2032 2025 wx.showLoading({ title: "加载中" });
2033   - wx.request({
2034   - url: oo.url + '/api/weshop/order/createWxdOrder',
2035   - data: str,
2036   - method: 'POST',
2037   - header: {
2038   - 'content-type': 'application/json'
2039   - },// 设置请求的 header
2040   - success: function (res) {
2041   -
  2026 + getApp().request.promisePost("/api/weshop/order/createWxdOrder", {
  2027 + data: pdata,is_json:1,is_normal:1
  2028 + }).then(res => {
2042 2029  
2043 2030 wx.hideLoading();
2044 2031 if (res.statusCode == 200) {
... ... @@ -2147,14 +2134,10 @@ Page({
2147 2134 th.data.is_summit_ing = 0; //是否提交中
2148 2135 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
2149 2136 }
2150   - },
2151   - fail: function () {
2152   - th.data.is_summit_ing = 0;
2153   - wx.hideLoading();
2154   - console.log("index.js wx.request CheckCallUser fail");
2155   - },
2156   - complete: function () {
2157   - }
  2137 +
  2138 + }).catch(function(err) {
  2139 + th.data.is_summit_ing = 0;
  2140 + wx.hideLoading();
2158 2141 })
2159 2142  
2160 2143 },
... ...
packageC/pages/presell/cart/cart2_pre.js
... ... @@ -947,21 +947,17 @@ Page({
947 947 item.list.push(goods);
948 948  
949 949 pdata = item;
950   - var str = JSON.stringify(pdata);
951   - console.log("支付数据");
952   - console.log(str);
  950 + //var str = JSON.stringify(pdata);
  951 + //console.log("支付数据");
  952 + //console.log(str);
953 953 //return false;
954 954 wx.showLoading({
955 955 title: "加载中"
956 956 });
957   - wx.request({
958   - url: os.url + '/api/weshop/recharge/saveRecharge',
959   - data: str,
960   - method: 'POST',
961   - header: {
962   - 'content-type': 'application/json'
963   - }, // 设置请求的 header
964   - success: function(res) {
  957 +
  958 + getApp().request.promisePost("/api/weshop/recharge/saveRecharge", {
  959 + data: pdata,is_json:1,is_normal:1
  960 + }).then(res => {
965 961  
966 962 wx.hideLoading();
967 963 if (res.statusCode == 200) {
... ... @@ -1023,13 +1019,10 @@ Page({
1023 1019 th.data.is_summit_ing = 0; //是否提交中
1024 1020 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
1025 1021 }
1026   - },
1027   - fail: function() {
1028   - th.data.is_summit_ing = 0; //是否提交中
1029   - wx.hideLoading();
1030   - console.log("index.js wx.request CheckCallUser fail");
1031   - },
1032   - complete: function() {}
  1022 +
  1023 + }).catch(function(err) {
  1024 + th.data.is_summit_ing = 0; //是否提交中
  1025 + wx.hideLoading();
1033 1026 })
1034 1027 },
1035 1028  
... ... @@ -1184,14 +1177,10 @@ Page({
1184 1177  
1185 1178 var str = JSON.stringify(pdata);
1186 1179 wx.showLoading({ title: "加载中" });
1187   - wx.request({
1188   - url: os.url + '/api/weshop/order/createWxdOrder',
1189   - data: str,
1190   - method: 'POST',
1191   - header: {
1192   - 'content-type': 'application/json'
1193   - },// 设置请求的 header
1194   - success: function (res) {
  1180 +
  1181 + getApp().request.promisePost("/api/weshop/order/createWxdOrder", {
  1182 + data: pdata,is_json:1,is_normal:1
  1183 + }).then(res => {
1195 1184  
1196 1185 wx.hideLoading();
1197 1186 if (res.statusCode == 200) {
... ... @@ -1267,13 +1256,9 @@ Page({
1267 1256 th.data.is_summit_ing = 0; //是否提交中
1268 1257 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
1269 1258 }
1270   - },
1271   - fail: function () {
1272   - th.data.is_summit_ing = 0; //是否提交中
1273   - wx.hideLoading();
1274   - console.log("index.js wx.request CheckCallUser fail");
1275   - },
1276   - complete: function () { }
  1259 + }).catch(function(err) {
  1260 + th.data.is_summit_ing = 0; //是否提交中
  1261 + wx.hideLoading();
1277 1262 })
1278 1263 },
1279 1264 //订阅消息提醒
... ...
packageD/components/diy_login/login.js
... ... @@ -379,7 +379,7 @@ Component({
379 379 return false;
380 380 }
381 381 else {
382   - return app.showWarning("授权登入失败!" + e.data.msg);
  382 + return app.my_warnning("授权登入失败!" + e.data.msg,0,th);
383 383 }
384 384 getApp().globalData.login_back = 1;
385 385 wx.setStorageSync("userinfo", e.data.data);
... ...
packageD/pages/AI-test-skin/analyse/analyse.js
... ... @@ -674,17 +674,44 @@ Page({
674 674 json_post: function (url, data, succ, fail, mathod) {
675 675 var Mathod = "POST";
676 676 if (mathod) Mathod = mathod;
  677 +
  678 + var url1=url;
  679 + var arr_in_url=ut.getParams(url1);
  680 +
677 681 if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
678   - var str = JSON.stringify(data);
679   - wx.request({
680   - url: url,
681   - data: str,
682   - method: Mathod,
683   - header: {
  682 +
  683 + getApp().request.ck_api_token((api_tk)=> {
  684 +
  685 + var header={
684 686 'content-type': 'application/json'
685   - },// 设置请求的 header
686   - success: function (res) { succ(res); },
687   - fail: function (res) { fail(res); }
  687 + };// 设置请求的 header
  688 +
  689 + var dd= ut.deep_cp(data);
  690 + dd={...arr_in_url,...dd};
  691 +
  692 + var now=ut.gettimestamp();
  693 + var tk=getApp().request.set_req_sign(dd,url1,now,api_tk,1);
  694 + if(tk){
  695 + header.reqtime=now;
  696 + header.token=tk;
  697 + header.ukey=api_tk.userkey
  698 + }
  699 +
  700 +
  701 + var str = JSON.stringify(data);
  702 + wx.request({
  703 + url: url,
  704 + data: str,
  705 + method: Mathod,
  706 + header:header,// 设置请求的 header
  707 + success: function (res) {
  708 + succ(res);
  709 + },
  710 + fail: function (res) {
  711 + fail(res);
  712 + }
  713 + })
688 714 })
689 715 },
  716 +
690 717 })
691 718 \ No newline at end of file
... ...
packageD/pages/AI-test-skin/index/aiskin.js
... ... @@ -198,19 +198,46 @@ Page({
198 198 json_post: function (url, data, succ, fail, mathod) {
199 199 var Mathod = "POST";
200 200 if (mathod) Mathod = mathod;
  201 +
  202 + var url1=url;
  203 + var arr_in_url=ut.getParams(url1);
  204 +
201 205 if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
202   - var str = JSON.stringify(data);
203   - wx.request({
204   - url: url,
205   - data: str,
206   - method: Mathod,
207   - header: {
  206 +
  207 + getApp().request.ck_api_token((api_tk)=> {
  208 +
  209 + var header={
208 210 'content-type': 'application/json'
209   - },// 设置请求的 header
210   - success: function (res) { succ(res); },
211   - fail: function (res) { fail(res); }
  211 + };// 设置请求的 header
  212 +
  213 + var dd= ut.deep_cp(data);
  214 + dd={...arr_in_url,...dd};
  215 +
  216 + var now=ut.gettimestamp();
  217 + var tk=getApp().request.set_req_sign(dd,url1,now,api_tk,1);
  218 + if(tk){
  219 + header.reqtime=now;
  220 + header.token=tk;
  221 + header.ukey=api_tk.userkey
  222 + }
  223 +
  224 +
  225 + var str = JSON.stringify(data);
  226 + wx.request({
  227 + url: url,
  228 + data: str,
  229 + method: Mathod,
  230 + header:header,// 设置请求的 header
  231 + success: function (res) {
  232 + succ(res);
  233 + },
  234 + fail: function (res) {
  235 + fail(res);
  236 + }
  237 + })
212 238 })
213 239 },
214 240  
215 241  
  242 +
216 243 })
217 244 \ No newline at end of file
... ...
packageD/pages/AI-test-skin/select_photo/select_photo.js
... ... @@ -264,17 +264,44 @@ Page({
264 264 json_post: function (url, data, succ, fail, mathod) {
265 265 var Mathod = "POST";
266 266 if (mathod) Mathod = mathod;
  267 +
  268 + var url1=url;
  269 + var arr_in_url=ut.getParams(url1);
  270 +
267 271 if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
268   - var str = JSON.stringify(data);
269   - wx.request({
270   - url: url,
271   - data: str,
272   - method: Mathod,
273   - header: {
  272 +
  273 + getApp().request.ck_api_token((api_tk)=> {
  274 +
  275 + var header={
274 276 'content-type': 'application/json'
275   - },// 设置请求的 header
276   - success: function (res) { succ(res); },
277   - fail: function (res) { fail(res); }
  277 + };// 设置请求的 header
  278 +
  279 + var dd= ut.deep_cp(data);
  280 + dd={...arr_in_url,...dd};
  281 +
  282 + var now=ut.gettimestamp();
  283 + var tk=getApp().request.set_req_sign(dd,url1,now,api_tk,1);
  284 + if(tk){
  285 + header.reqtime=now;
  286 + header.token=tk;
  287 + header.ukey=api_tk.userkey
  288 + }
  289 +
  290 +
  291 + var str = JSON.stringify(data);
  292 + wx.request({
  293 + url: url,
  294 + data: str,
  295 + method: Mathod,
  296 + header:header,// 设置请求的 header
  297 + success: function (res) {
  298 + succ(res);
  299 + },
  300 + fail: function (res) {
  301 + fail(res);
  302 + }
  303 + })
278 304 })
279 305 },
  306 +
280 307 })
281 308 \ No newline at end of file
... ...
packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js
... ... @@ -291,17 +291,44 @@ Page({
291 291 json_post: function (url, data, succ, fail, mathod) {
292 292 var Mathod = "POST";
293 293 if (mathod) Mathod = mathod;
  294 +
  295 + var url1=url;
  296 + var arr_in_url=ut.getParams(url1);
  297 +
294 298 if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
295   - var str = JSON.stringify(data);
296   - wx.request({
297   - url: url,
298   - data: str,
299   - method: Mathod,
300   - header: {
  299 +
  300 + getApp().request.ck_api_token((api_tk)=> {
  301 +
  302 + var header={
301 303 'content-type': 'application/json'
302   - },// 设置请求的 header
303   - success: function (res) { succ(res); },
304   - fail: function (res) { fail(res); }
  304 + };// 设置请求的 header
  305 +
  306 + var dd= ut.deep_cp(data);
  307 + dd={...arr_in_url,...dd};
  308 +
  309 + var now=ut.gettimestamp();
  310 + var tk=getApp().request.set_req_sign(dd,url1,now,api_tk,1);
  311 + if(tk){
  312 + header.reqtime=now;
  313 + header.token=tk;
  314 + header.ukey=api_tk.userkey
  315 + }
  316 +
  317 +
  318 + var str = JSON.stringify(data);
  319 + wx.request({
  320 + url: url,
  321 + data: str,
  322 + method: Mathod,
  323 + header:header,// 设置请求的 header
  324 + success: function (res) {
  325 + succ(res);
  326 + },
  327 + fail: function (res) {
  328 + fail(res);
  329 + }
  330 + })
305 331 })
306 332 },
  333 +
307 334 })
308 335 \ No newline at end of file
... ...
packageD/pages/user/member/bring/bring.js
... ... @@ -213,16 +213,11 @@ Page({
213 213 delete user_infor.type;
214 214  
215 215 user_infor.source_type=1;
216   - var str = JSON.stringify(user_infor);
  216 + //var str = JSON.stringify(user_infor);
217 217 // wx.showLoading({ title: "加载中" });
218   - wx.request({
219   - url: oo.url + '/api/weshop/users/saveWithdrawals',
220   - data: str,
221   - method: 'POST',
222   - header: {
223   - 'content-type': 'application/json'
224   - }, // 设置请求的 header
225   - success: function(res) {
  218 + getApp().request.promisePost("/api/weshop/users/saveWithdrawals", {
  219 + data: user_infor,is_json:1,is_normal:1
  220 + }).then(res => {
226 221  
227 222 th.data.tx_ing=0;
228 223 if (res.data.code != -1) {
... ... @@ -232,12 +227,10 @@ Page({
232 227 } else {
233 228 getApp().showWarning("提现金额不足");
234 229 }
235   - },
236   - fail: function() {
237   - getApp().showWarning("出现错误");
238   - },
239   -
240 230  
  231 + }).catch(function(err) {
  232 + getApp().showWarning("网络繁忙,请稍后重试");
  233 + th.data.tx_ing=0;
241 234 })
242 235  
243 236 },
... ...
packageE/pages/cart/cart2/cart2.js
... ... @@ -6005,14 +6005,10 @@ Page({
6005 6005  
6006 6006 wx.showLoading({ title: "加载中" });
6007 6007 th.setData({ submit: 1, })
6008   - wx.request({
6009   - url: oo.url + '/api/weshop/order/createWxdOrder',
6010   - data: str,
6011   - method: 'POST',
6012   - header: {
6013   - 'content-type': 'application/json'
6014   - },// 设置请求的 header
6015   - success: function (res) {
  6008 +
  6009 + getApp().request.promisePost("/api/weshop/order/createWxdOrder", {
  6010 + data: pdata,is_json:1,is_normal:1
  6011 + }).then(res => {
6016 6012 wx.hideLoading();
6017 6013  
6018 6014 if (res.statusCode == 200) {
... ... @@ -6178,17 +6174,17 @@ Page({
6178 6174 submit: 0,
6179 6175 })
6180 6176 }
6181   - },
6182   - fail: function () {
6183   - th.data.is_summit_ing = 0;
6184   - wx.hideLoading();
6185   - console.log("index.js wx.request CheckCallUser fail");
6186   - th.setData({
6187   - submit: 0,
6188   - })
6189   - }
  6177 +
  6178 + }).catch(function(err) {
  6179 + th.data.is_summit_ing = 0;
  6180 + wx.hideLoading();
  6181 + console.log("index.js wx.request CheckCallUser fail");
  6182 + th.setData({
  6183 + submit: 0,
  6184 + })
6190 6185 })
6191 6186  
  6187 +
6192 6188 },
6193 6189 //看一下有没有选择搭配的商品
6194 6190 has_collocation(goods, prom_id) {
... ...
packageE/pages/cart/cart2_inte/cart2_inte.js
... ... @@ -1478,14 +1478,11 @@ Page({
1478 1478 var str = JSON.stringify(pdata);
1479 1479  
1480 1480 wx.showLoading({ title: "加载中" });
1481   - wx.request({
1482   - url: oo.url + '/api/weshop/order/createWxdOrder',
1483   - data: str,
1484   - method: 'POST',
1485   - header: {
1486   - 'content-type': 'application/json'
1487   - },// 设置请求的 header
1488   - success: function (res) {
  1481 +
  1482 +
  1483 + getApp().request.promisePost("/api/weshop/order/createWxdOrder", {
  1484 + data: pdata,is_json:1,is_normal:1
  1485 + }).then(res => {
1489 1486 wx.hideLoading();
1490 1487 if (res.statusCode == 200) {
1491 1488 var data = res.data;
... ... @@ -1587,14 +1584,11 @@ Page({
1587 1584 th.data.is_summit_ing = 0; //是否提交中
1588 1585 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
1589 1586 }
1590   - },
1591   - fail: function () {
1592   - th.setData({submit:0})
1593   - th.data.is_summit_ing = 0;
1594   - wx.hideLoading();
1595   - console.log("index.js wx.request CheckCallUser fail");
1596   - },
1597   - complete: function () { }
  1587 +
  1588 + }).catch(function(err) {
  1589 + th.setData({ submit: 0 })
  1590 + th.data.is_summit_ing = 0;
  1591 + wx.hideLoading();
1598 1592 })
1599 1593  
1600 1594 },
... ...
packageE/pages/cart/cart2_pt/cart2_pt.js
... ... @@ -1664,14 +1664,11 @@ Page({
1664 1664 console.log(str);
1665 1665 //return false;
1666 1666 wx.showLoading({ title: "加载中" });
1667   - wx.request({
1668   - url: oo.url + '/api/weshop/order/createWxdOrder',
1669   - data: str,
1670   - method: 'POST',
1671   - header: {
1672   - 'content-type': 'application/json'
1673   - },// 设置请求的 header
1674   - success: function (res) {
  1667 +
  1668 +
  1669 + getApp().request.promisePost("/api/weshop/order/createWxdOrder", {
  1670 + data: pdata,is_json:1,is_normal:1
  1671 + }).then(res => {
1675 1672  
1676 1673 wx.hideLoading();
1677 1674 if (res.statusCode == 200) {
... ... @@ -1767,14 +1764,10 @@ Page({
1767 1764 th.data.is_summit_ing = 0; //是否提交中
1768 1765 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
1769 1766 }
1770   - },
1771   - fail: function () {
1772   - th.data.is_summit_ing = 0; //是否提交中
1773   - wx.hideLoading();
1774   - console.log("index.js wx.request CheckCallUser fail");
1775   - },
1776   - complete: function () {
1777   - }
  1767 +
  1768 + }).catch(function(err) {
  1769 + th.data.is_summit_ing = 0; //是否提交中
  1770 + wx.hideLoading();
1778 1771 })
1779 1772 },
1780 1773 useCoupon: function () {
... ...
packageE/pages/cart/cart_wk/cart_wk.js
... ... @@ -783,15 +783,11 @@ Page({
783 783  
784 784 var arr = [];
785 785 arr.push(dd);
786   - console.log(JSON.stringify(arr));
787   - wx.request({
788   - url: oo.url + '/api/weshop/order/pay/payTuanWk',
789   - data: JSON.stringify(arr),
790   - method: 'POST',
791   - header: {
792   - 'content-type': 'application/json'
793   - },// 设置请求的 header
794   - success: function (t) {
  786 + //console.log(JSON.stringify(arr));
  787 +
  788 + getApp().request.promisePost("/api/weshop/order/pay/payTuanWk", {
  789 + data: arr,is_json:1,is_normal:1
  790 + }).then(t => {
795 791  
796 792 //---用微信支付---
797 793 if (dd.tail_pay_type == 0) {
... ... @@ -840,13 +836,13 @@ Page({
840 836 })
841 837 }, 1000)
842 838 } else {
843   -
844 839 th.data.paying=0;
845 840 getApp().my_warnning(t.data.msg, 1, th);
846 841 }
847 842 }
848   - }
849   - });
  843 + }).catch(function(err) {
  844 + th.data.paying=0;
  845 + })
850 846 },
851 847  
852 848 //检查区域是不是包邮
... ...
packageE/pages/giftpack/giftpacklistshop/giftpacklistshop.wxml
... ... @@ -222,7 +222,7 @@
222 222 <!-- 制作一个圆球导航 -->
223 223 <!-- <nav_b id="nav_b"></nav_b> -->
224 224  
225   -<include src="../public/buy_com.wxml"></include>
  225 +<include src="../../../../pages/giftpack/public/buy_com.wxml"></include>
226 226 <canvas canvas-id='share' style='width:750rpx;height:1217rpx;background-color:white;' wx:if="{{!canvasHidden}}"></canvas>
227 227 <share id="share_button" bind:send="send" bind:cancel="cancel" bind:share_img="saveImageToPhotosAlbum" wx:if="{{share_hidden}}"></share>
228 228  
... ...
packageE/pages/qy/contactMe/contactMe.js
... ... @@ -615,8 +615,21 @@ Page({
615 615 success: function (e) {
616 616 if (e.data.code == 0) {
617 617 app.globalData.user_id = e.data.data.user_id;
618   - } else {
619   - return app.showWarning("授权登入失败!" + e.data.msg);
  618 + }
  619 + else if(e.data.code==-3){
  620 + wx.showModal({
  621 + title: e.data.msg,
  622 + success: function (e) {
  623 + if(e.confirm){
  624 + dd.isreplacemobile=1;
  625 + th.zu_ce(dd);
  626 + }
  627 + }
  628 + });
  629 + return false;
  630 + }
  631 + else {
  632 + return app.my_warnning("授权登入失败!" + e.data.msg,0,th);
620 633 }
621 634 getApp().globalData.login_back = 1;
622 635 wx.setStorageSync("userinfo", e.data.data);
... ...
packageE/pages/togoin/togoin.js
... ... @@ -448,6 +448,7 @@ Page({
448 448  
449 449 wx.hideLoading();
450 450 th.setData({ sub: 0 });
  451 +
451 452  
452 453 if (e.data.code == 0) {
453 454 app.globalData.user_id = e.data.data.user_id;
... ... @@ -466,7 +467,7 @@ Page({
466 467 return false;
467 468 }
468 469 else {
469   - return app.showWarning("授权登入失败!" + e.data.msg);
  470 + return app.my_warnning("授权登入失败!" + e.data.msg,0,th);
470 471 }
471 472 getApp().globalData.login_back = 1;
472 473 wx.setStorageSync("userinfo", e.data.data);
... ...
packageE/pages/user/labels/labels.js
... ... @@ -256,6 +256,9 @@ Page({
256 256 data: getApp().globalData.zc_dd,
257 257 success: function (e) {
258 258 wx.hideLoading();
  259 +
  260 + e.data.code=-5;
  261 +
259 262 if (e.data.code == 0) {
260 263 app.globalData.user_id = e.data.data.user_id;
261 264 }
... ... @@ -276,7 +279,7 @@ Page({
276 279  
277 280 else {
278 281 th.setData({loading: 0,is_check:0});
279   - return app.showWarning("授权登入失败!" + e.data.msg);
  282 + return app.my_warnning("授权登入失败!" + e.data.msg,0,th);
280 283 }
281 284  
282 285 getApp().globalData.login_back = 1;
... ... @@ -464,6 +467,8 @@ Page({
464 467 wx.hideLoading();
465 468 th.setData({loading: 0,is_check:0});
466 469  
  470 + e.data.code=-5;
  471 +
467 472 if (e.data.code == 0) {
468 473 app.globalData.user_id = e.data.data.user_id;
469 474 }
... ... @@ -484,7 +489,7 @@ Page({
484 489 }
485 490  
486 491 else {
487   - return app.showWarning("授权登入失败!" + e.data.msg);
  492 + return app.my_warnning("授权登入失败!" + e.data.msg,0,th);
488 493 }
489 494 getApp().globalData.login_back = 1;
490 495 wx.setStorageSync("userinfo", e.data.data);
... ...
packageF/pages/giftpack/evaluategift/evaluategift.js
... ... @@ -43,19 +43,29 @@ Page({
43 43 title: '加载中',
44 44 })
45 45 var url = "/api/weshop/marketing/giftbag/bound/get";
  46 +
  47 + var data={
  48 + "actId": th.data.getActId, //活动Id
  49 + "actType": 2, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
  50 + "storeId": a.stoid, //商家Id
  51 + "userId": d.user_id, //用户ID
  52 + "orderNumber": th.data.orderNumber,
  53 + "orderType": th.data.orderType,
  54 + "isdg": th.data.isdg
  55 + };
  56 +
  57 + if(th.data.orderGoodsId){
  58 + data["orderGoodsId"]=th.data.orderGoodsId;
  59 + }
  60 +
  61 + if(th.data.giftBagId){
  62 + data["gifbagid"]= th.data.giftBagId;
  63 + }
  64 +
  65 +
46 66 getApp().request.promiseGet(url, {
47 67 isShowLoading: true,
48   - data: {
49   - "actId": th.data.getActId, //活动Id
50   - "actType": 2, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
51   - "storeId": a.stoid, //商家Id
52   - "userId": d.user_id, //用户ID
53   - "orderNumber": th.data.orderNumber,
54   - "orderType": th.data.orderType,
55   - "orderGoodsId": th.data.orderGoodsId,
56   - "gifbagid": th.data.giftBagId,
57   - "isdg": th.data.isdg
58   - }
  68 + data:data
59 69 }).then(res => {
60 70 if (res.data.code == 0) {
61 71 if (res.data.data.lbCoupons.length > 0 && res.data.data.lbCoupons != null) {
... ... @@ -190,10 +200,18 @@ Page({
190 200 "userId": d.user_id, //用户ID
191 201 "orderNumber": th.data.orderNumber,
192 202 "orderType": th.data.orderType,
193   - "orderGoodsId": th.data.orderGoodsId,
194   - "giftBagId": th.data.giftBagId,
195 203 "buyFrom": 2
196 204 };
  205 +
  206 + if(th.data.orderGoodsId){
  207 + json.orderGoodsId=th.data.orderGoodsId;
  208 + }
  209 +
  210 + if(th.data.giftBagId){
  211 + json.giftBagId=th.data.giftBagId
  212 + }
  213 +
  214 +
197 215 if (th.data.isdg) {
198 216 json.isdg=th.data.isdg
199 217 }
... ...
packageF/pages/user/return_goods_info/return_goods_info.js
... ... @@ -176,5 +176,19 @@ Page({
176 176 current: r[e.currentTarget.dataset.idx],
177 177 urls: r
178 178 });
179   - }
  179 + },
  180 +
  181 +
  182 + //---图片失败,默认图片---
  183 + bind_bnerr2: function (e) {
  184 + var _errImg = e.target.dataset.errorimg;
  185 + var _errurl = e.target.dataset.url;
  186 + var ii = _errurl.indexOf(os.imghost);
  187 + if (ii != -1) {
  188 + var _errObj = {};
  189 + _errObj[_errImg] = "/miniapp/images/default_g_img.gif";
  190 + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
  191 + }
  192 + },
  193 +
180 194 });
181 195 \ No newline at end of file
... ...
packageF/pages/user/return_goods_info/return_goods_info.wxml
... ... @@ -7,9 +7,15 @@
7 7 </view>
8 8 </view>
9 9 <view class="goods-mes" wx:for="{{return_goods.goodslist}}">
  10 +
10 11 <view class="goods-pic">
11   - <image class="wh100" src="{{resourceUrl+item.original_img}}" lazy-load="true"></image>
  12 + <image class="wh100" src="{{resourceUrl+item.original_img}}"
  13 + binderror="bind_bnerr2"
  14 + data-url="{{resourceUrl+item.original_img}}"
  15 + data-errorimg="return_goods.goodslist[{{index}}].original_img"
  16 + lazy-load="true"></image>
12 17 </view>
  18 +
13 19 <view class="goods-des">
14 20 <view class="goods-name ellipsis-1">{{item.goods_name}}</view>
15 21 <view class="now-price co-red" wx:if="{{return_goods.goods_id}}">退款金额 : ¥{{return_goods.back_money}}</view>
... ...
packageG/pages/user/express/exp_filter.wxs 0 → 100644
  1 +module.exports = {
  2 +
  3 + state_format:function (express){
  4 + if(!express) return '无轨迹';
  5 + if(express.State==-1) return '无轨迹';
  6 + if(express.State==0) return '已揽件';
  7 + if(express.State==1) return '在途中';
  8 + if(express.State==2) return '正在派件';
  9 + if(express.State==3) return '已签收';
  10 + if(express.State==4) return '派送失败';
  11 + if(express.State==5) return '疑难件';
  12 + if(express.State==6) return '退件签收';
  13 + return '其他';
  14 + }
  15 +
  16 +}
0 17 \ No newline at end of file
... ...
packageG/pages/user/express/express.js
1 1 var e = getApp(), s = e.request,oo=e.globalData,os=oo.setting;
  2 +var ut = require("../../../../utils/util.js");
2 3  
3 4 Page({
4 5 data: {
... ... @@ -7,35 +8,227 @@ Page({
7 8 delivery: null,
8 9 express: null,
9 10 re_arr:null,//反转后的数组
10   - error: "快递信息异常"
  11 + error: "快递信息异常",
  12 + active:0,
  13 + has_connaect:1,
  14 + is_get:0
11 15 },
12 16 onLoad: function(e) {
13   - this.requestDelivery(e.order_id);
  17 +
  18 + var th=this;
  19 + //----获取系统参数-----
  20 + getApp().getConfig2(function (ee) {
  21 + var is_connaect=1;
  22 +
  23 + if(ee.switch_list){
  24 + var json_d = JSON.parse(ee.switch_list);
  25 + if(json_d.weapp_customertype==0){
  26 + is_connaect=0;
  27 + }
  28 + th.setData({
  29 + store_config: ee,
  30 + sys_switch: json_d,
  31 + has_connaect:is_connaect
  32 + })
  33 +
  34 + }else{
  35 + th.setData({
  36 + has_connaect:0
  37 + })
  38 + }
  39 +
  40 + th.requestDelivery(e.order_id);
  41 + })
  42 +
  43 +
  44 +
14 45 },
15 46 requestDelivery: function(e) {
16 47 var r = this;
17 48 s.get("/api/order/deliverydoc/page", {
18   - data: { order_id: e,store_id:os.stoid },
  49 + data: { order_id: e,store_id:os.stoid,pageSize:100},
19 50 success: function(e) {
20   - r.setData({
21   - delivery: e.data.data.pageData[0],
22   - }), r.requestExpress();
  51 +
  52 + if(ut.ajax_ok(e)){
  53 + var list=e.data.data.pageData;
  54 +
  55 + for (let i = 0; i < list.length; i++) {
  56 + list[i].all_gd_num=0;
  57 + var json=list[i].erp_ck_warelist;
  58 + if(json){
  59 + json=JSON.parse(json);
  60 + for (let j = 0; j < json.length; j++) {
  61 + list[i].all_gd_num+=json[j].qty;
  62 + }
  63 + }
  64 +
  65 + list[i].erp_sender_city=r.sheng_lue(list[i].erp_sender_city,4);
  66 + list[i].erp_receiver_city=r.sheng_lue(list[i].erp_receiver_city,4);
  67 + }
  68 +
  69 +
  70 +
  71 + r.setData({
  72 + delivery: list[0],
  73 + delivery_arr:list
  74 + }), r.requestExpress();
  75 + }
  76 +
  77 +
  78 +
23 79 }
24 80 });
25 81 },
26 82 requestExpress: function() {
27 83 var s = this;
28   - wx.request({
29   - url: this.data.url + "/api/weshop/order/wuliu/" + this.data.delivery.shipping_code + "/" + this.data.delivery.invoice_no + "/" + this.data.delivery.mobile, success: function(e) {
30   -
31   - var re_arr = e.data.data.Traces.reverse();
  84 + var url="/api/weshop/order/wuliu/" + this.data.delivery.shipping_code + "/" + this.data.delivery.invoice_no + "/" + this.data.delivery.mobile;
  85 + getApp().request.promiseGet(url, {}).then(e => {
  86 + wx.hideLoading();
  87 + s.setData({is_get:1})
  88 +
  89 + if(e.data.code==0 && e.data.data){
  90 + var re_arr = e.data.data.Traces.reverse();
32 91 s.setData({
33   - express: e.data.data, re_arr: re_arr,
  92 + express: e.data.data, re_arr: re_arr,
34 93 });
35   - },
36   - fail: function(s) {
37   - e.showWarning("请求失败");
38 94 }
  95 +
  96 + }).catch(function(err) {
  97 + wx.hideLoading();
  98 + e.showWarning("请求失败");
  99 + })
  100 +
  101 + },
  102 +
  103 +
  104 + click_bao_btn(e){
  105 + var index= parseInt(e.currentTarget.dataset.idx);
  106 + var item=this.data.delivery_arr[index];
  107 + this.setData({
  108 + delivery: item,
  109 + active:index,
  110 + express:null,
  111 + re_arr:[],
  112 + is_get:0
  113 + });
  114 + wx.showLoading();
  115 + this.requestExpress();
  116 + },
  117 +
  118 + //打开客服操作菜单
  119 + openCS() {
  120 + let self=this;
  121 + // 判断会员状态
  122 + let user_info = getApp().globalData.userInfo;
  123 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) {
  124 + wx.navigateTo({
  125 + url: '/packageE/pages/togoin/togoin',
  126 + })
  127 + return false;
  128 + };
  129 + // csType/在线客服设置:
  130 + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、
  131 + // 1小程序客服、
  132 + // 2企业微信客服
  133 + if (this.data.sys_switch) {
  134 + let csType = this.data.sys_switch.weapp_customertype;
  135 + if (csType == 0) {
  136 + // 拨打电话号码
  137 + this.contactService();
  138 + } else {
  139 + this.getTel()
  140 + .then(() => {
  141 + self.setData({
  142 + hiddenCS: false,
  143 + });
  144 + });
  145 + };
  146 + };
  147 +
  148 + },
  149 +
  150 + //关闭客服操作菜单
  151 + closeCS() {
  152 + this.setData({
  153 + hiddenCS: true,
39 154 });
  155 + },
  156 +
  157 + // 获取客服电话
  158 + getTel() {
  159 + var self=this;
  160 + return new Promise((resolve, reject) => {
  161 + getApp().getConfig(function (t) {
  162 + if (t.store_tel == undefined) {
  163 + getApp().request.get("/api/weshop/store/get/" + os.stoid, {
  164 + isShowLoading: 1,
  165 + data: {},
  166 + success: function (rs) {
  167 + getApp().globalData.config = rs.data.data;
  168 + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
  169 + getApp().my_warnning("商家未设置电话", 0, th);
  170 + return false;
  171 + }
  172 + self.setData({
  173 + store_tel: rs.data.data.store_tel,
  174 + });
  175 + // s.confirmBox("请联系客服:" + rs.data.data.store_tel);
  176 + }
  177 + })
  178 + } else {
  179 + self.setData({
  180 + store_tel: t.store_tel,
  181 + });
  182 + // s.confirmBox("请联系客服:" + t.store_tel);
  183 + };
  184 + resolve();
  185 + });
  186 + });
  187 + },
  188 +
  189 +
  190 + customer_chat: function () {
  191 + getApp().customer_chat("");
  192 + },
  193 +
  194 + //---------联系客服------------
  195 + contactService: function () {
  196 + getApp().com_call(this);
  197 + },
  198 +
  199 + //---------联系微信客服------------
  200 + con_weixin: function () {
  201 + var url = this.data.sys_switch.weapp_customertype_url;
  202 + var id = this.data.sys_switch.weapp_customertype_appid;
  203 + wx.openCustomerServiceChat({
  204 + extInfo: { url: url },
  205 + corpId: id,
  206 + success(res) { }
  207 + })
  208 + },
  209 +
  210 + // 内容复制到剪贴板
  211 + copy() {
  212 + // console.log('点击了复制按钮');
  213 + wx.setClipboardData({
  214 + data: this.data.delivery.invoice_no,
  215 + success(res) {
  216 + wx.getClipboardData({
  217 + success(res) {
  218 + console.log(res.data);
  219 + }
  220 + })
  221 + }
  222 + })
  223 + },
  224 +
  225 + sheng_lue(txt,maxLength){
  226 + if(!txt) return '';
  227 + if (txt.length > maxLength) {
  228 + txt = txt.substr(0, maxLength) + '...';
  229 + }
  230 + return txt
40 231 }
  232 +
  233 +
41 234 });
42 235 \ No newline at end of file
... ...
packageG/pages/user/express/express.json
1 1 {
2   - "navigationBarTitleText": "查看物流信息"
  2 + "navigationBarTitleText": "查看物流信息",
  3 + "usingComponents": {
  4 + "nodata": "/components/nodata/nodata"
  5 + }
3 6 }
4 7 \ No newline at end of file
... ...
packageG/pages/user/express/express.wxml
  1 +<wxs module="util" src="exp_filter.wxs"></wxs>
  2 +<view class="fir_top {{!delivery.erp_sender_city && !delivery.erp_receiver_city?'small':''}}">
  3 + <view class="f_title">
  4 + <view style="padding:0 32rpx">
  5 + <view class="flex jc_sb ai-center">
  6 + <view>
  7 + <text style="margin-right: 20rpx;">{{delivery.shipping_name}}:{{delivery.invoice_no}}</text>
  8 + <block wx:if="{{!delivery.erp_sender_city && !delivery.erp_receiver_city}}">
  9 + <image bindtap="copy" style="width:26rpx;" src="{{resourceUrl}}/miniapp/js_img/fuzhi_bs.png" mode="widthFix"></image>
  10 + </block>
  11 + </view>
  12 +
  13 + <block wx:if="{{!delivery.erp_sender_city && !delivery.erp_receiver_city}}">
  14 + <!-- <text style="font-weight:bolder;" wx:if="{{express.State==0}}" >无轨迹</text>
  15 + <text style="font-weight:bolder;" wx:if="{{express.State==2}}" >已揽收</text>
  16 + <text style="font-weight:bolder;" wx:if="{{express.State==2}}" >在途中</text>
  17 + <text style="font-weight:bolder;" wx:if="{{express.State==3}}" >已签收</text>
  18 + <text style="font-weight:bolder;" wx:if="{{express.State==4}}" >问题件</text>
  19 + <text style="font-weight:bolder;" wx:if="{{!express}}" >无轨迹</text> -->
  20 + <text style="font-weight:bolder;" >{{util.state_format(express)}}</text>
  21 + </block>
  22 +
  23 +
  24 + <image wx:else bindtap="copy" style="width:26rpx;" src="{{resourceUrl}}/miniapp/js_img/fuzhi_bs.png" mode="widthFix"></image>
  25 + </view>
  26 + </view>
  27 + </view>
  28 +
  29 +
  30 + <block wx:if="{{delivery.erp_sender_city || delivery.erp_receiver_city}}">
  31 + <view class="fir_top_mid flex jc_sb ai-center">
  32 + <view class="left_mid flex jc-center ai-center">
  33 + <!-- <view wx:if="{{express.State==0}}" >无轨迹</view>
  34 + <view wx:if="{{express.State==2}}" >已揽收</view>
  35 + <view wx:if="{{express.State==2}}" >在途中</view>
  36 + <view wx:if="{{express.State==3}}" >已签收</view>
  37 + <view wx:if="{{express.State==4}}" >问题件</view>
  38 + <view wx:if="{{!express}}" >无轨迹</view> -->
  39 + <view >{{util.state_format(express)}}</view>
  40 + </view>
  41 + <view class="right_mid flex jc-center ai-center">
  42 + <view class="right_mid_btn flex jc-center ai-center">
  43 + <view>{{delivery.erp_sender_city || '无'}}</view>
  44 + <image style="width:56rpx; margin:0 28rpx" src="{{resourceUrl}}/miniapp/js_img/from_to.png" mode="widthFix"></image>
  45 + <view>{{delivery.erp_receiver_city || '无'}}</view>
  46 + </view>
  47 + </view>
  48 + </view>
  49 +
  50 + </block>
  51 + <!-- <block wx:else>
  52 + <view class="fir_top_mid flex jc-center ai-center bold_color">
  53 + <view wx:if="{{express.State==0}}" >无轨迹</view>
  54 + <view wx:if="{{express.State==2}}" >已揽收</view>
  55 + <view wx:if="{{express.State==2}}" >在途中</view>
  56 + <view wx:if="{{express.State==3}}" >已签收</view>
  57 + <view wx:if="{{express.State==4}}" >问题件</view>
  58 +
  59 +
  60 +
  61 + </view>
  62 + </block> -->
  63 +
  64 +
  65 +
  66 + <view class="fir_top_third">
  67 +
  68 + <view class="flex jc_sb ai-center" style="height:100%">
  69 + <view bindtap="contactService" class="fir_top_third_btn flex jc-center ai-center">
  70 + <image class="addimg3" src="{{resourceUrl}}/miniapp/js_img/jsls_callphone.png"></image>拨打电话
  71 + </view>
  72 +
  73 + <!-- 如果有联系客服的时候 -->
  74 + <block wx:if="{{has_connaect}}">
  75 + <view class="fir_top_third_lin"></view>
  76 +
  77 +
  78 + <!-- 小程序客服 -->
  79 + <block wx:if="{{sys_switch.weapp_customertype == 1}}">
  80 + <button class="fir_top_third_btn flex jc-center ai-center" bindtap="click_contact" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
  81 + <image class="addimg3" src="{{resourceUrl}}/miniapp/js_img/jsls_icon27.png"></image><text style="position: relative;top: 2rpx;" >联系客服</text>
  82 + </button>
  83 + </block>
  84 + <!-- 微信客服 -->
  85 + <block wx:elif="{{sys_switch.weapp_customertype == 2}}">
  86 + <view class="fir_top_third_btn flex jc-center ai-center" bindtap="con_weixin">
  87 + <image class="addimg3" src="{{resourceUrl}}/miniapp/js_img/jsls_icon27.png"></image><text style="position: relative;top: 2rpx;" >联系客服</text>
  88 + </view>
  89 + </block>
  90 +
  91 + <!-- 商城客服 -->
  92 + <block wx:elif="{{sys_switch.weapp_customertype == 3}}">
  93 + <view class="fir_top_third_btn flex jc-center ai-center" bindtap="customer_chat">
  94 + <image class="addimg3" src="{{resourceUrl}}/miniapp/js_img/jsls_icon27.png"></image><text style="position: relative;top: 2rpx;" >联系客服</text>
  95 + </view>
  96 + </block>
  97 +
  98 +<!-- <view bindtap="customer_chat" class="fir_top_third_btn flex jc-center ai-center">-->
  99 +<!-- <image class="addimg3" src="{{resourceUrl}}/miniapp/js_img/jsls_icon27.png"></image>联系客服-->
  100 +<!-- </view>-->
  101 + </block>
  102 + </view>
  103 + </view>
  104 +</view>
  105 +
  106 +<!---
1 107 <view class="logistics-mes">
2 108 <view class="logistics-num">
3 109 <view class="logistics-title">快递单号 : </view>
... ... @@ -7,7 +113,7 @@
7 113 <view class="logistics-title">承运公司 : </view>
8 114 <view class="logistics-cont">{{delivery.shipping_name}}</view>
9 115 </view>
10   -
  116 +
11 117 <view class="logistics-num">
12 118 <view class="logistics-title">物流状态 : </view>
13 119 <view wx:if="{{express.State==0}}" class="logistics-cont">无轨迹</view>
... ... @@ -17,23 +123,40 @@
17 123 <view wx:if="{{express.State==4}}" class="logistics-cont">问题件</view>
18 124 </view>
19 125  
20   -</view>
21   -<view class="apply-state">
22   - <view class="state-item">
23   - <!-- <view class="item-wrap">
24   - <view wx:if="{{express.State==2}}" class="state-title">在途中</view>
25   - <view wx:if="{{express.State==3}}" class="state-title">已签收</view>
26   - <view wx:if="{{express.State==4}}" class="state-title">问题件</view>
27   - <view class="state-time">{{' '}}</view>
28   - </view> -->
29   -
30   - <view class="item-wrap" wx:for="{{re_arr}}" wx:key="{{index}}">
31   - <view class="state-title">{{item.AcceptStation}}</view>
32   - <view class="state-time">{{item.AcceptTime}}</view>
  126 +</view>-->
  127 +
  128 +<!-- 显示物流详情 -->
  129 +<view style="padding-bottom:20rpx">
  130 + <view class="apply-state">
  131 + <view style="padding:25rpx 25rpx 0;">
  132 + <view class="deli_btn_box flex" wx:if="{{delivery_arr.length>1}}" >
  133 + <block wx:for="{{delivery_arr}}">
  134 + <view bindtap="click_bao_btn" data-idx="{{index}}" class="bao_btn {{index==active?'b_active':''}} ">包裹{{index+1}}<text wx:if="{{item.all_gd_num}}">(数量{{item.all_gd_num}})</text></view>
  135 + </block>
  136 + </view>
  137 + <view class="xq_title {{delivery_arr.length<2?'c_top':''}} ">物流详情</view>
33 138 </view>
  139 + <view style="padding:0 36rpx">
  140 + <view class="state-item">
  141 + <view class="item-wrap {{index==0?'fir':''}} " wx:for="{{re_arr}}" wx:key="{{index}}">
  142 + <view class="state-title">{{item.AcceptStation}}</view>
  143 + <view class="state-time">{{item.AcceptTime}}</view>
  144 + <view wx:if="{{index<re_arr.length-1}}" class="line"></view>
  145 +
  146 + </view>
  147 + </view>
  148 + </view>
  149 +
  150 + <block wx:if="{{(!re_arr || re_arr.length==0) && is_get}}">
  151 + <view class="flex jc-center">
  152 + <nodata title="{{express && express.Reason?express.Reason:'暂无轨迹'}}" ></nodata>
  153 + </view>
  154 +
  155 + </block>
  156 +
  157 +
  158 +
34 159 </view>
35 160 </view>
36 161  
37   -<view class="no_msg" wx:if="{{(!re_arr || re_arr.length==0) && express}}">
38   - {{express.Reason}}
39   -</view>
  162 +
... ...
packageG/pages/user/express/express.wxss
  1 +page{
  2 + background-color: #f1f1f1; color:#313131;
  3 +}
  4 +
1 5 .logistics-mes {
2 6 padding: 20rpx 30rpx;
3 7 background-color: #fff;
... ... @@ -12,6 +16,7 @@
12 16 .logistics-title {
13 17 color: #777;
14 18 margin-right: 20rpx;
  19 + position: relative;top: 2rpx;
15 20 }
16 21  
17 22 .logistics-cont {
... ... @@ -19,14 +24,12 @@
19 24 }
20 25  
21 26 .apply-state {
22   - margin-top: 20rpx;
  27 + margin: 20rpx 17rpx 0;
23 28 background-color: #fff;
24   - padding-left: 50rpx;
25   - padding-top: 60rpx;
  29 + border-radius: 17rpx;
26 30 }
27 31  
28 32 .state-item {
29   - border-left: 1px solid #ccc;
30 33 padding:0 40rpx;
31 34 }
32 35  
... ... @@ -34,31 +37,124 @@
34 37 position: relative;
35 38 margin-bottom: 20rpx;
36 39 padding-bottom: 20rpx;
37   - border-bottom: 1px solid #eee;
  40 + /* border-bottom: 1px solid #eee; */
38 41 font-size: 24rpx;
39 42 color: #aaa;
40 43 line-height: 1;
41 44 }
42 45  
  46 +.item-wrap .line{
  47 + height: 100%;width: 1rpx; background-color: #bfbfbf;
  48 + position: absolute;top: 22rpx; left: -40rpx;
  49 +}
  50 +
43 51 .item-wrap::before {
44 52 content: '';
45 53 position: absolute;
46   - left: -61rpx;
  54 + left: -52rpx;
47 55 top: 0;
48   - width: 26rpx;
49   - height: 26rpx;
  56 + width: 22rpx;
  57 + height: 22rpx;
50 58 border-radius: 50%;
51   - background-color: #e23435;
52   - border: 4px solid #ed8182;
  59 + background-color: #fff;
  60 + border: 1px solid #bfbfbf;
  61 + z-index: 100;
53 62 }
54 63  
55   -.state-title {
56   - font-size: 28rpx;
57   - font-weight: bold;
58   - color: #666;
  64 +.item-wrap.fir::before{
  65 + background-color: #e23435;
  66 + border: 5px solid #fdcfcd;
  67 + left: -61rpx;
  68 +}
  69 +.item-wrap .state-title {
  70 + font-size: 27rpx;
  71 + color: #898989;
59 72 padding-bottom: 20rpx;
60 73 line-height: 40rpx
61 74 }
  75 +
  76 +.item-wrap.fir .state-title {
  77 + color: #313131;
  78 +}
  79 +.item-wrap.fir .state-time{
  80 + color: #fe0002;
  81 +}
  82 +
62 83 .no_msg{
63 84 text-align: center;color: #999; font-size: 32rpx
64   -}
65 85 \ No newline at end of file
  86 +}
  87 +
  88 +.deli_btn_box{
  89 + overflow-x:auto ; overflow-y:hidden ;
  90 +}
  91 +.bao_btn{
  92 + background-color: #f1f1f1; color: #313131;padding:0 34rpx; flex-shrink: 0; border-radius: 15rpx;
  93 + font-size: 26rpx; width: auto; height: 62rpx; line-height: 62rpx;
  94 +}
  95 +.bao_btn~.bao_btn{
  96 + margin-left: 18rpx;
  97 +}
  98 +.xq_title{
  99 + font-size: 34rpx; font-weight: bolder;color: #313131; line-height: 34rpx;margin-top: 50rpx;padding-bottom: 37rpx;
  100 +}
  101 +
  102 +.xq_title.c_top{
  103 + margin-top: 20rpx;
  104 +}
  105 +
  106 +.fir_top{
  107 + height: 328rpx;
  108 + margin: 20rpx 17rpx 0;overflow: hidden;
  109 + background-color: #fff;
  110 + border-radius: 17rpx;
  111 +}
  112 +
  113 +.fir_top.small{
  114 + height: 145rpx;
  115 +}
  116 +
  117 +.f_title{
  118 + height: 66rpx; line-height: 66rpx; background-color: #170a02; color: #fff; font-size: 25rpx;
  119 +}
  120 +.fir_top_mid{
  121 + height: 183rpx; border-bottom: 1rpx solid #eee;
  122 +}
  123 +.left_mid{
  124 + width:auto; flex-shrink: 0; margin-left: 24rpx; flex:1;
  125 + color: #fe0002; font-size: 35rpx; font-weight: bolder;
  126 +}
  127 +.right_mid{
  128 + width:440; flex-shrink: 0;
  129 +}
  130 +
  131 +.bold_color{
  132 + color: #fe0002; font-size: 35rpx; font-weight: bolder;
  133 +}
  134 +
  135 +.right_mid_btn{
  136 + height:109rpx; background-color: #f1f1f1; border-radius: 109rpx;
  137 + font-size: 26rpx; font-weight: bolder; color: #313131;
  138 + margin-right: 17rpx; width: 430rpx;
  139 +}
  140 +
  141 +.fir_top_third{
  142 + height: 79rpx; color: #313131; font-size: 26rpx;
  143 +}
  144 +.fir_top_third_lin {
  145 + border-right: 1rpx solid #eee;
  146 + margin: 15rpx 11rpx; width: 2rpx;
  147 + height: 56rpx;
  148 +}
  149 +.addimg3{
  150 + width: 27rpx;
  151 + height: 27rpx;
  152 + padding: 0 12rpx;
  153 +}
  154 +.fir_top_third_btn{
  155 + width: 100%; height: 100%;
  156 +}
  157 +
  158 +.bao_btn.b_active{
  159 + background-color:#fefbea;color: #fe0000; font-weight: bolder; border: 1rpx solid #fe0000;
  160 +}
  161 +
... ...
packageG/pages/user/my_service/appment_main.js
... ... @@ -116,14 +116,10 @@ Page({
116 116 "validay": validay
117 117 }
118 118 var data = JSON.stringify(json);
119   - wx.request({
120   - url: url,
121   - data: json,
122   - method: 'post',
123   - header: {
124   - 'content-type': 'application/json'
125   - }, // 设置请求的 header
126   - success: function(res) {
  119 +
  120 + getApp().request.promisePost(url, {
  121 + data: json,is_json:1,is_normal:1
  122 + }).then(res => {
127 123 th.setData({
128 124 is_sub: 0
129 125 })
... ... @@ -132,7 +128,7 @@ Page({
132 128 getApp().my_warnning("预约成功", 1, th);
133 129 var store_name = th.data.store_name; //预约门店
134 130 var number = res.data.data.Number;
135   - var temp_url = "/api/wx/open/app/user/sendSubscribeMsg"; //模版接口
  131 + var temp_url = "/api/weshop/wx/open/app/user/sendSubscribeMsg"; //模版接口
136 132 var userinfo = getApp().globalData.userInfo;
137 133 var name = d.userInfo.nickname;
138 134 var json = {
... ... @@ -156,16 +152,12 @@ Page({
156 152 "userId": d.user_id
157 153 };
158 154 var data = JSON.stringify(json);
159   - //调用发送预约成功模版接口
160   - wx.request({
161   - url: th.data.inurl + temp_url,
162   - data: data,
163   - method: 'post',
164   - header: {
165   - 'content-type': 'application/json'
166   - }, // 设置请求的 header
167   - success: function(data) {}
168   - })
  155 +
  156 + getApp().request.promisePost(temp_url, {
  157 + data: json, is_json: 1, is_normal: 1
  158 + }).then( r =>{})
  159 +
  160 +
169 161 setTimeout(function() {
170 162 wx.redirectTo({
171 163 url: "/packageG/pages/user/my_service/tment_details?number=" + number
... ... @@ -175,7 +167,7 @@ Page({
175 167 getApp().my_warnning(res.data.msg, 0, th);
176 168 th.settime();
177 169 }
178   - }
  170 +
179 171 })
180 172  
181 173 },
... ...
packageG/pages/user/my_service/beauty_deta.js
... ... @@ -167,14 +167,10 @@ Page({
167 167 };
168 168 var data = JSON.stringify(json);
169 169 var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
170   - wx.request({
171   - url: url,
172   - data: data,
173   - method: 'put',
174   - header: {
175   - 'content-type': 'application/json'
176   - }, // 设置请求的 header
177   - success: function (res) {
  170 +
  171 + getApp().request.promisePut(url, {
  172 + data: json,is_json:1,is_normal:1
  173 + }).then(res => {
178 174 if (res.data.code == 0) {
179 175 getApp().my_warnning(res.data.data, 1, th);
180 176 setTimeout(function () {
... ... @@ -186,7 +182,7 @@ Page({
186 182 } else {
187 183 getApp().my_warnning(res.data.msg, 0, th);
188 184 }
189   - }
  185 +
190 186 })
191 187 } else {
192 188 var pages = getCurrentPages(); //当前页面
... ... @@ -373,20 +369,16 @@ Page({
373 369 };
374 370 var data = JSON.stringify(json);
375 371 var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
376   - wx.request({
377   - url: url,
378   - data: data,
379   - method: 'put',
380   - header: {
381   - 'content-type': 'application/json'
382   - }, // 设置请求的 header
383   - success: function (res) {
  372 +
  373 + getApp().request.promisePut(url, {
  374 + data: json,is_json:1,is_normal:1
  375 + }).then(res => {
384 376 if (res.data.code == 0) {
385 377 getApp().my_warnning("更改成功", 0, th);
386 378 } else {
387 379 getApp().my_warnning(res.data.msg, 0, th);
388 380 }
389   - }
  381 +
390 382 })
391 383 },
392 384 //预览头像
... ...
packageG/pages/user/my_service/tment_details.js
... ... @@ -40,14 +40,9 @@ Page({
40 40 };
41 41 var data = JSON.stringify(json);
42 42 var url = th.data.url + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
43   - wx.request({
44   - url: url,
45   - data: data,
46   - method: 'put',
47   - header: {
48   - 'content-type': 'application/json'
49   - }, // 设置请求的 header
50   - success: function(res) {
  43 + getApp().request.promisePut(url, {
  44 + data: json,is_json:1,is_normal:1
  45 + }).then(res => {
51 46 my_confirm.open_cancel(0);
52 47 if (res.data.code == 0) {
53 48 getApp().my_warnning("取消成功", 1, th);
... ... @@ -58,7 +53,7 @@ Page({
58 53 } else {
59 54 getApp().my_warnning(res.data.msg, 0, th);
60 55 }
61   - }
  56 +
62 57 })
63 58 }
64 59 );
... ...
packageG/pages/user/my_service/tment_eval.js
... ... @@ -178,14 +178,10 @@ Page({
178 178 "storeId": a.stoid
179 179 };
180 180 var data = JSON.stringify(json); //转换成json格式
181   - wx.request({
182   - url: url,
183   - data: data,
184   - method: 'POST',
185   - header: {
186   - 'content-type': 'application/json'
187   - }, // 设置请求的 header
188   - success: function(res) {
  181 +
  182 + getApp().request.promisePost(url, {
  183 + data: json,is_json:1,is_normal:1
  184 + }).then(res => {
189 185 wx.hideLoading();
190 186 if (res.data.code == 0) {
191 187 getApp().my_warnning("评价成功", 1, th);
... ... @@ -198,7 +194,7 @@ Page({
198 194 } else {
199 195 getApp().my_warnning(res.data.msg, 0, th);
200 196 }
201   - }
  197 +
202 198 })
203 199  
204 200 },
... ...
packageG/pages/user/my_service/tment_order_list.js
... ... @@ -151,14 +151,10 @@ Page({
151 151 };
152 152 var data = JSON.stringify(json);
153 153 var url = th.data.url + "/api/weshop/marketing/reservation/reservation/update"; //预约接口地址
154   - wx.request({
155   - url: url,
156   - data: data,
157   - method: 'put',
158   - header: {
159   - 'content-type': 'application/json'
160   - }, // 设置请求的 header
161   - success: function(res) {
  154 +
  155 + getApp().request.promisePut(url, {
  156 + data: json,is_json:1,is_normal:1
  157 + }).then(res => {
162 158 if (res.data.code == 0) {
163 159 getApp().my_warnning("取消成功", 1, th);
164 160 var id = th.data.activeCategoryId;
... ... @@ -177,7 +173,7 @@ Page({
177 173 } else {
178 174 getApp().my_warnning(res.data.msg, 0, th);
179 175 }
180   - }
  176 +
181 177 })
182 178 })
183 179  
... ...
packageG/pages/user/order_detail/order_detail.js
... ... @@ -137,7 +137,7 @@ Page({
137 137 r.order_status_detail = "待收货";r.receive_btn=1;
138 138 if (r.exp_type == 0) r.shipping_btn=1;
139 139 }
140   - if (r.order_status == 1 && r.pay_status == 1 && r.shipping_status == 2){
  140 + if (r.order_status == 1 && r.pay_status == 1 && (r.shipping_status == 2 || r.shipping_status == 3)){
141 141 r.order_status_detail = "待收货"; r.receive_btn = 1;
142 142 if (r.exp_type == 0) r.shipping_btn = 1;
143 143 }
... ...
pages/user/assistance/task_assistance.wxml
... ... @@ -195,5 +195,5 @@
195 195  
196 196 <!-- 二维码显示页面 -->
197 197 <canvas canvas-id='share_id' style='width:750rpx;height:1200rpx;background-color:white;' wx:if="{{!canvasHidden}}"></canvas>
198   -<include src="../../../packageF/giftpack/public/buy_com.wxml"></include>
  198 +<include src="../..//giftpack/public/buy_com.wxml"></include>
199 199  
... ...
pages/user/index/index.js
... ... @@ -903,7 +903,7 @@ Page({
903 903 getApp().goto("/packageE/pages/user/user_fw/user_fw?gradeId=" + th.data.gradeId + "&FormId=" + item.Id);
904 904 break;
905 905 case "03":
906   - getApp().goto("/pages/user/user_spsy/user_spsy?img=" +
  906 + getApp().goto("/packageH/pages/user/user_spsy/user_spsy?img=" +
907 907 url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id);
908 908 break;
909 909 case "10":
... ... @@ -1146,6 +1146,13 @@ Page({
1146 1146 d_list[i]["weappurl"]="/packageF/pages/giftpack/mygiftpack/mygiftpack";
1147 1147 d_list[i]["new_weappurl"]="/packageF/pages/giftpack/mygiftpack/mygiftpack";
1148 1148 }
  1149 + if (ite.id==26)
  1150 + {
  1151 + d_list[i]["weappurl"]="/pages/user/order_list/order_list?index=1";
  1152 + d_list[i]["new_weappurl"]="/pages/user/order_list/order_list?index=1";
  1153 + }
  1154 +
  1155 +
1149 1156 t_map[ite.name]=ite.id+'';
1150 1157 }
1151 1158 this.setData({
... ...
pages/user/order_list/order_list.wxml
... ... @@ -267,6 +267,8 @@
267 267 hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==1)}}" data-url="/packageG/pages/user/express/express?order_id={{item.order_id}}">查看物流</view>
268 268 <view bindtap="go_wuliu" class="commodity_To_evaluate flex-level View_evaluation" data-order_id="{{item.order_id}}"
269 269 hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==2)}}" data-url="/packageG/pages/user/express/express?order_id={{item.order_id}}">查看物流</view>
  270 + <view bindtap="go_wuliu" class="commodity_To_evaluate flex-level View_evaluation" data-order_id="{{item.order_id}}"
  271 + hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==3)}}" data-url="/packageG/pages/user/express/express?order_id={{item.order_id}}">查看物流</view>
270 272  
271 273 <navigator class="commodity_To_evaluate flex-level View_evaluation" url="/packageC/pages/luckyGo/luckyGo_order/luckyGo_order?order_id={{item.order_id}}&&group_id={{item.order_goods[0].prom_id}}" wx:if="{{item.order_goods[0].prom_type==9}}">订单详情</navigator>
272 274 <navigator class="commodity_To_evaluate flex-level View_evaluation" url="{{item.ord_url}}?order_id={{item.order_id}}" wx:else>订单详情</navigator>
... ...
utils/md5.min.js 0 → 100644
  1 +/**
  2 + * [js-md5]{@link https://github.com/emn178/js-md5}
  3 + *
  4 + * @namespace md5
  5 + * @version 0.7.3
  6 + * @author Chen, Yi-Cyuan [emn178@gmail.com]
  7 + * @copyright Chen, Yi-Cyuan 2014-2017
  8 + * @license MIT
  9 + */
  10 +!function(){"use strict";function t(t){if(t)d[0]=d[16]=d[1]=d[2]=d[3]=d[4]=d[5]=d[6]=d[7]=d[8]=d[9]=d[10]=d[11]=d[12]=d[13]=d[14]=d[15]=0,this.blocks=d,this.buffer8=l;else if(a){var r=new ArrayBuffer(68);this.buffer8=new Uint8Array(r),this.blocks=new Uint32Array(r)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var r="input is invalid type",e="object"==typeof window,i=e?window:{};i.JS_MD5_NO_WINDOW&&(e=!1);var s=!e&&"object"==typeof self,h=!i.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;h?i=global:s&&(i=self);var f=!i.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,o="function"==typeof define&&define.amd,a=!i.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,n="0123456789abcdef".split(""),u=[128,32768,8388608,-2147483648],y=[0,8,16,24],c=["hex","array","digest","buffer","arrayBuffer","base64"],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),d=[],l;if(a){var A=new ArrayBuffer(68);l=new Uint8Array(A),d=new Uint32Array(A)}!i.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!i.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var b=function(r){return function(e){return new t(!0).update(e)[r]()}},v=function(){var r=b("hex");h&&(r=w(r)),r.create=function(){return new t},r.update=function(t){return r.create().update(t)};for(var e=0;e<c.length;++e){var i=c[e];r[i]=b(i)}return r},w=function(t){var e=eval("require('crypto')"),i=eval("require('buffer').Buffer"),s=function(s){if("string"==typeof s)return e.createHash("md5").update(s,"utf8").digest("hex");if(null===s||void 0===s)throw r;return s.constructor===ArrayBuffer&&(s=new Uint8Array(s)),Array.isArray(s)||ArrayBuffer.isView(s)||s.constructor===i?e.createHash("md5").update(new i(s)).digest("hex"):t(s)};return s};t.prototype.update=function(t){if(!this.finalized){var e,i=typeof t;if("string"!==i){if("object"!==i)throw r;if(null===t)throw r;if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw r;e=!0}for(var s,h,f=0,o=t.length,n=this.blocks,u=this.buffer8;f<o;){if(this.hashed&&(this.hashed=!1,n[0]=n[16],n[16]=n[1]=n[2]=n[3]=n[4]=n[5]=n[6]=n[7]=n[8]=n[9]=n[10]=n[11]=n[12]=n[13]=n[14]=n[15]=0),e)if(a)for(h=this.start;f<o&&h<64;++f)u[h++]=t[f];else for(h=this.start;f<o&&h<64;++f)n[h>>2]|=t[f]<<y[3&h++];else if(a)for(h=this.start;f<o&&h<64;++f)(s=t.charCodeAt(f))<128?u[h++]=s:s<2048?(u[h++]=192|s>>6,u[h++]=128|63&s):s<55296||s>=57344?(u[h++]=224|s>>12,u[h++]=128|s>>6&63,u[h++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++f)),u[h++]=240|s>>18,u[h++]=128|s>>12&63,u[h++]=128|s>>6&63,u[h++]=128|63&s);else for(h=this.start;f<o&&h<64;++f)(s=t.charCodeAt(f))<128?n[h>>2]|=s<<y[3&h++]:s<2048?(n[h>>2]|=(192|s>>6)<<y[3&h++],n[h>>2]|=(128|63&s)<<y[3&h++]):s<55296||s>=57344?(n[h>>2]|=(224|s>>12)<<y[3&h++],n[h>>2]|=(128|s>>6&63)<<y[3&h++],n[h>>2]|=(128|63&s)<<y[3&h++]):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++f)),n[h>>2]|=(240|s>>18)<<y[3&h++],n[h>>2]|=(128|s>>12&63)<<y[3&h++],n[h>>2]|=(128|s>>6&63)<<y[3&h++],n[h>>2]|=(128|63&s)<<y[3&h++]);this.lastByteIndex=h,this.bytes+=h-this.start,h>=64?(this.start=h-64,this.hash(),this.hashed=!0):this.start=h}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,r=this.lastByteIndex;t[r>>2]|=u[3&r],r>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},t.prototype.hash=function(){var t,r,e,i,s,h,f=this.blocks;this.first?r=((r=((t=((t=f[0]-680876937)<<7|t>>>25)-271733879<<0)^(e=((e=(-271733879^(i=((i=(-1732584194^2004318071&t)+f[1]-117830708)<<12|i>>>20)+t<<0)&(-271733879^t))+f[2]-1126478375)<<17|e>>>15)+i<<0)&(i^t))+f[3]-1316259209)<<22|r>>>10)+e<<0:(t=this.h0,r=this.h1,e=this.h2,r=((r+=((t=((t+=((i=this.h3)^r&(e^i))+f[0]-680876936)<<7|t>>>25)+r<<0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+f[1]-389564586)<<12|i>>>20)+t<<0)&(t^r))+f[2]+606105819)<<17|e>>>15)+i<<0)&(i^t))+f[3]-1044525330)<<22|r>>>10)+e<<0),r=((r+=((t=((t+=(i^r&(e^i))+f[4]-176418897)<<7|t>>>25)+r<<0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+f[5]+1200080426)<<12|i>>>20)+t<<0)&(t^r))+f[6]-1473231341)<<17|e>>>15)+i<<0)&(i^t))+f[7]-45705983)<<22|r>>>10)+e<<0,r=((r+=((t=((t+=(i^r&(e^i))+f[8]+1770035416)<<7|t>>>25)+r<<0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+f[9]-1958414417)<<12|i>>>20)+t<<0)&(t^r))+f[10]-42063)<<17|e>>>15)+i<<0)&(i^t))+f[11]-1990404162)<<22|r>>>10)+e<<0,r=((r+=((t=((t+=(i^r&(e^i))+f[12]+1804603682)<<7|t>>>25)+r<<0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+f[13]-40341101)<<12|i>>>20)+t<<0)&(t^r))+f[14]-1502002290)<<17|e>>>15)+i<<0)&(i^t))+f[15]+1236535329)<<22|r>>>10)+e<<0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+f[1]-165796510)<<5|t>>>27)+r<<0)^r))+f[6]-1069501632)<<9|i>>>23)+t<<0)^t&((e=((e+=(t^r&(i^t))+f[11]+643717713)<<14|e>>>18)+i<<0)^i))+f[0]-373897302)<<20|r>>>12)+e<<0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+f[5]-701558691)<<5|t>>>27)+r<<0)^r))+f[10]+38016083)<<9|i>>>23)+t<<0)^t&((e=((e+=(t^r&(i^t))+f[15]-660478335)<<14|e>>>18)+i<<0)^i))+f[4]-405537848)<<20|r>>>12)+e<<0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+f[9]+568446438)<<5|t>>>27)+r<<0)^r))+f[14]-1019803690)<<9|i>>>23)+t<<0)^t&((e=((e+=(t^r&(i^t))+f[3]-187363961)<<14|e>>>18)+i<<0)^i))+f[8]+1163531501)<<20|r>>>12)+e<<0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+f[13]-1444681467)<<5|t>>>27)+r<<0)^r))+f[2]-51403784)<<9|i>>>23)+t<<0)^t&((e=((e+=(t^r&(i^t))+f[7]+1735328473)<<14|e>>>18)+i<<0)^i))+f[12]-1926607734)<<20|r>>>12)+e<<0,r=((r+=((h=(i=((i+=((s=r^e)^(t=((t+=(s^i)+f[5]-378558)<<4|t>>>28)+r<<0))+f[8]-2022574463)<<11|i>>>21)+t<<0)^t)^(e=((e+=(h^r)+f[11]+1839030562)<<16|e>>>16)+i<<0))+f[14]-35309556)<<23|r>>>9)+e<<0,r=((r+=((h=(i=((i+=((s=r^e)^(t=((t+=(s^i)+f[1]-1530992060)<<4|t>>>28)+r<<0))+f[4]+1272893353)<<11|i>>>21)+t<<0)^t)^(e=((e+=(h^r)+f[7]-155497632)<<16|e>>>16)+i<<0))+f[10]-1094730640)<<23|r>>>9)+e<<0,r=((r+=((h=(i=((i+=((s=r^e)^(t=((t+=(s^i)+f[13]+681279174)<<4|t>>>28)+r<<0))+f[0]-358537222)<<11|i>>>21)+t<<0)^t)^(e=((e+=(h^r)+f[3]-722521979)<<16|e>>>16)+i<<0))+f[6]+76029189)<<23|r>>>9)+e<<0,r=((r+=((h=(i=((i+=((s=r^e)^(t=((t+=(s^i)+f[9]-640364487)<<4|t>>>28)+r<<0))+f[12]-421815835)<<11|i>>>21)+t<<0)^t)^(e=((e+=(h^r)+f[15]+530742520)<<16|e>>>16)+i<<0))+f[2]-995338651)<<23|r>>>9)+e<<0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+f[0]-198630844)<<6|t>>>26)+r<<0)|~e))+f[7]+1126891415)<<10|i>>>22)+t<<0)^((e=((e+=(t^(i|~r))+f[14]-1416354905)<<15|e>>>17)+i<<0)|~t))+f[5]-57434055)<<21|r>>>11)+e<<0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+f[12]+1700485571)<<6|t>>>26)+r<<0)|~e))+f[3]-1894986606)<<10|i>>>22)+t<<0)^((e=((e+=(t^(i|~r))+f[10]-1051523)<<15|e>>>17)+i<<0)|~t))+f[1]-2054922799)<<21|r>>>11)+e<<0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+f[8]+1873313359)<<6|t>>>26)+r<<0)|~e))+f[15]-30611744)<<10|i>>>22)+t<<0)^((e=((e+=(t^(i|~r))+f[6]-1560198380)<<15|e>>>17)+i<<0)|~t))+f[13]+1309151649)<<21|r>>>11)+e<<0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+f[4]-145523070)<<6|t>>>26)+r<<0)|~e))+f[11]-1120210379)<<10|i>>>22)+t<<0)^((e=((e+=(t^(i|~r))+f[2]+718787259)<<15|e>>>17)+i<<0)|~t))+f[9]-343485551)<<21|r>>>11)+e<<0,this.first?(this.h0=t+1732584193<<0,this.h1=r-271733879<<0,this.h2=e-1732584194<<0,this.h3=i+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+r<<0,this.h2=this.h2+e<<0,this.h3=this.h3+i<<0)},t.prototype.hex=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return n[t>>4&15]+n[15&t]+n[t>>12&15]+n[t>>8&15]+n[t>>20&15]+n[t>>16&15]+n[t>>28&15]+n[t>>24&15]+n[r>>4&15]+n[15&r]+n[r>>12&15]+n[r>>8&15]+n[r>>20&15]+n[r>>16&15]+n[r>>28&15]+n[r>>24&15]+n[e>>4&15]+n[15&e]+n[e>>12&15]+n[e>>8&15]+n[e>>20&15]+n[e>>16&15]+n[e>>28&15]+n[e>>24&15]+n[i>>4&15]+n[15&i]+n[i>>12&15]+n[i>>8&15]+n[i>>20&15]+n[i>>16&15]+n[i>>28&15]+n[i>>24&15]},t.prototype.toString=t.prototype.hex,t.prototype.digest=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&i,i>>8&255,i>>16&255,i>>24&255]},t.prototype.array=t.prototype.digest,t.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),r=new Uint32Array(t);return r[0]=this.h0,r[1]=this.h1,r[2]=this.h2,r[3]=this.h3,t},t.prototype.buffer=t.prototype.arrayBuffer,t.prototype.base64=function(){for(var t,r,e,i="",s=this.array(),h=0;h<15;)t=s[h++],r=s[h++],e=s[h++],i+=p[t>>>2]+p[63&(t<<4|r>>>4)]+p[63&(r<<2|e>>>6)]+p[63&e];return t=s[h],i+=p[t>>>2]+p[t<<4&63]+"=="};var _=v();f?module.exports=_:(i.md5=_,o&&define(function(){return _}))}();
0 11 \ No newline at end of file
... ...
utils/request.js
1 1 var t = require("util.js");
  2 +var md5 = require("md5.min.js");
  3 +var setting = require("../setting.js");
  4 +var ut=t;
2 5  
3 6 module.exports = {
4 7 uniqueId: "",
... ... @@ -7,35 +10,59 @@ module.exports = {
7 10 // s: data
8 11 // a: header
9 12 request: function (e, i, o, delay = 1000) {
  13 +
  14 + var arr_in_url=t.getParams(i);
10 15 this.check_timeout(i, delay, () => {
11 16 var n = this, a = o.header ? o.header : {
12 17 "content-type": "application/x-www-form-urlencoded"
13 18 //"content-type": "application/texts"
14   - }, s = "GET" != (e = e.toUpperCase()) && o.data ? t.json2Form(o.data) : o.data;
15   - i = this.modifyUrl(i, o),
  19 + };
  20 +
  21 + //-- 获取一下token --
  22 + this.ck_api_token((api_tk)=>{
  23 +
  24 + console.log("--- api_tk ---");
  25 + var dd= t.deep_cp(o.data);
  26 + var new_data={...arr_in_url,...dd};
  27 +
  28 + var now=t.gettimestamp();
  29 + var tk=this.set_req_sign(new_data,i,now,api_tk);
  30 + if(tk){
  31 + a.reqtime=now;
  32 + a.token=tk;
  33 + a.ukey=api_tk.userkey
  34 + }
  35 +
  36 + var s = "GET" != (e = e.toUpperCase()) && o.data ? t.json2Form(o.data) : o.data;
  37 + i = this.modifyUrl(i, o),
16 38 o.isShowLoading && this.showLoading();
17   - var req = wx.request(Object.assign({}, o, {
18   - url: i,
19   - method: e,
20   - data: s,
21   - header: a,
22   - success: function (t) {
23   - o.isShowLoading && n.hideLoading(), n.doSuccess(o, t);
24   - },
25   - fail(err) {
26   - o.isShowLoading && n.hideLoading();
27   - if (err && err.errMsg && err.errMsg.indexOf('timeout') != -1) {
28   - getApp().globalData.fail_url.set(t.gettimestamp(), i);
29   - console.log('请求超时url---', getApp().globalData.fail_url);
30   - n.doTimeOut(o, t);
31   - } else {
32   - n.doFail(o, t);
  39 +
  40 + var req = wx.request(Object.assign({}, o, {
  41 + url: i,
  42 + method: e,
  43 + data: s,
  44 + header: a,
  45 + success: function (t) {
  46 + o.isShowLoading && n.hideLoading(), n.doSuccess(o, t);
  47 + },
  48 + fail(err) {
  49 + o.isShowLoading && n.hideLoading();
  50 + if (err && err.errMsg && err.errMsg.indexOf('timeout') != -1) {
  51 + getApp().globalData.fail_url.set(t.gettimestamp(), i);
  52 + console.log('请求超时url---', getApp().globalData.fail_url);
  53 + n.doTimeOut(o, t);
  54 + } else {
  55 + n.doFail(o, t);
  56 + }
33 57 }
34   - }
35   - }));
36   - return req;
  58 + }));
  59 + return req;
  60 + })
  61 +
  62 +
37 63 })
38 64 },
  65 +
39 66 get: function (t, e) {
40 67 console.log(t, e);
41 68 return this.request("GET", t, e);
... ... @@ -153,24 +180,41 @@ module.exports = {
153 180 });
154 181 },
155 182  
  183 +
156 184 request2: function (e, i, o) {
  185 +
157 186 var n = this, a = o.header ? o.header : {
158 187 "content-type": "application/x-www-form-urlencoded"
159 188 }, s = "GET" != (e = e.toUpperCase()) && o.data ? t.json2Form(o.data) : o.data;
160   - i = this.modifyUrl2(i, o), o.isShowLoading = void 0 === o.isShowLoading || o.isShowLoading,
161   - o.isShowLoading && this.showLoading(), console.log("app.request", i, o), wx.request(Object.assign({}, o, {
162   - url: i,
163   - method: e,
164   - data: s,
165   - header: a,
166   - success: function (t) {
167   - o.isShowLoading && n.hideLoading(), n.doSuccess2(o, t);
168   - },
169   - fail: function (t) {
170   - o.isShowLoading && n.hideLoading(), n.doFail(o, t);
  189 +
  190 + //-- 获取一下token --
  191 + this.ck_api_token((api_tk)=> {
  192 +
  193 + var dd= t.deep_cp(o.data);
  194 + var now=t.gettimestamp();
  195 + var tk=this.set_req_sign(dd,i,now,api_tk);
  196 + if(tk){
  197 + a.reqtime=now;
  198 + a.token=tk;
  199 + a.ukey=api_tk.userkey
171 200 }
172   - }));
  201 +
  202 + i = this.modifyUrl2(i, o), o.isShowLoading = void 0 === o.isShowLoading || o.isShowLoading,
  203 + o.isShowLoading && this.showLoading(), console.log("app.request", i, o), wx.request(Object.assign({}, o, {
  204 + url: i,
  205 + method: e,
  206 + data: s,
  207 + header: a,
  208 + success: function (t) {
  209 + o.isShowLoading && n.hideLoading(), n.doSuccess2(o, t);
  210 + },
  211 + fail: function (t) {
  212 + o.isShowLoading && n.hideLoading(), n.doFail(o, t);
  213 + }
  214 + }));
  215 + })
173 216 },
  217 +
174 218 get2: function (t, e) {
175 219 this.request2("GET", t, e);
176 220 },
... ... @@ -210,32 +254,107 @@ module.exports = {
210 254 typeof func === "function" && func()
211 255 },
212 256  
  257 +
213 258 //---promise的使用get----
214 259 promiseGet: function (url, data, delay = 10000) {
  260 +
  261 + var th = this;
  262 +
215 263 return new Promise((resolve, reject) => {
216 264 this.check_timeout(url, delay, () => {
217   - var th = this;
218   - if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
219   - data.isShowLoading && th.showLoading();
220   - wx.request({
221   - url,
222   - method: 'GET',
223   - header: { "content-type": "application/x-www-form-urlencoded" },
224   - data: data.data,
225   - success(res) {
226   - data.isShowLoading && th.hideLoading();
227   - resolve(res);
228   - },
229   - fail(err) {
230   - data.isShowLoading && th.hideLoading();
231   - if (err && err.errMsg && err.errMsg.indexOf('timeout') != -1) {
232   - getApp().globalData.fail_url.set(t.gettimestamp(), url);
233   - console.log('请求超时url---', getApp().globalData.fail_url);
234   - th.doTimeOut()
235   - }else{
236   - reject(err);
  265 + //-- 获取一下token --
  266 + this.ck_api_token((api_tk)=> {
  267 +
  268 + if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
  269 + data.isShowLoading && th.showLoading();
  270 +
  271 + var url1=url;
  272 + var arr_in_url=t.getParams(url1);
  273 +
  274 + var header={"content-type": "application/x-www-form-urlencoded"};
  275 + var now = t.gettimestamp();
  276 +
  277 + var new_data={...arr_in_url,...data.data};
  278 + var tk = this.set_req_sign(new_data, url1, now, api_tk);
  279 +
  280 + if (tk) {
  281 + header.reqtime = now;
  282 + header.token = tk;
  283 + header.ukey = api_tk.userkey
  284 + }
  285 +
  286 + wx.request({
  287 + url,
  288 + method: 'GET',
  289 + header: header,
  290 + data: data.data,
  291 + success(res) {
  292 + data.isShowLoading && th.hideLoading();
  293 + resolve(res);
  294 + },
  295 + fail(err) {
  296 + data.isShowLoading && th.hideLoading();
  297 + if (err && err.errMsg && err.errMsg.indexOf('timeout') != -1) {
  298 + getApp().globalData.fail_url.set(t.gettimestamp(), url);
  299 + console.log('请求超时url---', getApp().globalData.fail_url);
  300 + th.doTimeOut()
  301 + } else {
  302 + reject(err);
  303 + }
237 304 }
  305 + })
  306 +
  307 + })
  308 + })
  309 + })
  310 + },
  311 + //---promise的使用get----
  312 + promiseGetNodef: function (url, data, delay = 10000) {
  313 + var url1=url;
  314 + var arr_in_url=t.getParams(url1);
  315 + return new Promise((resolve, reject) => {
  316 + this.check_timeout(url, delay, () => {
  317 +
  318 + //-- 获取一下token --
  319 + this.ck_api_token((api_tk)=> {
  320 +
  321 + var th = this;
  322 + if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
  323 + data.isShowLoading && th.showLoading();
  324 +
  325 + var header = {"content-type": "application/x-www-form-urlencoded"};
  326 + var now = t.gettimestamp();
  327 +
  328 + var new_data={...arr_in_url,...data.data};
  329 + var tk = this.set_req_sign(new_data, url1, now, api_tk);
  330 +
  331 + if (tk) {
  332 + header.reqtime = now;
  333 + header.token = tk;
  334 + header.ukey = api_tk.userkey
238 335 }
  336 +
  337 + wx.request({
  338 + url,
  339 + method: 'GET',
  340 + header: header,
  341 + data: data.data,
  342 + success(res) {
  343 + data.isShowLoading && th.hideLoading();
  344 + resolve(res);
  345 + },
  346 + fail(err) {
  347 + data.isShowLoading && th.hideLoading();
  348 + if (err && err.errMsg && err.errMsg.indexOf('timeout') != -1) {
  349 + getApp().globalData.fail_url.set(t.gettimestamp(), url);
  350 + console.log('请求超时url---', getApp().globalData.fail_url);
  351 + th.doTimeOut()
  352 + } else {
  353 + reject(err);
  354 + }
  355 + }
  356 + })
  357 +
239 358 })
240 359 })
241 360 })
... ... @@ -244,47 +363,153 @@ module.exports = {
244 363 //---promise的使用post----
245 364 promisePost: function (url, data) {
246 365 var th = this;
  366 + var url1=url;
  367 +
  368 + var arr_in_url=t.getParams(url1);
  369 +
247 370 if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
248 371 var post_data = data.data;
249   - var header = { "content-type": "application/x-www-form-urlencoded" };
250   - if (data.is_json) {
251   - header = { 'content-type': 'application/json' };
252   - post_data = JSON.stringify(post_data);
253   - };
  372 +
254 373 return new Promise((resolve, reject) => {
255   - data.isShowLoading && th.showLoading();
256   - wx.request({
257   - url,
258   - method: 'POST',
259   - header: header,
260   - data: post_data,
261   - success(res) {
262   - data.isShowLoading && th.hideLoading();
263   - resolve(res);
264   - },
265   - fail(err) { data.isShowLoading && th.hideLoading(); reject(err); }
266   - })
  374 +
  375 + //-- 获取一下token --
  376 + this.ck_api_token((api_tk)=> {
  377 +
  378 + var header = { "content-type": "application/x-www-form-urlencoded" };
  379 + var now = t.gettimestamp();
  380 +
  381 + var new_data=null;
  382 + if(!Array.isArray(post_data)) {
  383 + //-- 拼接连接中带有的参数 --
  384 + new_data = {...arr_in_url, ...post_data};
  385 + }else{
  386 + new_data=post_data
  387 + }
  388 +
  389 + var tk = this.set_req_sign(new_data, url1, now, api_tk);
  390 +
  391 + if (data.is_json) {
  392 + header = { 'content-type': 'application/json' };
  393 + tk = this.set_req_sign(new_data, url1, now, api_tk,1);
  394 + post_data = JSON.stringify(post_data);
  395 + };
  396 +
  397 + if (tk) {
  398 + header.reqtime = now;
  399 + header.token = tk;
  400 + header.ukey = api_tk.userkey
  401 + }
  402 +
  403 + data.isShowLoading && th.showLoading();
  404 + wx.request({
  405 + url,
  406 + method: 'POST',
  407 + header: header,
  408 + data: post_data,
  409 + success(res) {
  410 + data.isShowLoading && th.hideLoading();
  411 + resolve(res);
  412 + },
  413 + fail(err) { data.isShowLoading && th.hideLoading(); reject(err); }
  414 + })
  415 + })
  416 +
  417 + })
  418 + },
  419 + //---promise的使用post----
  420 + promisePostNodef: function (url, data) {
  421 + var th = this;
  422 + var url1=url;
  423 + var arr_in_url=t.getParams(url1);
  424 +
  425 + if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
  426 +
  427 + return new Promise((resolve, reject) => {
  428 +
  429 + //-- 获取一下token --
  430 + this.ck_api_token((api_tk)=> {
  431 + var post_data = data.data;
  432 + var header = { "content-type": "application/x-www-form-urlencoded" };
  433 +
  434 + var now = t.gettimestamp();
  435 +
  436 + //-- 拼接连接中带有的参数 --
  437 + var new_data={...arr_in_url,...post_data};
  438 +
  439 + var tk = this.set_req_sign(new_data, url1, now, api_tk);
  440 +
  441 + if (data.is_json) {
  442 + header = { 'content-type': 'application/json' };
  443 + tk = this.set_req_sign(new_data, url1, now, api_tk,1);
  444 + post_data = JSON.stringify(post_data);
  445 + };
  446 +
  447 + if (tk) {
  448 + header.reqtime = now;
  449 + header.token = tk;
  450 + header.ukey = api_tk.userkey
  451 + }
  452 +
  453 + data.isShowLoading && th.showLoading();
  454 + wx.request({
  455 + url,
  456 + method: 'POST',
  457 + header: header,
  458 + data: post_data,
  459 + success(res) {
  460 + data.isShowLoading && th.hideLoading();
  461 + resolve(res);
  462 + },
  463 + fail(err) { data.isShowLoading && th.hideLoading(); reject(err); }
  464 + })
  465 + })
  466 +
267 467 })
268 468 },
269 469  
270 470 //---promise的使用delete----
271 471 promiseDelete: function (url, data) {
272 472 var th = this;
273   - if(!data) data={};
  473 + var url1=url;
  474 + var arr_in_url=t.getParams(url1);
  475 +
  476 +
274 477 if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
275 478 return new Promise((resolve, reject) => {
276   - data && data.isShowLoading && th.showLoading();
277   - wx.request({
278   - url,
279   - method: 'DELETE',
280   - header: { "content-type": "application/x-www-form-urlencoded" },
281   - data: data.data,
282   - success(res) {
283   - data && data.isShowLoading && th.hideLoading();
284   - resolve(res);
285   - },
286   - fail(err) { data.isShowLoading && th.hideLoading(); reject(err); }
287   - })
  479 + data.isShowLoading && th.showLoading();
  480 +
  481 + //-- 获取一下token --
  482 + this.ck_api_token((api_tk)=> {
  483 +
  484 + var header={"content-type": "application/x-www-form-urlencoded"};
  485 + var now = t.gettimestamp();
  486 +
  487 + //-- 拼接连接中带有的参数 --
  488 + var new_data={...arr_in_url,...data.data};
  489 +
  490 + var tk = this.set_req_sign(new_data, url1, now, api_tk);
  491 + if (tk) {
  492 + header.reqtime = now;
  493 + header.token = tk;
  494 + header.ukey = api_tk.userkey
  495 + }
  496 +
  497 + wx.request({
  498 + url,
  499 + method: 'DELETE',
  500 + header: header,
  501 + data: data.data,
  502 + success(res) {
  503 + data.isShowLoading && th.hideLoading();
  504 + resolve(res);
  505 + },
  506 + fail(err) {
  507 + data.isShowLoading && th.hideLoading();
  508 + reject(err);
  509 + }
  510 + })
  511 +
  512 + })
288 513 })
289 514 },
290 515  
... ... @@ -292,27 +517,58 @@ module.exports = {
292 517 //---promise的使用put----
293 518 promisePut: function (url, data) {
294 519 var th = this;
  520 + var url1=url;
  521 +
  522 + var arr_in_url=t.getParams(url1);
  523 +
295 524 if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
296 525 var post_data = data.data;
297   - var header = { "content-type": "application/x-www-form-urlencoded" };
298   - if (data.is_json) {
299   - header = { 'content-type': 'application/json' };
300   - post_data = JSON.stringify(post_data);
301   - };
302   - return new Promise((resolve, reject) => {
303   - data.isShowLoading && th.showLoading();
304   - wx.request({
305   - url,
306   - method: 'PUT',
307   - header: header,
308   - data: post_data,
309   - success(res) {
310   - data.isShowLoading && th.hideLoading();
311   - resolve(res);
312   - },
313   - fail(err) { data.isShowLoading && th.hideLoading(); reject(err); }
314   - })
315   - })
  526 +
  527 +
  528 + var y_post_data=t.deep_cp(post_data);
  529 + if(!Array.isArray(post_data)) {
  530 + y_post_data = {...arr_in_url, ...y_post_data};
  531 + }
  532 +
  533 + return new Promise((resolve, reject) => {
  534 +
  535 + //-- 获取一下token --
  536 + this.ck_api_token((api_tk)=> {
  537 +
  538 + var header = {"content-type": "application/x-www-form-urlencoded"};
  539 + var now = t.gettimestamp();
  540 + var tk = this.set_req_sign(y_post_data, url1, now, api_tk);
  541 +
  542 + if (data.is_json) {
  543 + header = {'content-type': 'application/json'};
  544 + tk = this.set_req_sign(y_post_data, url1, now, api_tk, 1);
  545 + post_data = JSON.stringify(post_data);
  546 + }
  547 +
  548 + if (tk) {
  549 + header.reqtime = now;
  550 + header.token = tk;
  551 + header.ukey = api_tk.userkey
  552 + }
  553 +
  554 + data.isShowLoading && th.showLoading();
  555 + wx.request({
  556 + url,
  557 + method: 'PUT',
  558 + header: header,
  559 + data: post_data,
  560 + success(res) {
  561 + data.isShowLoading && th.hideLoading();
  562 + resolve(res);
  563 + },
  564 + fail(err) {
  565 + data.isShowLoading && th.hideLoading();
  566 + reject(err);
  567 + }
  568 + })
  569 + })
  570 + })
  571 +
316 572 },
317 573  
318 574 //--------具有时间限制的读取接口----------
... ... @@ -333,21 +589,51 @@ module.exports = {
333 589 var th = this;
334 590 var Mathod = "POST";
335 591  
  592 + var url1=url;
  593 + var arr_in_url=t.getParams(url1);
  594 +
336 595 if (mathod) Mathod = mathod;
337 596 this.showLoading();
338 597 if (url.indexOf("http") == -1) url = getApp().globalData.setting.url + url;
339   - var str = JSON.stringify(data);
340   - wx.request({
341   - url: url,
342   - data: str,
343   - method: Mathod,
344   - header: {
  598 +
  599 + //-- 获取一下token --
  600 + this.ck_api_token((api_tk)=> {
  601 +
  602 + var header={
345 603 'content-type': 'application/json'
346   - },// 设置请求的 header
347   - success: function (res) { succ(res); th.hideLoading(); },
348   - fail: function (res) { fail(res); }
  604 + };
  605 +
  606 + var dd= t.deep_cp(data);
  607 + if(!Array.isArray(data)) {
  608 + dd = {...arr_in_url, ...dd};
  609 + }
  610 +
  611 + var now=t.gettimestamp();
  612 + var tk=this.set_req_sign(dd,url1,now,api_tk,1);
  613 + if(tk){
  614 + header.reqtime=now;
  615 + header.token=tk;
  616 + header.ukey=api_tk.userkey
  617 + }
  618 +
  619 + var str = JSON.stringify(data);
  620 + wx.request({
  621 + url: url,
  622 + data: str,
  623 + method: Mathod,
  624 + header: header,// 设置请求的 header
  625 + success: function (res) {
  626 + succ(res);
  627 + th.hideLoading();
  628 + },
  629 + fail: function (res) {
  630 + fail(res);
  631 + }
  632 + })
349 633 })
350 634 },
  635 +
  636 +
351 637  
352 638 promise_downimg(url) {
353 639 return new Promise((resolve, reject) => {
... ... @@ -362,6 +648,78 @@ module.exports = {
362 648 }
363 649 });
364 650 })
  651 + },
  652 +
  653 + //判断有没有获取到api_token
  654 + ck_api_token(func){
  655 + var api_token = wx.getStorageSync('api_token');
  656 + var api_token_time = wx.getStorageSync('api_token_time');
  657 + //token有存在本地的时候
  658 + if(api_token){
  659 + //判断有没有超出token的时间,超出的话就要重头拿token
  660 + var now=t.formar_day();
  661 + if(now!=api_token_time){
  662 + //调用接口获取token
  663 + getApp().get_api_token(func);
  664 + return false;
  665 + }
  666 + func(api_token);
  667 + return false;
  668 + }
  669 + getApp().get_api_token(func);
  670 + },
  671 +
  672 + //接口加密过程
  673 + set_req_sign(data,url,now,api_tk,is_json){
  674 + if(!url) return '';
  675 + var name2=url.split('?')[0];
  676 + if(!name2) return '';
  677 +
  678 + //确保不要有前缀
  679 + name2=name2.replace(setting.url,'')
  680 +
  681 + if(!now) now=t.gettimestamp();
  682 + if(!api_tk){
  683 + api_tk=wx.getStorageSync('api_token');
  684 + }
  685 + var userkey = api_tk;
  686 + var token2="";
  687 +
  688 + if(data && Object.keys(data).length>0) {
  689 +
  690 + for(var i in data){
  691 + var item=data[i];
  692 + if (typeof item === 'string') {
  693 + try {
  694 + data[i]=decodeURIComponent(item); //urldecode
  695 + }catch (err) {
  696 +
  697 + }
  698 + }
  699 + }
  700 +
  701 + var req4 ='';
  702 + if(is_json){
  703 + req4 = JSON.stringify(data);
  704 + }else {
  705 + // 自定义序列化函数
  706 + function stringifyReplacer(key, value) {
  707 + if (typeof value === 'number') {
  708 + return String(value);
  709 + }
  710 + return value;
  711 + }
  712 + req4 = JSON.stringify(data, stringifyReplacer);
  713 + }
  714 + //console.log(req4+':---token0');
  715 + token2 = md5(req4).toUpperCase();
  716 + //console.log(name2+':---token1:'+token2);
  717 + }
  718 + var str=name2.toUpperCase()+token2+now+userkey.token+setting.environment_key;
  719 + //console.log('---tk_str:'+str);
  720 + var tk = md5(str).toUpperCase();
  721 + return tk;
365 722 }
366 723  
  724 +
367 725 };
368 726 \ No newline at end of file
... ...
utils/util.js
... ... @@ -633,6 +633,18 @@ module.exports = {
633 633 return t.getFullYear() +c+(t.getMonth() + 1)+c+t.getDate();
634 634 },
635 635  
  636 + formar_day(e,char){
  637 + var t= new Date();
  638 + if(e) t=new Date(1e3 * e);
  639 +
  640 + var c="-";
  641 + if(char) c=char;
  642 + var ck=function (e){
  643 + return e>=10? e : "0" + e;
  644 + }
  645 + return t.getFullYear() +c+ck(t.getMonth() + 1)+c+ck(t.getDate());
  646 + },
  647 +
636 648 json2Form: function(e) {
637 649 var r = [];
638 650 for (var t in e) r.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
... ... @@ -1019,5 +1031,16 @@ module.exports = {
1019 1031 //判断e是不是对象类型
1020 1032 var new_e = JSON.parse(JSON.stringify(e));
1021 1033 return new_e;
  1034 + },
  1035 + getParams(url) {
  1036 + const search = url.split('?')[1];
  1037 + if (!search) return {};
  1038 + const paramArr = search.split('&');
  1039 + const paramObj = {};
  1040 + for (const param of paramArr) {
  1041 + const [key, value] = param.split('=');
  1042 + paramObj[key] = value;
  1043 + }
  1044 + return paramObj;
1022 1045 }
1023 1046 };
... ...