Commit 9c028b13 authored by mqf_0707's avatar mqf_0707

更新默认接口

parent dc8ff82e
...@@ -27,7 +27,7 @@ export declare const getSystemInfo: () => Promise<unknown>; ...@@ -27,7 +27,7 @@ export declare const getSystemInfo: () => Promise<unknown>;
* @param {number} sellerId 店铺归属的卖家Id * @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态 * @returns {boolean} 关注状态
*/ */
export declare const favorShop: (sellerId: number) => Promise<false | { export declare const favorShop: (sellerId: number) => Promise<boolean | {
error?: number; error?: number;
}>; }>;
/** /**
......
...@@ -119,6 +119,8 @@ var favorShop = function (sellerId) { return __awaiter(void 0, void 0, void 0, f ...@@ -119,6 +119,8 @@ var favorShop = function (sellerId) { return __awaiter(void 0, void 0, void 0, f
result = _a.sent(); result = _a.sent();
if ((result === null || result === void 0 ? void 0 : result.error) === 11) if ((result === null || result === void 0 ? void 0 : result.error) === 11)
return [2 /*return*/, false]; return [2 /*return*/, false];
if ((result === null || result === void 0 ? void 0 : result.error) === 12)
return [2 /*return*/, true];
return [2 /*return*/, result]; return [2 /*return*/, result];
} }
}); });
......
This diff is collapsed.
import * as utils from './utils'; import * as utils from './utils';
import * as constants from './constants'; import * as constants from './constants';
import * as capiFn from './request/capiFn';
declare const _default: { declare const _default: {
capi: { capi: {
getMyPrizeList: { getMyAwardsList: {
method: string; method: string;
handle: string; handle: string;
isShowLoading: boolean; isShowLoading: boolean;
...@@ -15,29 +16,24 @@ declare const _default: { ...@@ -15,29 +16,24 @@ declare const _default: {
method: string; method: string;
handle: string; handle: string;
}; };
getItemListByItemIds: { completeTask: {
method: string; method: string;
handle: string; handle: string;
}; };
getCollectGoodsList: { receiveTask: {
method: string; method: string;
handle: string; handle: string;
}; };
doCompleteTask: { getTaskList: {
method: string; method: string;
handle: string; handle: string;
}; };
getVipInfo: { getCollectGoods: {
method: string; method: string;
handle: string; handle: string;
}; };
}; };
capiFn: (apiList: any, request: any) => { capiFn: typeof capiFn;
receiveObjectPrize(params: any): Promise<false | void>;
getVipInfo(params: any): Promise<any>;
receiveEnamePrize(params: any): Promise<boolean>;
addStat(activityId: string, type: string | number): Promise<boolean>;
};
tb: { tb: {
getUserAddress: (opts?: {}) => Promise<unknown>; getUserAddress: (opts?: {}) => Promise<unknown>;
chooseImage: (opts?: {}) => Promise<unknown>; chooseImage: (opts?: {}) => Promise<unknown>;
...@@ -56,7 +52,7 @@ declare const _default: { ...@@ -56,7 +52,7 @@ declare const _default: {
simpleAlert: (content: string) => void; simpleAlert: (content: string) => void;
commonConfirm: (title: string, content: string, successCb?: () => any) => Promise<void>; commonConfirm: (title: string, content: string, successCb?: () => any) => Promise<void>;
getSystemInfo: () => Promise<unknown>; getSystemInfo: () => Promise<unknown>;
favorShop: (sellerId: number) => Promise<false | { favorShop: (sellerId: number) => Promise<boolean | {
error?: number; error?: number;
}>; }>;
checkShopFavoredStatus: (sellerId: number) => Promise<boolean | { checkShopFavoredStatus: (sellerId: number) => Promise<boolean | {
......
...@@ -16,11 +16,11 @@ var tbFn = require("./core/tbFn"); ...@@ -16,11 +16,11 @@ var tbFn = require("./core/tbFn");
var utils = require("./utils"); var utils = require("./utils");
var constants = require("./constants"); var constants = require("./constants");
var capi_1 = require("./request/capi"); var capi_1 = require("./request/capi");
var capiFn_1 = require("./request/capiFn"); var capiFn = require("./request/capiFn");
var request_1 = require("./request"); var request_1 = require("./request");
exports.default = { exports.default = {
capi: capi_1.default, capi: capi_1.default,
capiFn: capiFn_1.default, capiFn: capiFn,
tb: __assign(__assign({}, tb), tbFn), tb: __assign(__assign({}, tb), tbFn),
utils: utils, utils: utils,
request: request_1.default, request: request_1.default,
......
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,8BAAgC;AAChC,kCAAoC;AACpC,+BAAiC;AACjC,uCAAyC;AACzC,uCAAkC;AAClC,2CAAsC;AACtC,qCAAgC;AAEhC,kBAAe;IACb,IAAI,gBAAA;IACJ,MAAM,kBAAA;IACN,EAAE,wBACE,EAAE,GAAK,IAAI,CACd;IACD,KAAK,OAAA;IACL,OAAO,mBAAA;IACP,SAAS,WAAA;CACV,CAAA"} {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,8BAAgC;AAChC,kCAAoC;AACpC,+BAAiC;AACjC,uCAAyC;AACzC,uCAAkC;AAClC,yCAA2C;AAC3C,qCAAgC;AAEhC,kBAAe;IACb,IAAI,gBAAA;IACJ,MAAM,QAAA;IACN,EAAE,wBACE,EAAE,GAAK,IAAI,CACd;IACD,KAAK,OAAA;IACL,OAAO,mBAAA;IACP,SAAS,WAAA;CACV,CAAA"}
\ No newline at end of file \ No newline at end of file
declare const capi: { declare const capi: {
getMyPrizeList: { getMyAwardsList: {
method: string; method: string;
handle: string; handle: string;
isShowLoading: boolean; isShowLoading: boolean;
...@@ -12,19 +12,19 @@ declare const capi: { ...@@ -12,19 +12,19 @@ declare const capi: {
method: string; method: string;
handle: string; handle: string;
}; };
getItemListByItemIds: { completeTask: {
method: string; method: string;
handle: string; handle: string;
}; };
getCollectGoodsList: { receiveTask: {
method: string; method: string;
handle: string; handle: string;
}; };
doCompleteTask: { getTaskList: {
method: string; method: string;
handle: string; handle: string;
}; };
getVipInfo: { getCollectGoods: {
method: string; method: string;
handle: string; handle: string;
}; };
......
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var capi = { var capi = {
getMyPrizeList: { getMyAwardsList: {
method: 'GET', method: 'GET',
handle: 'getMyPrizeList', handle: 'getMyAwardsList',
isShowLoading: false isShowLoading: true
}, },
receiveObjectPrize: { method: 'GET', handle: 'receiveObjectPrize' }, receiveObjectPrize: { method: 'GET', handle: 'receiveObjectPrize' },
receiveEnamePrize: { method: 'GET', handle: 'receiveEnamePrize' }, receiveEnamePrize: { method: 'GET', handle: 'receiveEnamePrize' },
getItemListByItemIds: { method: 'GET', handle: 'getItemListByItemIds' }, completeTask: { method: 'GET', handle: 'completeTask' },
getCollectGoodsList: { method: 'GET', handle: 'getCollectGoodsList' }, receiveTask: { method: 'GET', handle: 'receiveTask' },
doCompleteTask: { method: 'GET', handle: 'doCompleteTask' }, getTaskList: { method: 'GET', handle: 'getTaskList' },
getVipInfo: { method: 'GET', handle: 'getVipInfo' } getCollectGoods: { method: 'GET', handle: 'getCollectGoods' },
}; };
exports.default = capi; exports.default = capi;
//# sourceMappingURL=capi.js.map //# sourceMappingURL=capi.js.map
\ No newline at end of file
{"version":3,"file":"capi.js","sourceRoot":"","sources":["../../src/request/capi.ts"],"names":[],"mappings":";;AAAA,IAAM,IAAI,GAAG;IACT,cAAc,EAAE;QACd,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,gBAAgB;QACxB,aAAa,EAAE,KAAK;KACrB;IACD,kBAAkB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE;IACnE,iBAAiB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE;IACjE,oBAAoB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE;IACvE,mBAAmB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE;IACrE,cAAc,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAC3D,UAAU,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE;CACpD,CAAC;AAEF,kBAAe,IAAI,CAAC"} {"version":3,"file":"capi.js","sourceRoot":"","sources":["../../src/request/capi.ts"],"names":[],"mappings":";;AAAA,IAAM,IAAI,GAAG;IACX,eAAe,EAAE;QACf,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,iBAAiB;QACzB,aAAa,EAAE,IAAI;KACpB;IACD,kBAAkB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE;IACnE,iBAAiB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE;IACjE,YAAY,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE;IACvD,WAAW,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE;IACrD,WAAW,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE;IACrD,eAAe,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE;CAC9D,CAAC;AAEF,kBAAe,IAAI,CAAC"}
\ No newline at end of file \ No newline at end of file
declare const capiFn: (apiList: any, request: any) => { /**
receiveObjectPrize(params: any): Promise<false | void>; * 领取实物奖品
getVipInfo(params: any): Promise<any>; * @param api
receiveEnamePrize(params: any): Promise<boolean>; * @param data
addStat(activityId: string, type: number | string): Promise<boolean>; */
}; export declare const receiveObjectPrize: (api: any, data: IReceivePrize) => Promise<unknown>;
export default capiFn; /**
* 领取权益
* @param api
* @param data
*/
export declare const receiveEnamePrize: (api: any, data: IReceivePrize) => Promise<unknown>;
/**
* 会员优惠券领取
* @param api
* @param data
*/
export declare const receiveMemberEname: (api: any, data: IReceivePrize) => Promise<unknown>;
This diff is collapsed.
{"version":3,"file":"capiFn.js","sourceRoot":"","sources":["../../src/request/capiFn.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAwD;AACxD,qCAA8C;AAC9C,kCAA4C;AAE5C,YAAY;AACZ,IAAM,MAAM,GAAG,UAAC,OAAO,EAAE,OAAO;IAC9B,OAAO;QACC,kBAAkB,EAAxB,UAAyB,MAAM;;;;;;4BACvB,KAA0B,wBAAgB,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,EAAvE,MAAM,YAAA,EAAE,M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AIG;AACI,IAAM,kBAAkB,GAAG,UAAM,GAAQ,EAAE,IAAmB;;;QAC3D,MAAM,GAA2B,IAAI,OAA/B,EAAE,UAAU,GAAe,IAAI,WAAnB,EAAE,QAAQ,GAAK,IAAI,SAAT,CAAS;QACrC,QAAQ,GAAoB,MAAM,SAA1B,EAAE,KAAK,GAAa,MAAM,MAAnB,EAAK,GAAG,UAAK,MAAM,EAApC,qBAA2B,CAAF,CAAW;QAC1C,IAAG,CAAC,KAAK;YAAE,sBAAO,KAAK,EAAA;QACvB,sBAAO,IAAI,OAAO,CAAC,UAAO,OAAO,EAAC,MAAM;;;;gCAChB,qBAAM,qBAAa,CAAC,EAAC,QAAQ,UAAA,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAA;;4BAAjE,MAAM,GAAQ,SAAmD;4BACvE,IAAG,CAAC,MAAM;gCAAE,OAAO,CAAC,KAAK,CAAC,CAAA;iCACvB,MAAM,CAAC,eAAe,EAAtB,wBAAsB;4BACc,qBAAM,GAAG,cAAM,GAAG,EAAG,EAAA;;4BAAlD,KAA6B,SAAqB,EAAhD,OAAO,aAAA,EAAE,gBAAI,EAAE,OAAO,aAAA;4BAC9B,IAAG,OAAO,EAAE;gCACR,gBAAW,CAAC,UAAU,IAAI,qBAAqB,CAAC,CAAA;gCAChD,OAAO,CAAC,IAAI,CAAC,CAAA;6BAChB;iCAAK;gCACF,gBAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAA;gCAChC,OAAO,CAAC,KAAK,CAAC,CAAA;6BACjB;;;4BAED,gBAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;4BAC5B,OAAO,CAAC,KAAK,CAAC,CAAA;;;;;iBAErB,CAAC,EAAA;;KACH,CAAA;AArBY,QAAA,kBAAkB,sBAqB9B"}
\ No newline at end of file \ No newline at end of file
...@@ -70,4 +70,18 @@ export declare const validateActivityStatus: (checkParam: { ...@@ -70,4 +70,18 @@ export declare const validateActivityStatus: (checkParam: {
endTime: number; endTime: number;
noCheck: boolean; noCheck: boolean;
}) => Promise<unknown>; }) => Promise<unknown>;
/**
* 查询商家权益活动
* @param sellerId
*/
export declare const getActivity: (sellerId: number) => any[] | Promise<unknown>;
/**
* 领取会员优惠券
* @param params
*/
export declare const applyActivity: (params: {
sellerId: number;
activityId: string;
}) => false | Promise<unknown>;
export declare const getGrade: (sellerId: number) => any[] | Promise<unknown>;
export {}; export {};
...@@ -58,7 +58,7 @@ var __rest = (this && this.__rest) || function (s, e) { ...@@ -58,7 +58,7 @@ var __rest = (this && this.__rest) || function (s, e) {
return t; return t;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.validateActivityStatus = exports.formatTimeStamp = exports.checkIsMember = exports.getImgShareUrl = exports.throttleHandle = exports.generateAPI = exports.getRequestParams = exports.versionCompare = exports.dateFormatter = void 0; exports.getGrade = exports.applyActivity = exports.getActivity = exports.validateActivityStatus = exports.formatTimeStamp = exports.checkIsMember = exports.getImgShareUrl = exports.throttleHandle = exports.generateAPI = exports.getRequestParams = exports.versionCompare = exports.dateFormatter = void 0;
var tb_1 = require("../core/tb"); var tb_1 = require("../core/tb");
/** /**
* 时间格式化 * 时间格式化
...@@ -275,4 +275,87 @@ var validateActivityStatus = function (checkParam) { return __awaiter(void 0, vo ...@@ -275,4 +275,87 @@ var validateActivityStatus = function (checkParam) { return __awaiter(void 0, vo
}); });
}); }; }); };
exports.validateActivityStatus = validateActivityStatus; exports.validateActivityStatus = validateActivityStatus;
/**
* 查询商家权益活动
* @param sellerId
*/
var getActivity = function (sellerId) {
// @ts-ignore
var memberBenefitPlugin = requirePlugin("memberBenefit");
if (!memberBenefitPlugin)
return [];
return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
memberBenefitPlugin.getActivity({
data: {
sellerId: sellerId,
},
success: function (result) {
resolve(result);
},
fail: function (error) {
console.log('获取失败' + JSON.stringify(error));
resolve(error);
}
});
return [2 /*return*/];
});
}); });
};
exports.getActivity = getActivity;
/**
* 领取会员优惠券
* @param params
*/
var applyActivity = function (params) {
var sellerId = params.sellerId, activityId = params.activityId;
// @ts-ignore
var memberBenefitPlugin = requirePlugin("memberBenefit");
if (!memberBenefitPlugin)
return false;
return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
memberBenefitPlugin.applyActivity({
data: {
sellerId: sellerId,
activityId: activityId,
},
success: function (result) {
resolve(result);
},
fail: function (error) {
console.warn('领取商家权益失败' + JSON.stringify(error.data));
resolve(error.data);
}
});
return [2 /*return*/];
});
}); });
};
exports.applyActivity = applyActivity;
// 查询商家会员等级
var getGrade = function (sellerId) {
// @ts-ignore
var memberBenefitPlugin = requirePlugin("memberBenefit");
if (!memberBenefitPlugin)
return [];
return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_a) {
memberBenefitPlugin.getGrade({
data: {
sellerId: sellerId
},
success: function (result) {
resolve(result);
},
fail: function (error) {
console.log('查询商家会员等级失败' + JSON.stringify(error));
resolve(error);
}
});
return [2 /*return*/];
});
}); });
};
exports.getGrade = getGrade;
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map
\ No newline at end of file
This diff is collapsed.
{ {
"name": "tbcc-sdk-ts", "name": "tbcc-sdk-ts",
"version": "1.0.6", "version": "1.0.7",
"description": "", "description": "",
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {
......
...@@ -63,6 +63,7 @@ export const favorShop = async (sellerId: number) => { ...@@ -63,6 +63,7 @@ export const favorShop = async (sellerId: number) => {
} }
let result: { error?: number } = await promisifyApiToTb('favorShop',{ id: +sellerId }) let result: { error?: number } = await promisifyApiToTb('favorShop',{ id: +sellerId })
if(result?.error === 11) return false if(result?.error === 11) return false
if(result?.error === 12) return true
return result return result
}; };
/** /**
......
...@@ -3,7 +3,7 @@ import * as tbFn from './core/tbFn'; ...@@ -3,7 +3,7 @@ import * as tbFn from './core/tbFn';
import * as utils from './utils'; import * as utils from './utils';
import * as constants from './constants'; import * as constants from './constants';
import capi from './request/capi'; import capi from './request/capi';
import capiFn from './request/capiFn'; import * as capiFn from './request/capiFn';
import request from './request'; import request from './request';
export default { export default {
......
const capi = { const capi = {
getMyPrizeList: { getMyAwardsList: {
method: 'GET', method: 'GET',
handle: 'getMyPrizeList', handle: 'getMyAwardsList',
isShowLoading: false isShowLoading: true
}, },
receiveObjectPrize: { method: 'GET', handle: 'receiveObjectPrize' }, receiveObjectPrize: { method: 'GET', handle: 'receiveObjectPrize' },
receiveEnamePrize: { method: 'GET', handle: 'receiveEnamePrize' }, receiveEnamePrize: { method: 'GET', handle: 'receiveEnamePrize' },
getItemListByItemIds: { method: 'GET', handle: 'getItemListByItemIds' }, completeTask: { method: 'GET', handle: 'completeTask' },
getCollectGoodsList: { method: 'GET', handle: 'getCollectGoodsList' }, receiveTask: { method: 'GET', handle: 'receiveTask' },
doCompleteTask: { method: 'GET', handle: 'doCompleteTask' }, getTaskList: { method: 'GET', handle: 'getTaskList' },
getVipInfo: { method: 'GET', handle: 'getVipInfo' } getCollectGoods: { method: 'GET', handle: 'getCollectGoods' },
}; };
export default capi; export default capi;
\ No newline at end of file \ No newline at end of file
import { commonToast, commonConfirm } from '../core/tb'; import { commonToast } from '../core/tb';
import { getUserAddress } from '../core/tbFn'; import { getUserAddress } from '../core/tbFn';
import { getRequestParams } from '../utils'; import { applyActivity } from '../utils';
// 通用API封装方法 // 领取实物
const capiFn = (apiList, request) => { const getUerAddressParam = async () => {
const userAddress: any = await getUserAddress().catch(err => {
commonToast(err.errorMessage);
});
if(!userAddress) return false
const { name, telNumber, provinceName, cityName, cityCode, countyName, detailInfo, streetName } = userAddress || {};
const params = {
name,
phone: telNumber,
addressDetail: detailInfo,
cityCode,
city: cityName,
province: provinceName,
area: countyName,
streetName,
}
return { return {
async receiveObjectPrize(params) { params,
const { handle, method, ext } = getRequestParams(apiList['receiveObjectPrize']); duibaAddress: userAddress.duibaAddress.address
const userAddress: IAddress = await getUserAddress().catch(err => { }
commonToast(err.errorMessage); }
const confirmAddress = async (address) => {
return new Promise(async (resolve,reject) => {
// @ts-ignore
my.confirm({
title: '提示',
content: '确认使用该收货地址:' + address,
success: (res) => {
if(res.confirm) {
resolve(true)
}else {
resolve(false)
}
},
}); });
// if(!userAddress) return false })
const { name, telNumber, provinceName, cityName, cityCode, countyName, detailInfo, streetName } = userAddress || {}; }
params = { /**
name, * 领取实物奖品
phone: telNumber, * @param api
addressDetail: detailInfo, * @param data
cityCode, */
city: cityName, export const receiveObjectPrize = async (api: any, data: IReceivePrize) => {
province: provinceName, const { params, successMsg, errorMsg } = data
area: countyName, return new Promise(async (resolve,reject) => {
streetName, const userInfo = await getUerAddressParam()
...params if(!userInfo) {
resolve(false)
return;
} }
const confirmResult = userAddress ? (await commonConfirm('提示', '确认使用该收货地址:' + name + telNumber + userAddress.duibaAddress.address, async function() { const { params: _params, duibaAddress } = userInfo
const result = await request(handle, method, params, ext).catch(res => { const { name, phone } = _params
commonToast(res && res.message); const address = name + phone + duibaAddress
}); const canPass = await confirmAddress(address)
if (result && result.success) { if(!canPass) {
return true; resolve(false)
} return;
return false
})) : false
return confirmResult
},
async getVipInfo(params) {
const { handle, method, ext } = getRequestParams(apiList['getVipInfo']);
const result = await request(handle, method, params, ext).catch(res => {
commonToast(res && res.message);
});
if (result && result.success) {
const { isVip } = result.data
return isVip;
} }
return false; const { success, data, message } = await api({ ...params, ..._params })
}, if (success) {
commonToast(successMsg)
async receiveEnamePrize(params) { resolve(true)
const { handle, method, ext } = getRequestParams(apiList['receiveEnamePrize']); }else {
const result = await request(handle, method, params, ext).catch(res => { commonToast(errorMsg || message)
commonToast(res && res.message); resolve(false)
});
if (result && result.success) {
return true;
} }
return false; })
}, }
/**
async addStat(activityId: string, type: number | string) { * 领取权益
const { handle, method, ext } = getRequestParams(apiList['addStat']); * @param api
const result = await request(handle, method, { * @param data
activityId, */
type export const receiveEnamePrize = async (api: any, data: IReceivePrize) => {
}, ext).catch(res => { const { params, successMsg, errorMsg } = data
commonToast(res && res.message); return new Promise(async (resolve,reject) => {
const { success, data, message } = await api(params).catch(res => {
commonToast(successMsg || res.message)
resolve(false)
}); });
if (result && result.success) { if (success) {
return true; commonToast(successMsg)
resolve(true)
}else {
commonToast(errorMsg || message)
resolve(false)
} }
return false; })
}, }
} /**
}; * 会员优惠券领取
* @param api
export default capiFn; * @param data
*/
export const receiveMemberEname = async(api: any, data: IReceivePrize) => {
const { params, successMsg, errorMsg } = data
const { sellerId, ename, ...ext } = params
if(!ename) return false
return new Promise(async (resolve,reject) => {
const result: any = await applyActivity({sellerId, activityId: ename })
if(!result) resolve(false)
if(result.businessSuccess) {
const { success, data, message } = await api({ ...ext })
if(success) {
commonToast(successMsg || '奖品发放成功,请前往我的奖品处进行使用')
resolve(true)
}else {
commonToast(errorMsg || message)
resolve(false)
}
}else{
commonToast(result.errorMsg)
resolve(false)
}
})
}
\ No newline at end of file
...@@ -77,4 +77,14 @@ interface ISkuInfo { ...@@ -77,4 +77,14 @@ interface ISkuInfo {
quantity: string quantity: string
} }
declare var my: any declare var my: any
\ No newline at end of file
interface IReceivePrize {
params: {
sellerId: number
ename: string
[key: string]: string | number
}
successMsg: string
errorMsg: string
}
\ No newline at end of file
...@@ -193,4 +193,72 @@ export const validateActivityStatus = async (checkParam: { startTime: number, en ...@@ -193,4 +193,72 @@ export const validateActivityStatus = async (checkParam: { startTime: number, en
resolve(true) resolve(true)
} }
}) })
}
/**
* 查询商家权益活动
* @param sellerId
*/
export const getActivity = (sellerId: number) => {
// @ts-ignore
const memberBenefitPlugin = requirePlugin("memberBenefit")
if(!memberBenefitPlugin) return []
return new Promise(async (resolve,reject) => {
memberBenefitPlugin.getActivity({
data: {
sellerId,
},
success: (result) => {
resolve(result)
},
fail: (error) => {
console.log('获取失败'+JSON.stringify(error))
resolve(error)
}
});
})
}
/**
* 领取会员优惠券
* @param params
*/
export const applyActivity = (params: { sellerId: number, activityId: string }) => {
const { sellerId, activityId } = params
// @ts-ignore
const memberBenefitPlugin = requirePlugin("memberBenefit")
if(!memberBenefitPlugin) return false
return new Promise(async (resolve,reject) => {
memberBenefitPlugin.applyActivity({
data: {
sellerId,
activityId,
},
success: (result) => {
resolve(result)
},
fail: (error) => {
console.warn('领取商家权益失败'+JSON.stringify(error.data))
resolve(error.data)
}
});
})
}
// 查询商家会员等级
export const getGrade = (sellerId: number) => {
// @ts-ignore
const memberBenefitPlugin = requirePlugin("memberBenefit")
if(!memberBenefitPlugin) return []
return new Promise(async (resolve,reject) => {
memberBenefitPlugin.getGrade({
data: {
sellerId
},
success: (result) => {
resolve(result)
},
fail: (error) => {
console.log('查询商家会员等级失败'+JSON.stringify(error))
resolve(error)
}
});
})
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment