Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tbcc-sdk-ts
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
qinhaitao
tbcc-sdk-ts
Commits
9c028b13
Commit
9c028b13
authored
Sep 06, 2021
by
mqf_0707
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新默认接口
parent
dc8ff82e
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
524 additions
and
220 deletions
+524
-220
tb.d.ts
lib/core/tb.d.ts
+1
-1
tb.js
lib/core/tb.js
+2
-0
tb.js.map
lib/core/tb.js.map
+1
-1
index.d.ts
lib/index.d.ts
+8
-12
index.js
lib/index.js
+2
-2
index.js.map
lib/index.js.map
+1
-1
capi.d.ts
lib/request/capi.d.ts
+5
-5
capi.js
lib/request/capi.js
+7
-7
capi.js.map
lib/request/capi.js.map
+1
-1
capiFn.d.ts
lib/request/capiFn.d.ts
+18
-7
capiFn.js
lib/request/capiFn.js
+171
-96
capiFn.js.map
lib/request/capiFn.js.map
+1
-1
index.d.ts
lib/utils/index.d.ts
+14
-0
index.js
lib/utils/index.js
+84
-1
index.js.map
lib/utils/index.js.map
+1
-1
package.json
package.json
+1
-1
tb.ts
src/core/tb.ts
+1
-0
index.ts
src/index.ts
+1
-1
capi.ts
src/request/capi.ts
+13
-13
capiFn.ts
src/request/capiFn.ts
+112
-68
index.d.ts
src/typing/index.d.ts
+11
-1
index.ts
src/utils/index.ts
+68
-0
No files found.
lib/core/tb.d.ts
View file @
9c028b13
...
...
@@ -27,7 +27,7 @@ export declare const getSystemInfo: () => Promise<unknown>;
* @param {number} sellerId 店铺归属的卖家Id
* @returns {boolean} 关注状态
*/
export
declare
const
favorShop
:
(
sellerId
:
number
)
=>
Promise
<
false
|
{
export
declare
const
favorShop
:
(
sellerId
:
number
)
=>
Promise
<
boolean
|
{
error
?:
number
;
}
>
;
/**
...
...
lib/core/tb.js
View file @
9c028b13
...
...
@@ -119,6 +119,8 @@ var favorShop = function (sellerId) { return __awaiter(void 0, void 0, void 0, f
result
=
_a
.
sent
();
if
((
result
===
null
||
result
===
void
0
?
void
0
:
result
.
error
)
===
11
)
return
[
2
/*return*/
,
false
];
if
((
result
===
null
||
result
===
void
0
?
void
0
:
result
.
error
)
===
12
)
return
[
2
/*return*/
,
true
];
return
[
2
/*return*/
,
result
];
}
});
...
...
lib/core/tb.js.map
View file @
9c028b13
This diff is collapsed.
Click to expand it.
lib/index.d.ts
View file @
9c028b13
import
*
as
utils
from
'./utils'
;
import
*
as
constants
from
'./constants'
;
import
*
as
capiFn
from
'./request/capiFn'
;
declare
const
_default
:
{
capi
:
{
getMy
Prize
List
:
{
getMy
Awards
List
:
{
method
:
string
;
handle
:
string
;
isShowLoading
:
boolean
;
...
...
@@ -15,29 +16,24 @@ declare const _default: {
method
:
string
;
handle
:
string
;
};
getItemListByItemIds
:
{
completeTask
:
{
method
:
string
;
handle
:
string
;
};
getCollectGoodsList
:
{
receiveTask
:
{
method
:
string
;
handle
:
string
;
};
doCompleteTask
:
{
getTaskList
:
{
method
:
string
;
handle
:
string
;
};
get
VipInfo
:
{
get
CollectGoods
:
{
method
:
string
;
handle
:
string
;
};
};
capiFn
:
(
apiList
:
any
,
request
:
any
)
=>
{
receiveObjectPrize
(
params
:
any
):
Promise
<
false
|
void
>
;
getVipInfo
(
params
:
any
):
Promise
<
any
>
;
receiveEnamePrize
(
params
:
any
):
Promise
<
boolean
>
;
addStat
(
activityId
:
string
,
type
:
string
|
number
):
Promise
<
boolean
>
;
};
capiFn
:
typeof
capiFn
;
tb
:
{
getUserAddress
:
(
opts
?:
{})
=>
Promise
<
unknown
>
;
chooseImage
:
(
opts
?:
{})
=>
Promise
<
unknown
>
;
...
...
@@ -56,7 +52,7 @@ declare const _default: {
simpleAlert
:
(
content
:
string
)
=>
void
;
commonConfirm
:
(
title
:
string
,
content
:
string
,
successCb
?:
()
=>
any
)
=>
Promise
<
void
>
;
getSystemInfo
:
()
=>
Promise
<
unknown
>
;
favorShop
:
(
sellerId
:
number
)
=>
Promise
<
false
|
{
favorShop
:
(
sellerId
:
number
)
=>
Promise
<
boolean
|
{
error
?:
number
;
}
>
;
checkShopFavoredStatus
:
(
sellerId
:
number
)
=>
Promise
<
boolean
|
{
...
...
lib/index.js
View file @
9c028b13
...
...
@@ -16,11 +16,11 @@ var tbFn = require("./core/tbFn");
var
utils
=
require
(
"./utils"
);
var
constants
=
require
(
"./constants"
);
var
capi_1
=
require
(
"./request/capi"
);
var
capiFn
_1
=
require
(
"./request/capiFn"
);
var
capiFn
=
require
(
"./request/capiFn"
);
var
request_1
=
require
(
"./request"
);
exports
.
default
=
{
capi
:
capi_1
.
default
,
capiFn
:
capiFn
_1
.
default
,
capiFn
:
capiFn
,
tb
:
__assign
(
__assign
({},
tb
),
tbFn
),
utils
:
utils
,
request
:
request_1
.
default
,
...
...
lib/index.js.map
View file @
9c028b13
{"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"}
\ No newline at end of file
{"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
lib/request/capi.d.ts
View file @
9c028b13
declare
const
capi
:
{
getMy
Prize
List
:
{
getMy
Awards
List
:
{
method
:
string
;
handle
:
string
;
isShowLoading
:
boolean
;
...
...
@@ -12,19 +12,19 @@ declare const capi: {
method
:
string
;
handle
:
string
;
};
getItemListByItemIds
:
{
completeTask
:
{
method
:
string
;
handle
:
string
;
};
getCollectGoodsList
:
{
receiveTask
:
{
method
:
string
;
handle
:
string
;
};
doCompleteTask
:
{
getTaskList
:
{
method
:
string
;
handle
:
string
;
};
get
VipInfo
:
{
get
CollectGoods
:
{
method
:
string
;
handle
:
string
;
};
...
...
lib/request/capi.js
View file @
9c028b13
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
capi
=
{
getMy
Prize
List
:
{
getMy
Awards
List
:
{
method
:
'GET'
,
handle
:
'getMy
Prize
List'
,
isShowLoading
:
fals
e
handle
:
'getMy
Awards
List'
,
isShowLoading
:
tru
e
},
receiveObjectPrize
:
{
method
:
'GET'
,
handle
:
'receiveObjectPrize'
},
receiveEnamePrize
:
{
method
:
'GET'
,
handle
:
'receiveEnamePrize'
},
getItemListByItemIds
:
{
method
:
'GET'
,
handle
:
'getItemListByItemIds
'
},
getCollectGoodsList
:
{
method
:
'GET'
,
handle
:
'getCollectGoodsList
'
},
doCompleteTask
:
{
method
:
'GET'
,
handle
:
'doCompleteTask
'
},
get
VipInfo
:
{
method
:
'GET'
,
handle
:
'getVipInfo'
}
completeTask
:
{
method
:
'GET'
,
handle
:
'completeTask
'
},
receiveTask
:
{
method
:
'GET'
,
handle
:
'receiveTask
'
},
getTaskList
:
{
method
:
'GET'
,
handle
:
'getTaskList
'
},
get
CollectGoods
:
{
method
:
'GET'
,
handle
:
'getCollectGoods'
},
};
exports
.
default
=
capi
;
//# sourceMappingURL=capi.js.map
\ No newline at end of file
lib/request/capi.js.map
View file @
9c028b13
{"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"}
\ No newline at end of file
{"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
lib/request/capiFn.d.ts
View file @
9c028b13
declare
const
capiFn
:
(
apiList
:
any
,
request
:
any
)
=>
{
receiveObjectPrize
(
params
:
any
):
Promise
<
false
|
void
>
;
getVipInfo
(
params
:
any
):
Promise
<
any
>
;
receiveEnamePrize
(
params
:
any
):
Promise
<
boolean
>
;
addStat
(
activityId
:
string
,
type
:
number
|
string
):
Promise
<
boolean
>
;
};
export
default
capiFn
;
/**
* 领取实物奖品
* @param api
* @param data
*/
export
declare
const
receiveObjectPrize
:
(
api
:
any
,
data
:
IReceivePrize
)
=>
Promise
<
unknown
>
;
/**
* 领取权益
* @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
>
;
lib/request/capiFn.js
View file @
9c028b13
This diff is collapsed.
Click to expand it.
lib/request/capiFn.js.map
View file @
9c028b13
{"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;;;;;;4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.d.ts
View file @
9c028b13
...
...
@@ -70,4 +70,18 @@ export declare const validateActivityStatus: (checkParam: {
endTime
:
number
;
noCheck
:
boolean
;
})
=>
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
{};
lib/utils/index.js
View file @
9c028b13
...
...
@@ -58,7 +58,7 @@ var __rest = (this && this.__rest) || function (s, e) {
return
t
;
};
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"
);
/**
* 时间格式化
...
...
@@ -275,4 +275,87 @@ var validateActivityStatus = function (checkParam) { return __awaiter(void 0, vo
});
});
};
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
\ No newline at end of file
lib/utils/index.js.map
View file @
9c028b13
This diff is collapsed.
Click to expand it.
package.json
View file @
9c028b13
{
"name"
:
"tbcc-sdk-ts"
,
"version"
:
"1.0.
6
"
,
"version"
:
"1.0.
7
"
,
"description"
:
""
,
"main"
:
"lib/index.js"
,
"scripts"
:
{
...
...
src/core/tb.ts
View file @
9c028b13
...
...
@@ -63,6 +63,7 @@ export const favorShop = async (sellerId: number) => {
}
let
result
:
{
error
?:
number
}
=
await
promisifyApiToTb
(
'favorShop'
,{
id
:
+
sellerId
})
if
(
result
?.
error
===
11
)
return
false
if
(
result
?.
error
===
12
)
return
true
return
result
};
/**
...
...
src/index.ts
View file @
9c028b13
...
...
@@ -3,7 +3,7 @@ import * as tbFn from './core/tbFn';
import
*
as
utils
from
'./utils'
;
import
*
as
constants
from
'./constants'
;
import
capi
from
'./request/capi'
;
import
capiFn
from
'./request/capiFn'
;
import
*
as
capiFn
from
'./request/capiFn'
;
import
request
from
'./request'
;
export
default
{
...
...
src/request/capi.ts
View file @
9c028b13
const
capi
=
{
getMyPrize
List
:
{
method
:
'GET'
,
handle
:
'getMyPrize
List'
,
isShowLoading
:
fals
e
},
receiveObjectPrize
:
{
method
:
'GET'
,
handle
:
'receiveObjectPrize'
},
receiveEnamePrize
:
{
method
:
'GET'
,
handle
:
'receiveEnamePrize'
},
getItemListByItemIds
:
{
method
:
'GET'
,
handle
:
'getItemListByItemIds
'
},
getCollectGoodsList
:
{
method
:
'GET'
,
handle
:
'getCollectGoodsList
'
},
doCompleteTask
:
{
method
:
'GET'
,
handle
:
'doCompleteTask
'
},
getVipInfo
:
{
method
:
'GET'
,
handle
:
'getVipInfo'
}
};
getMyAwards
List
:
{
method
:
'GET'
,
handle
:
'getMyAwards
List'
,
isShowLoading
:
tru
e
},
receiveObjectPrize
:
{
method
:
'GET'
,
handle
:
'receiveObjectPrize'
},
receiveEnamePrize
:
{
method
:
'GET'
,
handle
:
'receiveEnamePrize'
},
completeTask
:
{
method
:
'GET'
,
handle
:
'completeTask
'
},
receiveTask
:
{
method
:
'GET'
,
handle
:
'receiveTask
'
},
getTaskList
:
{
method
:
'GET'
,
handle
:
'getTaskList
'
},
getCollectGoods
:
{
method
:
'GET'
,
handle
:
'getCollectGoods'
},
};
export
default
capi
;
\ No newline at end of file
export
default
capi
;
\ No newline at end of file
src/request/capiFn.ts
View file @
9c028b13
import
{
commonToast
,
commonConfirm
}
from
'../core/tb'
;
import
{
commonToast
}
from
'../core/tb'
;
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
{
async
receiveObjectPrize
(
params
)
{
const
{
handle
,
method
,
ext
}
=
getRequestParams
(
apiList
[
'receiveObjectPrize'
]);
const
userAddress
:
IAddress
=
await
getUserAddress
().
catch
(
err
=>
{
commonToast
(
err
.
errorMessage
);
params
,
duibaAddress
:
userAddress
.
duibaAddress
.
address
}
}
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
,
addressDetail
:
detailInfo
,
cityCode
,
city
:
cityName
,
province
:
provinceName
,
area
:
countyName
,
streetName
,
...
params
})
}
/**
* 领取实物奖品
* @param api
* @param data
*/
export
const
receiveObjectPrize
=
async
(
api
:
any
,
data
:
IReceivePrize
)
=>
{
const
{
params
,
successMsg
,
errorMsg
}
=
data
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
const
userInfo
=
await
getUerAddressParam
()
if
(
!
userInfo
)
{
resolve
(
false
)
return
;
}
const
confirmResult
=
userAddress
?
(
await
commonConfirm
(
'提示'
,
'确认使用该收货地址:'
+
name
+
telNumber
+
userAddress
.
duibaAddress
.
address
,
async
function
()
{
const
result
=
await
request
(
handle
,
method
,
params
,
ext
).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
);
});
if
(
result
&&
result
.
success
)
{
return
true
;
}
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
;
const
{
params
:
_params
,
duibaAddress
}
=
userInfo
const
{
name
,
phone
}
=
_params
const
address
=
name
+
phone
+
duibaAddress
const
canPass
=
await
confirmAddress
(
address
)
if
(
!
canPass
)
{
resolve
(
false
)
return
;
}
return
false
;
},
async
receiveEnamePrize
(
params
)
{
const
{
handle
,
method
,
ext
}
=
getRequestParams
(
apiList
[
'receiveEnamePrize'
]);
const
result
=
await
request
(
handle
,
method
,
params
,
ext
).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
);
});
if
(
result
&&
result
.
success
)
{
return
true
;
const
{
success
,
data
,
message
}
=
await
api
({
...
params
,
...
_params
})
if
(
success
)
{
commonToast
(
successMsg
)
resolve
(
true
)
}
else
{
commonToast
(
errorMsg
||
message
)
resolve
(
false
)
}
return
false
;
},
async
addStat
(
activityId
:
string
,
type
:
number
|
string
)
{
const
{
handle
,
method
,
ext
}
=
getRequestParams
(
apiList
[
'addStat'
]);
const
result
=
await
request
(
handle
,
method
,
{
activityId
,
type
},
ext
).
catch
(
res
=>
{
commonToast
(
res
&&
res
.
message
);
})
}
/**
* 领取权益
* @param api
* @param data
*/
export
const
receiveEnamePrize
=
async
(
api
:
any
,
data
:
IReceivePrize
)
=>
{
const
{
params
,
successMsg
,
errorMsg
}
=
data
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
)
{
return
true
;
if
(
success
)
{
commonToast
(
successMsg
)
resolve
(
true
)
}
else
{
commonToast
(
errorMsg
||
message
)
resolve
(
false
)
}
return
false
;
},
}
};
export
default
capiFn
;
})
}
/**
* 会员优惠券领取
* @param api
* @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
src/typing/index.d.ts
View file @
9c028b13
...
...
@@ -77,4 +77,14 @@ interface ISkuInfo {
quantity
:
string
}
declare
var
my
:
any
\ No newline at end of file
declare
var
my
:
any
interface
IReceivePrize
{
params
:
{
sellerId
:
number
ename
:
string
[
key
:
string
]:
string
|
number
}
successMsg
:
string
errorMsg
:
string
}
\ No newline at end of file
src/utils/index.ts
View file @
9c028b13
...
...
@@ -193,4 +193,72 @@ export const validateActivityStatus = async (checkParam: { startTime: number, en
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment