酒店桌布为微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

400 lines
6.5 KiB

11 months ago
10 months ago
11 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
11 months ago
  1. import http from './http.js'
  2. let limit = {}
  3. let debounce = {}
  4. const config = {
  5. // 示例
  6. // wxLogin : {url : '/api/wxLogin', method : 'POST',
  7. // auth : false, showLoading : true, loadingTitle : '加载中...',
  8. // limit : 1000
  9. // },
  10. getConfig: {
  11. url: '/api/getConfig',
  12. method: 'GET'
  13. },
  14. // 获取客服联系电话
  15. customUser: {
  16. url: '/user/custom',
  17. method: 'get',
  18. },
  19. // banner列表
  20. bannerList: {
  21. url: '/banner/list',
  22. method: 'GET',
  23. showLoading: true,
  24. },
  25. // 公告列表
  26. noticeList: {
  27. url: '/notice/list',
  28. method: 'GET',
  29. showLoading: true,
  30. },
  31. // 公告详情
  32. noticeOne: {
  33. url: '/notice/one',
  34. method: 'GET',
  35. showLoading: true,
  36. },
  37. // 商品列表
  38. goodsPage: {
  39. url: '/goods/page',
  40. method: 'GET',
  41. showLoading: true,
  42. debounce : 300,
  43. },
  44. // 商品详情
  45. goodsOne: {
  46. url: '/goods/one',
  47. method: 'GET',
  48. showLoading: true,
  49. },
  50. // 购物车分页
  51. cartPage: {
  52. url: '/goods/shopping/cart/page',
  53. method: 'GET',
  54. showLoading: true,
  55. auth: true,
  56. },
  57. // 加入购物车
  58. cartAdd: {
  59. url: '/goods/join/shopping/cart',
  60. method: 'POST',
  61. showLoading: true,
  62. auth: true,
  63. },
  64. // 删除购物车
  65. cartDel: {
  66. url: '/goods/shopping/cart/delete',
  67. method: 'POST',
  68. showLoading: true,
  69. auth: true,
  70. },
  71. // 修改购物车数量
  72. cartNum: {
  73. url: '/goods/shopping/cart/add/or/delete',
  74. method: 'POST',
  75. auth: true,
  76. debounce: 1000,
  77. },
  78. //分类列表
  79. categoryList: {
  80. url: '/category/list',
  81. method: 'GET',
  82. showLoading: true,
  83. },
  84. //新增地址
  85. addressAdd: {
  86. url: '/address/add',
  87. method: 'POST',
  88. limit: 500,
  89. auth: true,
  90. showLoading: true,
  91. },
  92. //修改默认地址
  93. addressDefault: {
  94. url: '/address/default',
  95. method: 'POST',
  96. auth: true,
  97. showLoading: true,
  98. },
  99. //删除地址
  100. addressDelete: {
  101. url: '/address/delete',
  102. method: 'POST',
  103. auth: true,
  104. showLoading: true,
  105. },
  106. //修改地址
  107. addressEdit: {
  108. url: '/address/edit',
  109. method: 'POST',
  110. limit: 500,
  111. auth: true,
  112. showLoading: true,
  113. },
  114. //分页查询地址
  115. addressPage: {
  116. url: '/address/page',
  117. method: 'GET',
  118. auth: true,
  119. showLoading: true,
  120. },
  121. // 分页查询我的客户
  122. getMyUserPage: {
  123. url: '/shop/user',
  124. method: 'GET',
  125. auth: true,
  126. showLoading: true,
  127. },
  128. //优惠券分页接口
  129. couponPage: {
  130. url: '/coupon/page',
  131. method: 'GET',
  132. auth: true,
  133. showLoading: true,
  134. },
  135. //分页查询订单
  136. orderPage: {
  137. url: '/order/page',
  138. method: 'GET',
  139. auth: true,
  140. showLoading: true,
  141. },
  142. //查询订单详情
  143. orderOne: {
  144. url: '/order/one',
  145. method: 'GET',
  146. auth: true,
  147. showLoading: true,
  148. },
  149. // 微信登录接口
  150. wxLogin: {
  151. url: '/login/login',
  152. method: 'POST',
  153. limit: 500,
  154. showLoading: true,
  155. },
  156. // 修改个人信息接口
  157. updateInfo: {
  158. url: '/user/edit',
  159. method: 'POST',
  160. auth: true,
  161. limit: 500,
  162. showLoading: true,
  163. },
  164. // 获取用户信息
  165. getInfo: {
  166. url: '/user/info',
  167. method: 'GET',
  168. auth: true,
  169. showLoading: true,
  170. },
  171. // 获取我的租赁
  172. getLeasePage: {
  173. url: '/user/lease/page',
  174. method: 'POST',
  175. showLoading: true,
  176. },
  177. // 申请成为水洗店
  178. applyShopHotel: {
  179. url: '/shop/apply',
  180. method: 'POST',
  181. showLoading: true,
  182. auth: true,
  183. },
  184. // 店铺申请提现
  185. storeWithdrawalApplication: {
  186. url: '/shop/withdrawal/apply',
  187. method: 'POST',
  188. showLoading: true,
  189. auth: true,
  190. },
  191. // 提现日志
  192. withdrawalLog: {
  193. url: '/shop/withdrawal/page',
  194. method: 'GET',
  195. showLoading: true,
  196. auth: true,
  197. },
  198. // 水洗店首页数据
  199. laundryStoreHomeData: {
  200. url: '/shop/index',
  201. method: 'GET',
  202. // showLoading : true,
  203. auth: true,
  204. },
  205. // 获取绑定店铺的数据
  206. bindShop: {
  207. url: '/shop/bind',
  208. method: 'GET',
  209. // showLoading : true,
  210. auth: true,
  211. },
  212. // 修改店铺营业时间
  213. updateJobTime: {
  214. url: '/shop/job/time',
  215. method: 'POST',
  216. // showLoading : true,
  217. auth: true,
  218. },
  219. // 退货、换货申请
  220. refundOrder: {
  221. url: '/order/refund',
  222. method: 'POST',
  223. // showLoading : true,
  224. auth: true,
  225. },
  226. // 商品租赁下订单
  227. orderCreate: {
  228. url: '/order/create',
  229. method: 'POST',
  230. showLoading : true,
  231. limit: 500,
  232. auth: true,
  233. },
  234. // 商品租赁订单支付
  235. orderPay: {
  236. url: '/order/pay',
  237. method: 'POST',
  238. showLoading : true,
  239. limit: 500,
  240. auth: true,
  241. },
  242. // 确认收货
  243. orderConfirm: {
  244. url: '/order/confirm',
  245. method: 'POST',
  246. showLoading : true,
  247. limit: 500,
  248. auth: true,
  249. },
  250. // 订单详情列表
  251. detailList: {
  252. // order/detail/list
  253. url: '/order/detail/list',
  254. method: 'GET',
  255. showLoading : true,
  256. limit: 500,
  257. auth: true,
  258. },
  259. // 根据商品id获取规格
  260. goodsSku: {
  261. url: '/goods/sku',
  262. method: 'GET',
  263. auth: true,
  264. },
  265. // 购物车修改多规格
  266. editSku: {
  267. url: '/goods/shopping/cart/edit/sku',
  268. method: 'POST',
  269. auth: true,
  270. },
  271. // 水洗店账号绑定微信
  272. bindWx: {
  273. url: '/shop/bind/wx',
  274. method: 'POST',
  275. auth: true,
  276. },
  277. // 上传自己的桌布
  278. tablecloth: {
  279. url: '/order/upload/tablecloth',
  280. method: 'POST',
  281. auth: true,
  282. },
  283. // 水洗店确认接单
  284. orderConfirmAccept: {
  285. url: '/order/confirm/accept',
  286. method: 'POST',
  287. auth: true,
  288. },
  289. // 酒店换货支付
  290. replacePay: {
  291. url: '/order/replace/pay',
  292. method: 'POST',
  293. auth: true,
  294. },
  295. // 水洗店换货发货
  296. sendLogistics: {
  297. url: '/order/send/logistics',
  298. method: 'POST',
  299. auth: true,
  300. },
  301. // 获取全局总金额优惠满减
  302. confCoupon: {
  303. url: '/conf/coupon',
  304. method: 'GET',
  305. auth: true,
  306. },
  307. }
  308. export function api(key, data, callback, loadingTitle) {
  309. let req = config[key]
  310. if (!req) {
  311. console.error('无效key' + key);
  312. return
  313. }
  314. if (typeof callback == 'string') {
  315. loadingTitle = callback
  316. }
  317. if (typeof data == 'function') {
  318. callback = data
  319. data = {}
  320. }
  321. // 接口限流
  322. if (req.limit) {
  323. let storageKey = req.url
  324. let storage = limit[storageKey]
  325. if (storage && new Date().getTime() - storage < req.limit) {
  326. return
  327. }
  328. limit[storageKey] = new Date().getTime()
  329. }
  330. //必须登录
  331. if (req.auth) {
  332. if (!uni.getStorageSync('token')) {
  333. uni.navigateTo({
  334. url: '/pages_order/auth/wxLogin'
  335. })
  336. console.error('需要登录')
  337. return
  338. }
  339. }
  340. // 接口防抖
  341. if (req.debounce) {
  342. let storageKey = req.url
  343. let storage = debounce[storageKey]
  344. if (storage) {
  345. clearTimeout(storage)
  346. }
  347. debounce[storageKey] = setTimeout(() => {
  348. clearTimeout(storage)
  349. delete debounce[storageKey]
  350. http.http(req.url, data, callback, req.method,
  351. loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
  352. }, req.debounce)
  353. return
  354. }
  355. http.http(req.url, data, callback, req.method,
  356. loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
  357. }
  358. export default api