123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- import request from '../utils/request.js'
- class activity extends request {
- /**
- * 获取活动列表
- * @param {*} nextPage
- * @param {*} pageSize
- * @param {*} status
- */
- static async getActivityList(nextPage,pageSize,status) {
- let params = {
- nextPage:nextPage,
- pageSize:pageSize,
- condition:{
- statusList:[status],
- source:"FREE_MINI_APP",
- }
- };
- const res = await this.postRequest(`${this.BASE_URL}open/activity/get-list`, params)
- return res.data
- }
- static async isShareByMobile(mobile) {
- let params = {
- mobile:mobile
- };
- const res = await this.postRequest(`${this.BASE_URL}open/activity/is-share-by-mobile`, params)
- return res.data
- }
- /**
- * 获取支付参数
- * @param {*} orderSn
- */
- static async getOrderParams(orderSn,activityName='') {
- let params = {
- orderSn:orderSn,
- source:"FREE_MINI_APP",
- thirdPartyName:activityName,
- openId:wx.getStorageSync('loginInfo').openId,
- payCode:'',
- };
- const res = await this.postRequest(`${this.BASE_URL}open/activity/get-order-params`, params)
- return res.data
- }
- /**
- * 获取活动详情
- * @param {*} activityId 活动id
- */
- static async getActivityDetail(activityId) {
- let params = {
- activityId:activityId
- };
- const res = await this.getRequest(`${this.BASE_URL}open/activity/get`, params)
- return res.data
- }
- /**
- * 领券
- * @param {*} activityId
- * @param {*} memberMobile
- * @param {*} number
- * @param {*} shopId
- */
- static async createOrder(activityId,memberMobile,num=1,shopId='') {
- let params = {
- activityId:activityId,
- memberMobile:memberMobile,
- num:num,
- shopId:shopId
- };
- console.log('参数');
- console.log(params);
- const res = await this.postRequest(`${this.BASE_URL}open/activity/create-order`, params)
- return res.data
- }
- /**
- * 分享活动的分享码
- * @param {*} activityId
- * @param {*} mobile
- */
- static async createShareActivityCode(activityId,mobile) {
- let params = {
- activityId:activityId,
- mobile:mobile
- // activityId:'Bg5740r78w',
- // mobile:13205528979
- };
- const res = await this.postRequest(`${this.BASE_URL}open/activity/create-share-activity-code`, params)
- return res.data
- }
- //根据codeId 获取 分享活动的详细信息
- static async getShareActivityCode(codeId) {
- let params = {
- codeId:codeId,
- };
- console.log(params)
- const res = await this.postRequest(`${this.BASE_URL}open/activity/get-share-activity-code`, params)
- return res.data
- }
- /**
- * 获取我的券列表
- * @param {*} nextPage
- * @param {*} pageSize
- * @param {*} mobile
- */
- static async getSnListMember(nextPage,pageSize,mobile) {
- let params = {
- nextPage:nextPage,
- pageSize:pageSize,
- condition:{
- mobile:mobile
- }
- };
- const res = await this.postRequest(`${this.BASE_URL}open/activity/sn-list-member`, params)
- return res.data
- }
- //绑定券与codeId之间的关系
- static async bindShareCode(orderSn,codeId) {
- let params = {
- orderSn:orderSn,
- codeId:codeId
- };
- const res = await this.postRequest(`${this.BASE_URL}open/activity/bind-share-code`, params)
- return res.data
- }
-
- static async getSessionKeyFromApi(code) {
- let params = {
- appCode:getApp().globalData.appCode,
- sessionCode:code
- };
-
- const res = await this.postRequest(`${this.BASE_URL}open/wxapp/wx-login`, params)
- return res.data
- }
- /**
- * 解锁手机号
- * @param {*} orderSn
- */
- static async getAuthMobile(params) {
-
- const res = await this.postRequest(`${this.BASE_URL}open/wxapp/auth-mobile`, params)
- return res.data
- }
- /**
- * 解锁手机号 新接口
- * @param {*} orderSn
- */
- static async getAuthMobileNew(params) {
-
- const res = await this.postRequest(`${this.BASE_URL}open/wxapp/auth-mobile-new`, params)
- return res.data
- }
- /**
- * 保存用户信息
- * @param {*} openId
- * @param {*} mobile
- */
- static async saveUser(openId,mobile,headerImg="",nickName="") {
- let params = {
- openid:openId,
- mobile:mobile,
- source:'FREE_MINI_APP'
- };
- if(headerImg){
- params.headerImg = headerImg;
- }
- if(nickName){
- params.nickName = nickName;
- }
- const res = await this.postRequest(`${this.BASE_URL}open/activity/save-user`, params)
- return res.data
-
- }
- static async getUserInfo(mobile) {
- let params = {
- mobile:mobile,
- source:'FREE_MINI_APP'
- };
-
- const res = await this.postRequest(`${this.BASE_URL}open/activity/get-user`, params)
- return res.data
-
- }
-
- /**
- * 设置手机缓存
- * @param {*} mobile
- */
- static setMobileCache(mobile) {
- let data = {
- mobile:mobile,
- }
- wx.setStorageSync('userInfo',data);
- }
- static getMobileCache() {
- let userInfo = wx.getStorageSync('userInfo');
- if(userInfo) {
- return userInfo.mobile;
- }
- return '';
- }
- // static getSessionKey() {
- // return wx.getStorageSync('loginInfo').sessionKey;
- // }
- /**
- * 获取用户openid
- */
- static getOpenId() {
- return wx.getStorageSync('loginInfo').openId;
- }
- /**
- * 卡券详情数据
- */
- static getCouponDetailData(params) {
- return this.postRequest(`${this.BASE_URL}open/coupon/get-coupon-data`, params);
- }
- static getFoodListByCoupon(params) {
- return this.postRequest(`${this.BASE_URL}open/coupon/get-food-list-by-coupon`, params);
- }
- static getStoreListByCoupon(params) {
- return this.postRequest(`${this.BASE_URL}open/coupon/get-store-list-by-coupon`, params);
- }
- }
- export default activity
|