Blame view

common/common.js 9.87 KB
4b045f7c   刘淇   江阴初始化项目
1
  import md5 from './md5.min.js';
4b045f7c   刘淇   江阴初始化项目
2
  // 江阴正式环境
a12e0302   chenbiao   add 8月需求
3
  var serverUrl = "https://bus.jycrtc.com";
9d632cab   刘淇   购买卡券接口添加plNo参数
4
  // 测试 http://221.228.70.87:8096      正式 https://bus.jycrtc.com
81028275   刘淇   发票
5
  var serverPayUrl = ''
83c49479   chenbiao   add 7月需求
6
7
  // 测试环境
  // var serverUrl = "http://test.jycrtc.com:8096";
2f02d40c   chenbiao   add 登录页面数据接口联调
8
  //江阴微信小程序appid
1cea5358   刘淇   停车记录详情
9
  const hs_wxPay_appId = 'wxfdc1af620d3ab750';
2f02d40c   chenbiao   add 登录页面数据接口联调
10
11
  //  江阴慧停车orgId
  const public_orgId = '10107';
b42d4437   chenbiao   add 公共js信息更新
12
  const appName = '江阴慧停车';
f47264fa   chenbiao   add 8月需求
13
  const ACompany = '©江阴慧停车管理有限公司';
4b045f7c   刘淇   江阴初始化项目
14
  const BCompany = '由中兴智能交通股份有限公司提供技术支持';
4b045f7c   刘淇   江阴初始化项目
15
  const appVerson = '1.0.0';
4b045f7c   刘淇   江阴初始化项目
16
  const SetToken = uni.getStorageSync("globalUser").token;
999ea060   刘淇   我的钱包 充值
17
18
19
20
  // const SetToken = 'e2c1e43722dd43a5b7e268001b39e6f0';
  
  
  
4b045f7c   刘淇   江阴初始化项目
21
22
  // ----江阴项目 接口----
  //  商户登录
2f02d40c   chenbiao   add 登录页面数据接口联调
23
  const userLogin = serverUrl + "/business/h5/index/login";
e1beceff   刘淇   二维码保存图片
24
25
26
27
  //  修改密码
  const changePassword = serverUrl + "/business/h5/index/changePassword";
  
  
f7e9351e   chenbiao   add 接口文档更新
28
29
  //  获取已登录商户用户信息
  const indexInfo = serverUrl + "/business/h5/index/info";
4b045f7c   刘淇   江阴初始化项目
30
  //  商户退出登录
2f02d40c   chenbiao   add 登录页面数据接口联调
31
  const userLoginout = serverUrl + "/business/h5/index/logout";
4b045f7c   刘淇   江阴初始化项目
32
  //  商户关于我们
2f02d40c   chenbiao   add 登录页面数据接口联调
33
  const useraboutUs = serverUrl + "/business/h5/index/aboutUs";
93c5ecb3   chenbiao   add 添加filter.js 设...
34
35
  //  商户账户余额信息
  const walletAccount = serverUrl + "/business/h5/wallet/account";
b398dc4a   chenbiao   add 我的钱包 接口联调
36
37
  //  商户充值金额列表
  const rechargeList = serverUrl + "/business/h5/wallet/rechargeList";
d9f79954   刘淇   停车记录
38
39
  //  通过商户ID查询停车记录信息
  const getBusinessParkOrderByBusIdForPage = serverUrl + "/business/h5/order/getBusinessParkOrderByBusIdForPage";
d9f79954   刘淇   停车记录
40
41
  //  通过商户ID查询停车记录信息
  const getPayOrderByOrderId = serverUrl + "/business/h5/order/getPayOrderByOrderId";
1cea5358   刘淇   停车记录详情
42
43
  //刘淇接口
  
0b9d5f71   刘淇   停车记录详情
44
  //   商户卡券-可以购买卡券列表-分页
510601e4   刘淇   商户卡券
45
  const couponRuleParkPage = serverUrl + "/business/h5/coupon/couponRuleParkPage";
78e17486   刘淇   商户券明细
46
47
  //   商户卡券-卡券申领明细
  const couponIssuedParkPage = serverUrl + "/business/h5/couponIssued/couponIssuedParkPage";
75b91c08   刘淇   卡券发放
48
49
  //   商户卡券-卡券发放-生成领券的动态码
  const getCouponDynamicQR = serverUrl + "/business/h5/couponsend/getCouponDynamicQR";
9bac797d   刘淇   卡券发放
50
51
52
53
  //   商户卡券-卡券发放-生成领券的静态码下载地址
  const getCouponStaticQR = serverUrl + "/business/h5/couponsend/getCouponStaticQR";
  //   卡券申领明细总览
  const couponDetailSummary = serverUrl + "/business/h5/couponIssued/couponDetailSummary";
78e17486   刘淇   商户券明细
54
  
904a46e0   刘淇   卡券购买下单
55
56
57
58
59
  //   商户卡券-卡券下单
  const createCouponOrder = serverUrl + "/business/h5/coupon/createCouponOrder";
  //   商户卡券-使用余额购买
  const accountPay = serverUrl + "/business/h5/pay/busAccount/accountPay";
  
81028275   刘淇   发票
60
61
62
63
64
65
66
67
  // 获取发票抬头列表
  const queryCustInvoiceInfoList = serverUrl + "/business/h5/pay/invoice/queryCustInvoiceInfoList";
  // 新增一条客户发票抬头信息
  const insertCustInvoiceInfo = serverUrl + "/business/h5/pay/invoice/insertCustInvoiceInfo";
  // 通过主键更新一条客户发票抬头信息
  const updateCustInvoiceInfo = serverUrl + "/business/h5/pay/invoice/updateCustInvoiceInfo";
  // 删除一条客户发票抬头信息
  const deleteCustInvoiceInfoByID = serverUrl + "/business/h5/pay/invoice/deleteCustInvoiceInfoByID";
904a46e0   刘淇   卡券购买下单
68
  
81028275   刘淇   发票
69
70
71
72
73
74
75
76
77
78
79
  // 获取开票订单列表
  const queryRntPayOrderForInvoice = serverUrl + "/business/h5/pay/invoice/queryRntPayOrderForInvoice";
  
  //  记录客户开发票历史信息及开票历史详情信息
  const openTicketForCustInvoiceHisInfo = serverUrl + "/business/h5/pay/invoice/openTicketForCustInvoiceHisInfo";
  
  //  查询客户所有发票历史
  const queryCustInvoiceHistoryList = serverUrl + "/business/h5/pay/invoice/queryCustInvoiceHistoryList";
  
  //  重发邮件
  const resendInvoiceMail = serverUrl + "/business/h5/pay/invoice/resendInvoiceMail";
904a46e0   刘淇   卡券购买下单
80
81
  
  
78e17486   刘淇   商户券明细
82
  
1cea5358   刘淇   停车记录详情
83
  //陈彪接口
4b045f7c   刘淇   江阴初始化项目
84
  
00a21ab7   chenbiao   add 余额明细 接口联调
85
86
87
88
89
90
91
92
93
94
95
96
  //  余额明细下拉框选择列表
  const walletKindType = serverUrl + "/business/h5/wallet/kindType";
  
  //  余额明细总览
  const detailSummary = serverUrl + "/business/h5/wallet/detailSummary";
  
  //  余额明细-分页
  const walletDetailsPage = serverUrl + "/business/h5/wallet/detailsPage";
  
  // 钱包充值-微信
  const publicUnifiedOrder = serverUrl + "/business/h5/pay/weixinpay/publicUnifiedOrder";
  
83c49479   chenbiao   add 7月需求
97
98
99
  // 根据商户支出停车费订单ID获取订单信息
  const getParkingInfoByOrderId = serverUrl + "/business/h5/wallet/detail/getParkingInfoByOrderId";
  
2e99af66   chenbiao   add 账单详情 接口联调
100
101
  // 钱包-根据订单ID获取购买优惠券信息
  const couponInfo = serverUrl + "/business/h5/wallet/detail/couponInfo";
07fee088   chenbiao   add 停车缴费支付订单页面 接口联调
102
  // 根据车牌号查询车牌号订单支付详情
ed34839c   chenbiao   add 停车缴费 支付页面 接口联调
103
  const queryParkingRecordByCarNumbers ="https://pay.jycrtc.com/queryParkOrder/queryParkingRecordPageByCarNumbersForBusiness";
83c49479   chenbiao   add 7月需求
104
105
106
107
  // 根据商户支出 购买卡券订单ID获取订单信息
  const getOpenIdByCode = "https://pay.jycrtc.com/weixinPublicPay/getSmallRoutineOpenIdByCode" 
  // 停车记录明细总览
  const parkingCouponSummary = serverUrl +"/business/h5/order/parkingCouponSummary"
1cea5358   刘淇   停车记录详情
108
109
  
  const requestSign = function (inputData) {
0206229e   刘淇   登陆
110
  	var jsonList = inputData || {};
b6d85d2d   chenbiao   Merge remote-trac...
111
  	jsonList.orgId = public_orgId;
2f02d40c   chenbiao   add 登录页面数据接口联调
112
113
114
115
  	jsonList.sign_type = "md5";
  	jsonList.app_id = "0eca8f5373ca4866aec2f8e9d9367104";
  	jsonList.deviceInfo = "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E";
  	jsonList.salt = getSalt();
08e0d9c8   刘淇   卡券购买回到上一页面刷新页面
116
  	jsonList.terminalSource = "16";
752e0b8b   刘淇   登陆
117
  	// jsonList.token = getGlobalUser("globalUser").token;
78dcf61c   chenbiao   add 删除无用图片 代码
118
119
  	jsonList.token = getGlobalUser("globalUser").token;
  	// jsonList.token = 'e2c1e43722dd43a5b7e268001b39e6f0';
4b045f7c   刘淇   江阴初始化项目
120
  	var arrData = [];
2f02d40c   chenbiao   add 登录页面数据接口联调
121
  	for (var key in jsonList) {
4b045f7c   刘淇   江阴初始化项目
122
  		var obj = {};
2f02d40c   chenbiao   add 登录页面数据接口联调
123
124
125
126
127
128
  		// console.log("key = "+key);
  		// // obj[key] =jsonList[key];
  		obj.keyname = key;
  		obj.value = jsonList[key];
  		// console.log(obj);
  		arrData.push(obj);
4b045f7c   刘淇   江阴初始化项目
129
  	}
2f02d40c   chenbiao   add 登录页面数据接口联调
130
131
132
  	var sign = getSign(arrData);
  	jsonList.sign = sign;
  	return jsonList;
1cea5358   刘淇   停车记录详情
133
  }
4b045f7c   刘淇   江阴初始化项目
134
  //获取sign
1cea5358   刘淇   停车记录详情
135
  var getSign = function (objb) {
b6bde291   chenbiao   Merge remote-trac...
136
  	var compare = function (obj1, obj2) {
2f02d40c   chenbiao   add 登录页面数据接口联调
137
138
139
140
141
142
143
144
145
  		var val1 = obj1.keyname;
  		var val2 = obj2.keyname;
  		if (val1 < val2) {
  			return -1;
  		} else if (val1 > val2) {
  			return 1;
  		} else {
  			return 0;
  		}
4b045f7c   刘淇   江阴初始化项目
146
147
148
  	}
  	objb.sort(compare);
  	var strmd5 = '14318527b13840c2a4af63fef52c2d6e';
2f02d40c   chenbiao   add 登录页面数据接口联调
149
150
151
152
  	for (var i = 0; i < objb.length; i++) {
  		if (objb[i].value != null && objb[i].value != '') {
  			strmd5 += objb[i].keyname + objb[i].value;
  		}
4b045f7c   刘淇   江阴初始化项目
153
154
  	}
  	strmd5 += '14318527b13840c2a4af63fef52c2d6e';
2f02d40c   chenbiao   add 登录页面数据接口联调
155
  	// console.log('strmd5-------->'+strmd5);
4b045f7c   刘淇   江阴初始化项目
156
  	strmd5 = md5(strmd5);
2f02d40c   chenbiao   add 登录页面数据接口联调
157
  	strmd5 = strmd5.toUpperCase();
4b045f7c   刘淇   江阴初始化项目
158
  	return strmd5;
4b045f7c   刘淇   江阴初始化项目
159
  }
4b045f7c   刘淇   江阴初始化项目
160
  //获取盐值
1cea5358   刘淇   停车记录详情
161
  var getSalt = function () {
2f02d40c   chenbiao   add 登录页面数据接口联调
162
  	var len = parseInt(32);
4b045f7c   刘淇   江阴初始化项目
163
164
165
  	var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
  	var maxPos = $chars.length;
  	var pwd = '';
2f02d40c   chenbiao   add 登录页面数据接口联调
166
167
168
  	for (var i = 0; i < len; i++) {
  		pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
  	}
4b045f7c   刘淇   江阴初始化项目
169
  	// console.log(pwd);
2f02d40c   chenbiao   add 登录页面数据接口联调
170
  	return pwd;
4b045f7c   刘淇   江阴初始化项目
171
  }
1cea5358   刘淇   停车记录详情
172
  var getGlobalUser = function (key) {
4b045f7c   刘淇   江阴初始化项目
173
174
175
176
177
178
  	var userInfo = uni.getStorageSync("globalUser");
  	if (userInfo != null && userInfo != "" && userInfo != undefined) {
  		return userInfo;
  	} else {
  		return '';
  	}
4b045f7c   刘淇   江阴初始化项目
179
  }
16cff37f   刘淇   停车记录
180
181
  // 除了金额
  var moneyFormat = function (val) {
e357dabe   刘淇   商户券 有效期
182
183
184
185
186
187
  	if(val){
      return (val / 100).toFixed(2)
  	}else{
  		return '-'
  	}
  
16cff37f   刘淇   停车记录
188
  }
51f091d6   刘淇   停车记录详情
189
  var dateFormat = function (msd) {  // 时间转换
b6bde291   chenbiao   Merge remote-trac...
190
  	var time =msd
d6331720   刘淇   停车记录详情
191
  
00a21ab7   chenbiao   add 余额明细 接口联调
192
  	if (null != time && "" != time) {
00a21ab7   chenbiao   add 余额明细 接口联调
193
  		if (time > 60 && time < 60 * 60) {
00a21ab7   chenbiao   add 余额明细 接口联调
194
  			time = parseInt(time / 60.0) + "分钟" + parseInt((parseFloat(time / 60.0) -
d6331720   刘淇   停车记录详情
195
  
00a21ab7   chenbiao   add 余额明细 接口联调
196
  				parseInt(time / 60.0)) * 60) + "秒";
d6331720   刘淇   停车记录详情
197
  
b6bde291   chenbiao   Merge remote-trac...
198
  		}
d6331720   刘淇   停车记录详情
199
  
b6bde291   chenbiao   Merge remote-trac...
200
  		else if (time >= 60 * 60 && time < 60 * 60 * 24) {
00a21ab7   chenbiao   add 余额明细 接口联调
201
  			time = parseInt(time / 3600.0) + "小时" + parseInt((parseFloat(time / 3600.0) -
d6331720   刘淇   停车记录详情
202
  
b6bde291   chenbiao   Merge remote-trac...
203
  				parseInt(time / 3600.0)) * 60) + "分钟" +
d6331720   刘淇   停车记录详情
204
  
00a21ab7   chenbiao   add 余额明细 接口联调
205
  				parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) -
d6331720   刘淇   停车记录详情
206
  
00a21ab7   chenbiao   add 余额明细 接口联调
207
  					parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒";
d6331720   刘淇   停车记录详情
208
  
00a21ab7   chenbiao   add 余额明细 接口联调
209
  		} else if (time >= 60 * 60 * 24) {
b6bde291   chenbiao   Merge remote-trac...
210
  			time = parseInt(time / 3600.0/24) + "天" +parseInt((parseFloat(time / 3600.0/24)-
d6331720   刘淇   停车记录详情
211
  
b6bde291   chenbiao   Merge remote-trac...
212
  				parseInt(time / 3600.0/24))*24) + "小时" + parseInt((parseFloat(time / 3600.0) -
d6331720   刘淇   停车记录详情
213
  
b6bde291   chenbiao   Merge remote-trac...
214
  				parseInt(time / 3600.0)) * 60) + "分钟" +
d6331720   刘淇   停车记录详情
215
  
00a21ab7   chenbiao   add 余额明细 接口联调
216
  				parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) -
d6331720   刘淇   停车记录详情
217
  
00a21ab7   chenbiao   add 余额明细 接口联调
218
  					parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒";
d6331720   刘淇   停车记录详情
219
  
b6bde291   chenbiao   Merge remote-trac...
220
  		}
d6331720   刘淇   停车记录详情
221
  
b6bde291   chenbiao   Merge remote-trac...
222
  		else {
00a21ab7   chenbiao   add 余额明细 接口联调
223
  			time = parseInt(time) + "秒";
d6331720   刘淇   停车记录详情
224
  
00a21ab7   chenbiao   add 余额明细 接口联调
225
  		}
d6331720   刘淇   停车记录详情
226
  
00a21ab7   chenbiao   add 余额明细 接口联调
227
  	}
00a21ab7   chenbiao   add 余额明细 接口联调
228
  	return time;
51f091d6   刘淇   停车记录详情
229
  }
4a929260   刘淇   商户券明细
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
  
  var cardTypeFormat =  function(num){
    if(num == '1'){
      return '单次券'
    }
    if(num == 2){
      return '时长券'
    }
    if(num == 3){
      return '满减券'
    }
    if(num == 4){
      return '金额券'
    }
    if(num == 5){
      return '包天券'
    }
    if(num == 6){
      return '折扣券'
    }
  }
81028275   刘淇   发票
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
  
  var formatDate = function(dataStr) {
    var time = new Date(dataStr);
  
    function timeAdd0(str) {
  
      if (str < 10) {
  
        str = '0' + str;
  
      }
  
      return str
  
    }
  
    var y = time.getFullYear();
  
    var m = time.getMonth() + 1;
  
    var d = time.getDate();
  
    var h = time.getHours();
  
    var mm = time.getMinutes();
  
    var s = time.getSeconds();
  
    return y + '-' + timeAdd0(m) + '-' + timeAdd0(d) + ' '
  
      + timeAdd0(h) + ':' + timeAdd0(mm) + ':' + timeAdd0(s);
  
  
  };
2f02d40c   chenbiao   add 登录页面数据接口联调
285
  export default {
4b045f7c   刘淇   江阴初始化项目
286
  	// deviceInfo,
81028275   刘淇   发票
287
    formatDate,
4b045f7c   刘淇   江阴初始化项目
288
289
290
291
292
  	hs_wxPay_appId,
  	public_orgId,
  	appName,
  	ACompany,
  	BCompany,
2f02d40c   chenbiao   add 登录页面数据接口联调
293
  	appVerson,
4b045f7c   刘淇   江阴初始化项目
294
  	SetToken,
4b045f7c   刘淇   江阴初始化项目
295
  	requestSign,
b6d85d2d   chenbiao   Merge remote-trac...
296
  	moneyFormat,
b6bde291   chenbiao   Merge remote-trac...
297
  	dateFormat,
4a929260   刘淇   商户券明细
298
    cardTypeFormat,
2f02d40c   chenbiao   add 登录页面数据接口联调
299
  	// 接口
4b045f7c   刘淇   江阴初始化项目
300
  	userLogin,
f7e9351e   chenbiao   add 接口文档更新
301
  	indexInfo,
4b045f7c   刘淇   江阴初始化项目
302
303
  	userLoginout,
  	useraboutUs,
93c5ecb3   chenbiao   add 添加filter.js 设...
304
  	walletAccount,
b6d85d2d   chenbiao   Merge remote-trac...
305
306
307
  	//刘淇接口
  	getBusinessParkOrderByBusIdForPage,
  	getPayOrderByOrderId,
510601e4   刘淇   商户卡券
308
    couponRuleParkPage,
78e17486   刘淇   商户券明细
309
    couponIssuedParkPage,
75b91c08   刘淇   卡券发放
310
    getCouponDynamicQR,
9bac797d   刘淇   卡券发放
311
312
    getCouponStaticQR,
    couponDetailSummary,
904a46e0   刘淇   卡券购买下单
313
314
315
    createCouponOrder,
    accountPay,
  
9bac797d   刘淇   卡券发放
316
  
81028275   刘淇   发票
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
    // 获取发票抬头列表
    queryCustInvoiceInfoList,
    //  新增一条客户发票抬头信息
    insertCustInvoiceInfo,
    //  通过主键更新一条客户发票抬头信息
    updateCustInvoiceInfo,
    // 删除一条客户发票抬头信息
    deleteCustInvoiceInfoByID,
    // 获取开票订单列表
    queryRntPayOrderForInvoice,
    //  记录客户开发票历史信息及开票历史详情信息
    openTicketForCustInvoiceHisInfo,
    //  查询客户所有发票历史
    queryCustInvoiceHistoryList,
    //  重发邮件
    resendInvoiceMail,
e1beceff   刘淇   二维码保存图片
333
  	//   修改密码
81028275   刘淇   发票
334
  
e1beceff   刘淇   二维码保存图片
335
    changePassword,
b6d85d2d   chenbiao   Merge remote-trac...
336
  	//陈彪接口
b398dc4a   chenbiao   add 我的钱包 接口联调
337
  	rechargeList,
00a21ab7   chenbiao   add 余额明细 接口联调
338
339
340
341
  	walletKindType,
  	detailSummary,
  	walletDetailsPage,
  	publicUnifiedOrder,
2e99af66   chenbiao   add 账单详情 接口联调
342
  	couponInfo,
ed34839c   chenbiao   add 停车缴费 支付页面 接口联调
343
  	queryParkingRecordByCarNumbers,
e7895736   chenbiao   add 支付 接口联调
344
  	getOpenIdByCode,
83c49479   chenbiao   add 7月需求
345
346
  	getParkingInfoByOrderId,
  	parkingCouponSummary,
4b045f7c   刘淇   江阴初始化项目
347
  }