123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- import request from '../utils/request.js'
- class Integralinfo extends request {
-
- // static INT_URL = 'http://118.31.106.139:8022/'
- static INT_URL = 'https://api.imedicalmall.com/'
- /**
- * POST类型的网络请求
- */
- static postRequest(url, data, notUseLoading, catchErrorFunc) {
- let headerSign = this.getSignHead();
- return this.requestAll(url, data, headerSign, 'POST', notUseLoading, catchErrorFunc)
- }
- static requestAll(url, data, header, method, notUseLoading, catchErrorFunc) {
- if (!notUseLoading) {
- getApp().showLoading()
- }
- return new Promise((resolve, reject) => {
- wx.request({
- url: url,
- data: data,
- header: header,
- method: method,
- success: (res => {
- if (res?.data.code === "0000") {
- //200: 服务端业务处理正常结束
- resolve(res?.data)
- } else {
- if (catchErrorFunc) {
- if (isFunc(catchErrorFunc)) {
- catchErrorFunc(res?.data)
- }
- } else {
- // console.log(res?.data?.msg);
- if(res?.data?.msg != undefined && typeof(res?.data?.msg)=='string') {
- wx.showToast({
- title: res?.data?.msg,
- icon: "none"
- })
- }
-
- }
- //其它错误,提示用户错误信息
- if (this._errorHandler != null) {
- //如果有统一的异常处理,就先调用统一异常处理函数对异常进行处理
- this._errorHandler(res)
- }
-
- reject(res)
- }
- }),
- fail: (res => {
- if (this._errorHandler != null) {
- this._errorHandler(res)
- }
- wx.showToast({
- title: '网络异常请稍后',
- })
- reject(res)
- }),
- complete: _ => {
- getApp().hideLoading()
- }
- })
- })
- }
- /**
- * 获取轮播图
- */
- static getBannerList(params) {
- return this.postRequest(`${this.INT_URL}app/banner/list`, params);
- }
- /**
- * 获取优惠券列表
- */
- static getList(params) {
- return this.postRequest(`${this.INT_URL}app/coupon/list`, params);
- }
- /**
- * 获取移动积分
- */
- static getBalance(params) {
- return this.postRequest(`${this.INT_URL}app/cmcc/balance`, params);
- }
- /**
- * 下单
- */
- static getOrder(params) {
- return this.postRequest(`${this.INT_URL}/app/order/order`, params);
- }
- /**
- * 一次验证码的支付
- */
- static getPayOnce(params) {
- return this.postRequest(`${this.INT_URL}/app/order/payOnce`, params);
- }
- /**
- * 移动积分扣减
- */
- static getExchange(params) {
- return this.postRequest(`${this.INT_URL}/app/order/exchange`, params);
- }
- /**
- * 支付短信验证码
- */
- static getPaySend(params) {
- return this.postRequest(`${this.INT_URL}/app/order/paySend`, params);
- }
- /**
- * 重新下发移动短信
- */
- static getSendCmccSms(params) {
- return this.postRequest(`${this.INT_URL}/app/order/sendCmccSms`, params);
- }
- /**
- * 我的兑换
- */
- static getOrderList(params) {
- return this.postRequest(`${this.INT_URL}/app/order/list`, params);
- }
- /**
- * 创建订单
- */
- static createOrder(mobile,activityId,num,shopId="", refStatisticsPostParam) {
- refStatisticsPostParam = refStatisticsPostParam || {}
- let params = {
- activityId:activityId,
- memberMobile:mobile,
- num:num,
- shopId:shopId,
- scene: refStatisticsPostParam.scene || "",
- channel: refStatisticsPostParam.channel || "0",
- department: refStatisticsPostParam.department || "0"
- };
- return this.postRequest(`${this.BASE_URL}open/activity/create-order`, params);
- }
- //获取支付参数
- static getOrderParams(orderSn,openId,isOrderPayment=false) {
- let params = {
- orderSn:orderSn,
- source: "FREE_MINI_APP",
- thirdPartyName: 'coupon-activity',
- payCode: "HSAY-SHARE",
- openId: openId
- };
- if(isOrderPayment){
- params.isOrderPayment =true;
- params.orderInfoPath = "pages/welfareMall/order/orderCompletion?ordersn="
- params.productDetailPath = "pages/welfareMall/activityInfo/activityInfo?activityId="
- }
- return this.postRequest(`${this.BASE_URL}open/activity/get-order-params`, params);
- }
-
- }
- export default Integralinfo
|