award.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. import { SERVICE_URL } from '@/utils/config'
  2. import { get, getL, post, postL } from '@/utils/http'
  3. import { trans } from './base'
  4. export default {
  5. apis: {
  6. INDEX: SERVICE_URL + '/api/app/index/magicMartIndex',
  7. IPLIST: SERVICE_URL + '/api/spu/basic/listWorksLimit',
  8. MAGIC_INDEX: SERVICE_URL + '/api/app/index/magicBoxIndex',
  9. LIST: SERVICE_URL + '/api/luckPool/list',
  10. HORSE: SERVICE_URL + '/api/luckPool/horseRaceLampByIndex',
  11. DETAIL: SERVICE_URL + '/api/luckPool/detail',
  12. PRODUCTS: SERVICE_URL + '/api/luckPool/prize',
  13. HORSE_DETAIL: SERVICE_URL + '/api/luckPool/horseRaceLampByDetail',
  14. BUY_RECORD: SERVICE_URL + '/api/luckPool/buyRecord',
  15. VERSION: SERVICE_URL + '/api/luckPool/version',
  16. PREVIEW: SERVICE_URL + '/api/luckOrder/preSubmit',
  17. APPLY: SERVICE_URL + '/api/luckOrder/submit',
  18. APPLY_TRY: SERVICE_URL + '/api/luckOrder/demo',
  19. APPLT_RESULT: SERVICE_URL + '/api/luckOrder/luckResult',
  20. ORDERS: SERVICE_URL + '/api/luckOrder/pageMy',
  21. STORE: SERVICE_URL + '/api/luckInventory',
  22. STORE_MOVE_SAFE: SERVICE_URL + '/api/luckInventory/addToSafe',
  23. STORE_OUT_SAFE: SERVICE_URL + '/api/luckInventory/moveFromSafe',
  24. CONVERT_PREVIEW: SERVICE_URL + '/api/luckExchangeOrder/preSubmit',
  25. CONVERT_APPLY: SERVICE_URL + '/api/luckExchangeOrder/submit',
  26. CONVERT_LIST: SERVICE_URL + '/api/luckExchangeOrder/pageMy',
  27. CONVERT_ALL_PREVIEW: SERVICE_URL + '/api/luckExchangeOrder/preOneKeySubmit',
  28. CONVERT_ALL: SERVICE_URL + '/api/luckExchangeOrder/oneKeySubmit',
  29. TAKE_PREVIEW: SERVICE_URL + '/api/luckPickupOrder/preSubmit',
  30. TAKE_APPLY: SERVICE_URL + '/api/luckPickupOrder/submit',
  31. TAKE_LIST: SERVICE_URL + '/api/luckPickupOrder/pageMy',
  32. TAKE_PAY_ORDER: SERVICE_URL + '/api/luckPickupOrder/pay',
  33. POOL_IN: SERVICE_URL + '/api/luckPool/participate',
  34. POOL_OUT: SERVICE_URL + '/api/luckPool/unparticipate',
  35. PACKAGES: SERVICE_URL + '/api/luckPickupOrder/expressInfo',
  36. EXPRESS: SERVICE_URL + '/api/luckPickupOrder/expressDetail',
  37. KING: SERVICE_URL + '/api/luckKing/getTheLatestLuckKingRecord',
  38. KING_USER: SERVICE_URL + '/api/luckKing/listBillboard',
  39. KING_GOODS: SERVICE_URL + '/api/luckKing/listGoods',
  40. KING_PRE: SERVICE_URL + '/api/luckKing/getThePrev',
  41. HIDETASKUSERLIST: SERVICE_URL + '/api/activity/hideTask/hideTaskUserList',
  42. HIDETASKSYNTHRSIS: SERVICE_URL + '/api/activity/hideTask/synthesis',
  43. HIDETASKSTART: SERVICE_URL + '/api/activity/hideTask/hideTaskStart',
  44. //=================box================
  45. BOX_LIST: SERVICE_URL + '/api/luckBox',
  46. BOX_DETAIL: SERVICE_URL + '/api/luckBox/detail',
  47. BOX_PRE: SERVICE_URL + '/api/luckBox/getThePrev',
  48. BOX_NEXT: SERVICE_URL + '/api/luckBox/getTheNext',
  49. UNAVALIABLE_SEATNUMBERS: SERVICE_URL + '/api/luckBox/getUnavaliableSeatNumbers',
  50. BOX_LOCK: SERVICE_URL + '/api/luckBox/lock',
  51. BOX_UN_LOCK: SERVICE_URL + '/api/luckBox/unlock',
  52. TRANSFERORDERSUBMIT: SERVICE_URL + '/api/transferOrder/submit',
  53. TRANSFERORDERPRESUBMIT: SERVICE_URL + '/api/transferOrder/preSubmit',
  54. TRANSFERORDERPAGEMY: SERVICE_URL + '/api/transferOrder/pageMy'
  55. },
  56. async index(type = 0) {
  57. const res = await trans(get(this.apis.INDEX, { type }))
  58. return res.data
  59. },
  60. async ipList(limit = 20) {
  61. const res = await trans(get(this.apis.IPLIST, { limit }))
  62. return res.data
  63. },
  64. async magicIndex() {
  65. const res = await trans(get(this.apis.MAGIC_INDEX))
  66. return res.data
  67. },
  68. async list(data, priceMin, priceMax, loading) {
  69. let param = {
  70. ...data
  71. }
  72. !!priceMin && (param.priceMin = priceMin - 0)
  73. !!priceMax && (param.priceMax = priceMax - 0)
  74. const res = await trans(
  75. post(this.apis.LIST, { current: 0, size: 50, ...param }, { loading })
  76. )
  77. return res.data
  78. },
  79. async horse() {
  80. const res = await trans(post(this.apis.HORSE))
  81. return res.success ? res.data : null
  82. },
  83. async detail(poolId, loading = false) {
  84. const res = await trans(get(this.apis.DETAIL, { poolId }, { loading }))
  85. return res.data
  86. },
  87. async products(poolId, loading = false) {
  88. const res = await trans(get(this.apis.PRODUCTS, { poolId }, { loading }))
  89. return res.data
  90. },
  91. async detailHorse(poolId, size = 50) {
  92. const res = await trans(post(this.apis.HORSE_DETAIL, { poolId, size }))
  93. return res.success ? res.data : null
  94. },
  95. async buyRecord(poolId, lastId, level, size = 30) {
  96. const res = await trans(post(this.apis.BUY_RECORD, { poolId, lastId, level, size }))
  97. return res.data
  98. },
  99. async version(poolId, size = 20) {
  100. const res = await trans(post(this.apis.VERSION, { poolId, size }))
  101. return res.data
  102. },
  103. async tryDemo(poolId, quantity) {
  104. const res = await trans(postL(this.apis.APPLY_TRY, { poolId, quantity }))
  105. return res.data
  106. },
  107. async preview(poolId, quantity, boxNumber, seatNumbers, packFlag) {
  108. let param = {
  109. poolId
  110. }
  111. !!quantity && (param.quantity = quantity)
  112. !!boxNumber && (param.boxNumber = boxNumber)
  113. if (!!seatNumbers && seatNumbers.length > 0) {
  114. param.seatNumbers = seatNumbers
  115. }
  116. !!packFlag && (param.packFlag = packFlag)
  117. const res = await trans(postL(this.apis.PREVIEW, param))
  118. return res.data
  119. },
  120. async apply(poolId, quantity, paymentType, boxNumber, seatNumbers, packFlag) {
  121. let param = {
  122. poolId,
  123. quantity,
  124. paymentType
  125. }
  126. !!boxNumber && (param.boxNumber = boxNumber)
  127. if (!!seatNumbers && seatNumbers.length > 0) {
  128. param.seatNumbers = seatNumbers
  129. }
  130. !!packFlag && (param.packFlag = packFlag)
  131. const res = await trans(postL(this.apis.APPLY, param))
  132. return res.data
  133. },
  134. async applyResult(tradeNo, loading) {
  135. const res = await trans(get(this.apis.APPLT_RESULT, { tradeNo }, { loading }))
  136. return res.data
  137. },
  138. async orders(current, size, tab, loading = false) {
  139. const res = await trans(post(this.apis.ORDERS, { current, tab, size }, { loading }))
  140. return res.data
  141. },
  142. async store(current, size, safeFlag, tab, loading) {
  143. const res = await trans(
  144. post(this.apis.STORE, { current, size, status: 0, tab, safeFlag }, { loading })
  145. )
  146. return res.data
  147. },
  148. async moveToSaveStore(inventoryIds) {
  149. const res = await trans(postL(this.apis.STORE_MOVE_SAFE, { inventoryIds }))
  150. return res.success
  151. },
  152. async moveOutSaveStore(inventoryIds) {
  153. const res = await trans(postL(this.apis.STORE_OUT_SAFE, { inventoryIds }))
  154. return res.success
  155. },
  156. async convertPreview(inventoryIds) {
  157. const res = await trans(postL(this.apis.CONVERT_PREVIEW, { inventoryIds }))
  158. return res.data
  159. },
  160. async convertApply(inventoryIds) {
  161. const res = await trans(postL(this.apis.CONVERT_APPLY, { inventoryIds }))
  162. return res.success
  163. },
  164. async convertList(current, size, loading) {
  165. const res = await trans(post(this.apis.CONVERT_LIST, { current, size }, { loading }))
  166. return res.data
  167. },
  168. async takePreview(inventoryIds, addressBookId) {
  169. const res = await trans(postL(this.apis.TAKE_PREVIEW, { inventoryIds, addressBookId }))
  170. return res.data
  171. },
  172. async takeApply(inventoryIds, addressBookId, paymentType) {
  173. const res = await trans(
  174. postL(this.apis.TAKE_APPLY, { inventoryIds, addressBookId, paymentType })
  175. )
  176. return res.data
  177. },
  178. async takeList(current, size, loading) {
  179. const res = await trans(post(this.apis.TAKE_LIST, { current, size }, { loading }))
  180. return res.data
  181. },
  182. async takePayOrder(tradeNo) {
  183. const res = await trans(
  184. postL(this.apis.TAKE_PAY_ORDER, { inventoryIds, addressBookId, paymentType })
  185. )
  186. return res.data
  187. },
  188. async poolIn(poolId) {
  189. const res = await trans(get(this.apis.POOL_IN, { poolId }))
  190. return res.success
  191. },
  192. async poolOut(poolId) {
  193. let param = {}
  194. poolId && (param.poolId = poolId)
  195. const res = await trans(get(this.apis.POOL_OUT, param))
  196. return res.success
  197. },
  198. async packages(tradeNo, loading = false) {
  199. const res = await trans(get(this.apis.PACKAGES, { tradeNo }, { loading }))
  200. return res.data
  201. },
  202. async express(tradeNo, packageId, loading = false) {
  203. const res = await trans(get(this.apis.EXPRESS, { tradeNo, packageId }, { loading }))
  204. return res.data
  205. },
  206. async king(poolId) {
  207. const res = await trans(get(this.apis.KING, { poolId }))
  208. return res.success ? res.data : null
  209. },
  210. async kingUser(poolId, loading = false) {
  211. const res = await trans(get(this.apis.KING_USER, { poolId }, { loading }))
  212. return res.data
  213. },
  214. async kingGoods(poolId) {
  215. const res = await trans(get(this.apis.KING_GOODS, { poolId }))
  216. return res.data
  217. },
  218. async convertAllPreview() {
  219. const res = await trans(postL(this.apis.CONVERT_ALL_PREVIEW))
  220. return res.data
  221. },
  222. async convertAll(levels) {
  223. const res = await trans(postL(this.apis.CONVERT_ALL, { levels }))
  224. return res.success
  225. },
  226. async preKing(poolId) {
  227. const res = await trans(get(this.apis.KING_PRE, { poolId }))
  228. return res.data
  229. },
  230. async boxs(poolId, level, current, size) {
  231. const res = await trans(post(this.apis.BOX_LIST, { poolId, current, size, level }))
  232. return res.data
  233. },
  234. async box(poolId, boxNumber, loading = false) {
  235. let param = {
  236. poolId
  237. }
  238. !!boxNumber && (param.boxNumber = boxNumber)
  239. const res = await trans(get(this.apis.BOX_DETAIL, param, { loading }))
  240. return res.data
  241. },
  242. async preBox(poolId, boxNumber) {
  243. let param = {
  244. poolId
  245. }
  246. !!boxNumber && (param.boxNumber = boxNumber)
  247. const res = await trans(getL(this.apis.BOX_PRE, param))
  248. return res.data
  249. },
  250. async nextBox(poolId, boxNumber) {
  251. let param = {
  252. poolId
  253. }
  254. !!boxNumber && (param.boxNumber = boxNumber)
  255. const res = await trans(getL(this.apis.BOX_NEXT, param))
  256. return res.data
  257. },
  258. async unavaliableSeatNumbers(poolId, boxNumber, startSeatNumber, endSeatNumber) {
  259. const res = await trans(
  260. post(this.apis.UNAVALIABLE_SEATNUMBERS, {
  261. poolId,
  262. boxNumber,
  263. startSeatNumber,
  264. endSeatNumber
  265. })
  266. )
  267. return res.data
  268. },
  269. async boxLock(poolId, boxNumber) {
  270. const res = await trans(postL(this.apis.BOX_LOCK, { poolId, boxNumber }))
  271. return res.success
  272. },
  273. async boxUnLock(poolId, boxNumber) {
  274. const res = await trans(postL(this.apis.BOX_UN_LOCK, { poolId, boxNumber }))
  275. return res.success
  276. },
  277. async hideTaskUserList() {
  278. const res = await trans(getL(this.apis.HIDETASKUSERLIST))
  279. return res
  280. },
  281. async hidetaskSynthesis(hideTaskUserId) {
  282. const url = `${this.apis.HIDETASKSYNTHRSIS}/${hideTaskUserId}`
  283. const res = await trans(getL(url))
  284. return res
  285. },
  286. async hideTaskStart(spuIds) {
  287. const res = await trans(post(this.apis.HIDETASKSTART, spuIds))
  288. return res.data
  289. },
  290. async transferOrderSubmit(param) {
  291. const res = await trans(post(this.apis.TRANSFERORDERSUBMIT, param))
  292. return res
  293. },
  294. async transferOrderPreSubmit(param) {
  295. const res = await trans(post(this.apis.TRANSFERORDERPRESUBMIT, param))
  296. return res
  297. },
  298. async transferOrderPageMy(current, size, loading) {
  299. const res = await trans(post(this.apis.TRANSFERORDERPAGEMY, { current, size }, { loading }))
  300. return res.data
  301. },
  302. async getSumInventory() {
  303. const res = await trans(getL(SERVICE_URL + '/api/luckInventory'))
  304. return res.data
  305. },
  306. async getLuckDetail(id) {
  307. const res = await trans(getL(SERVICE_URL + '/api/luckInventory/detail', { id }))
  308. return res.data
  309. }
  310. }