wallet.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const sheep_index = require("../../sheep/index.js");
  4. const sheep_api_trade_brokerage = require("../../sheep/api/trade/brokerage.js");
  5. const sheep_hooks_useGoods = require("../../sheep/hooks/useGoods.js");
  6. const sheep_util_index = require("../../sheep/util/index.js");
  7. require("../../sheep/api/index.js");
  8. require("../../sheep/api/distri/score.js");
  9. require("../../sheep/request/index.js");
  10. require("../../sheep/config/index.js");
  11. require("../../sheep/store/index.js");
  12. require("../../sheep/store/app.js");
  13. require("../../sheep/api/promotion/diy.js");
  14. require("../../sheep/platform/index.js");
  15. require("../../sheep/platform/provider/wechat/index.js");
  16. require("../../sheep/platform/provider/wechat/miniProgram.js");
  17. require("../../sheep/api/member/auth.js");
  18. require("../../sheep/api/member/social.js");
  19. require("../../sheep/api/member/user.js");
  20. require("../../sheep/platform/provider/apple/index.js");
  21. require("../../sheep/platform/share.js");
  22. require("../../sheep/router/index.js");
  23. require("../../sheep/hooks/useModal.js");
  24. require("../../sheep/helper/index.js");
  25. require("../../sheep/helper/test.js");
  26. require("../../sheep/helper/digit.js");
  27. require("../../sheep/api/member/signin.js");
  28. require("../../sheep/helper/throttle.js");
  29. require("../../sheep/url/index.js");
  30. require("../../sheep/platform/pay.js");
  31. require("../../sheep/api/pay/order.js");
  32. require("../../sheep/store/user.js");
  33. require("../../sheep/store/cart.js");
  34. require("../../sheep/api/trade/cart.js");
  35. require("../../sheep/api/pay/wallet.js");
  36. require("../../sheep/api/trade/order.js");
  37. require("../../sheep/api/promotion/coupon.js");
  38. require("../../sheep/store/sys.js");
  39. require("../../sheep/store/modal.js");
  40. require("../../sheep/api/distri/share.js");
  41. require("../../sheep/api/distri/team.js");
  42. require("../../sheep/api/infra/file.js");
  43. require("../../sheep/api/member/address.js");
  44. require("../../sheep/api/member/point.js");
  45. require("../../sheep/api/migration/app.js");
  46. require("../../sheep/api/migration/chat.js");
  47. require("../../sheep/api/migration/index.js");
  48. require("../../sheep/api/migration/third.js");
  49. require("../../sheep/api/pay/channel.js");
  50. require("../../sheep/api/product/category.js");
  51. require("../../sheep/api/product/comment.js");
  52. require("../../sheep/api/product/favorite.js");
  53. require("../../sheep/api/product/history.js");
  54. require("../../sheep/api/product/spu.js");
  55. require("../../sheep/api/promotion/activity.js");
  56. require("../../sheep/api/promotion/article.js");
  57. require("../../sheep/api/promotion/bargain.js");
  58. require("../../sheep/api/promotion/combination.js");
  59. require("../../sheep/api/promotion/rewardActivity.js");
  60. require("../../sheep/api/promotion/seckill.js");
  61. require("../../sheep/api/system/area.js");
  62. require("../../sheep/api/system/voice.js");
  63. require("../../sheep/api/trade/afterSale.js");
  64. require("../../sheep/api/trade/config.js");
  65. require("../../sheep/api/trade/delivery.js");
  66. require("../../sheep/config/zIndex.js");
  67. if (!Array) {
  68. const _easycom_uni_datetime_picker2 = common_vendor.resolveComponent("uni-datetime-picker");
  69. const _easycom_su_tabs2 = common_vendor.resolveComponent("su-tabs");
  70. const _easycom_su_sticky2 = common_vendor.resolveComponent("su-sticky");
  71. const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  72. const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  73. const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  74. const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  75. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  76. (_easycom_uni_datetime_picker2 + _easycom_su_tabs2 + _easycom_su_sticky2 + _easycom_s_empty2 + _easycom_uni_easyinput2 + _easycom_su_popup2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
  77. }
  78. const _easycom_uni_datetime_picker = () => "../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js";
  79. const _easycom_su_tabs = () => "../../sheep/ui/su-tabs/su-tabs.js";
  80. const _easycom_su_sticky = () => "../../sheep/ui/su-sticky/su-sticky.js";
  81. const _easycom_s_empty = () => "../../sheep/components/s-empty/s-empty.js";
  82. const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
  83. const _easycom_su_popup = () => "../../sheep/ui/su-popup/su-popup.js";
  84. const _easycom_uni_load_more = () => "../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
  85. const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";
  86. if (!Math) {
  87. (_easycom_uni_datetime_picker + _easycom_su_tabs + _easycom_su_sticky + _easycom_s_empty + _easycom_uni_easyinput + _easycom_su_popup + _easycom_uni_load_more + _easycom_s_layout)();
  88. }
  89. const _sfc_main = {
  90. __name: "wallet",
  91. setup(__props) {
  92. common_vendor.useCssVars((_ctx) => ({
  93. "bce371da": common_vendor.unref(headerBg)
  94. }));
  95. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/user/wallet_card_bg.png");
  96. const state = common_vendor.reactive({
  97. showMoney: false,
  98. summary: {},
  99. // 分销信息
  100. today: "",
  101. date: [],
  102. currentTab: 0,
  103. pagination: {
  104. list: [],
  105. total: 0,
  106. pageNo: 1,
  107. pageSize: 1
  108. },
  109. loadStatus: "",
  110. price: void 0,
  111. showModal: false
  112. });
  113. const tabMaps = [
  114. {
  115. name: "分佣",
  116. value: "1"
  117. // BrokerageRecordBizTypeEnum.ORDER
  118. },
  119. {
  120. name: "提现",
  121. value: "2"
  122. // BrokerageRecordBizTypeEnum.WITHDRAW
  123. }
  124. ];
  125. const dateFilterText = common_vendor.computed(() => {
  126. if (state.date[0] === state.date[1]) {
  127. return state.date[0];
  128. } else {
  129. return state.date.join("~");
  130. }
  131. });
  132. async function getLogList() {
  133. state.loadStatus = "loading";
  134. let {
  135. code,
  136. data
  137. } = await sheep_api_trade_brokerage.BrokerageApi.getBrokerageRecordPage({
  138. pageSize: state.pagination.pageSize,
  139. pageNo: state.pagination.pageNo,
  140. bizType: tabMaps[state.currentTab].value,
  141. "createTime[0]": state.date[0] + " 00:00:00",
  142. "createTime[1]": state.date[1] + " 23:59:59"
  143. });
  144. if (code !== 0) {
  145. return;
  146. }
  147. state.pagination.list = common_vendor._.concat(state.pagination.list, data.list);
  148. state.pagination.total = data.total;
  149. state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
  150. }
  151. function onChangeTab(e) {
  152. sheep_util_index.resetPagination(state.pagination);
  153. state.currentTab = e.index;
  154. getLogList();
  155. }
  156. function onChangeTime(e) {
  157. state.date[0] = e[0];
  158. state.date[1] = e[e.length - 1];
  159. sheep_util_index.resetPagination(state.pagination);
  160. getLogList();
  161. }
  162. async function onConfirm() {
  163. if (state.price <= 0) {
  164. sheep_index.sheep.$helper.toast("请输入正确的金额");
  165. return;
  166. }
  167. common_vendor.index.showModal({
  168. title: "提示",
  169. content: "确认把您的佣金转入到余额钱包中?",
  170. success: async function(res) {
  171. if (!res.confirm) {
  172. return;
  173. }
  174. const {
  175. code
  176. } = await sheep_api_trade_brokerage.BrokerageApi.createBrokerageWithdraw({
  177. type: 1,
  178. // 钱包
  179. price: state.price * 100
  180. });
  181. if (code === 0) {
  182. state.showModal = false;
  183. await getAgentInfo();
  184. onChangeTab({
  185. index: 1
  186. });
  187. }
  188. }
  189. });
  190. }
  191. async function getAgentInfo() {
  192. const {
  193. code,
  194. data
  195. } = await sheep_api_trade_brokerage.BrokerageApi.getBrokerageUserSummary();
  196. if (code !== 0) {
  197. return;
  198. }
  199. state.summary = data;
  200. }
  201. common_vendor.onLoad(async (options) => {
  202. state.today = common_vendor.dayjs().format("YYYY-MM-DD");
  203. state.date = [state.today, state.today];
  204. if (options.type === 2) {
  205. state.currentTab = 1;
  206. }
  207. getLogList();
  208. getAgentInfo();
  209. });
  210. common_vendor.onReachBottom(() => {
  211. if (state.loadStatus === "noMore") {
  212. return;
  213. }
  214. state.pagination.pageNo++;
  215. getLogList();
  216. });
  217. return (_ctx, _cache) => {
  218. return common_vendor.e({
  219. a: common_vendor.o(($event) => state.showMoney = !state.showMoney),
  220. b: common_vendor.n(state.showMoney ? "cicon-eye" : "cicon-eye-off"),
  221. c: common_vendor.t(state.showMoney ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.summary.withdrawPrice || 0) : "*****"),
  222. d: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/commission/withdraw")),
  223. e: common_vendor.o(($event) => state.showModal = true),
  224. f: common_vendor.t(state.showMoney ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.summary.frozenPrice || 0) : "*****"),
  225. g: common_vendor.t(state.showMoney ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.summary.brokeragePrice || 0) : "*****"),
  226. h: common_vendor.t(dateFilterText.value),
  227. i: common_vendor.o(onChangeTime),
  228. j: common_vendor.o(($event) => state.date = $event),
  229. k: common_vendor.p({
  230. type: "daterange",
  231. end: state.today,
  232. modelValue: state.date
  233. }),
  234. l: common_vendor.o(onChangeTab),
  235. m: common_vendor.p({
  236. list: tabMaps,
  237. scrollable: false,
  238. current: state.currentTab
  239. }),
  240. n: state.pagination.total === 0
  241. }, state.pagination.total === 0 ? {
  242. o: common_vendor.p({
  243. icon: "/static/data-empty.png",
  244. text: "暂无数据"
  245. })
  246. } : {}, {
  247. p: common_vendor.o(($event) => state.price = $event),
  248. q: common_vendor.p({
  249. inputBorder: false,
  250. type: "number",
  251. placeholder: "请输入金额",
  252. modelValue: state.price
  253. }),
  254. r: common_vendor.o(onConfirm),
  255. s: common_vendor.o(($event) => state.showModal = false),
  256. t: common_vendor.p({
  257. show: state.showModal,
  258. type: "bottom",
  259. round: "20",
  260. showClose: true
  261. }),
  262. v: state.pagination.total > 0
  263. }, state.pagination.total > 0 ? {
  264. w: common_vendor.f(state.pagination.list, (item, k0, i0) => {
  265. return common_vendor.e({
  266. a: common_vendor.t(item.title),
  267. b: item.price >= 0
  268. }, item.price >= 0 ? {
  269. c: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.price))
  270. } : {
  271. d: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.price))
  272. }, {
  273. e: common_vendor.t(common_vendor.unref(sheep_index.sheep).$helper.timeFormat(item.createTime, "yyyy-mm-dd hh:MM:ss")),
  274. f: item.id
  275. });
  276. })
  277. } : {}, {
  278. x: state.pagination.total > 0
  279. }, state.pagination.total > 0 ? {
  280. y: common_vendor.p({
  281. status: state.loadStatus,
  282. ["content-text"]: {
  283. contentdown: "上拉加载更多"
  284. }
  285. })
  286. } : {}, {
  287. z: common_vendor.s(_ctx.__cssVars()),
  288. A: common_vendor.p({
  289. title: "佣金"
  290. })
  291. });
  292. };
  293. }
  294. };
  295. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-52afd294"], ["__file", "D:/zx/mall-front-app/pages/commission/wallet.vue"]]);
  296. wx.createPage(MiniProgramPage);