money.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../../sheep/index.js");
  4. const sheep_api_pay_wallet = require("../../../sheep/api/pay/wallet.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/trade/order.js");
  36. require("../../../sheep/api/promotion/coupon.js");
  37. require("../../../sheep/store/sys.js");
  38. require("../../../sheep/store/modal.js");
  39. require("../../../sheep/api/distri/share.js");
  40. require("../../../sheep/api/distri/team.js");
  41. require("../../../sheep/api/infra/file.js");
  42. require("../../../sheep/api/member/address.js");
  43. require("../../../sheep/api/member/point.js");
  44. require("../../../sheep/api/migration/app.js");
  45. require("../../../sheep/api/migration/chat.js");
  46. require("../../../sheep/api/migration/index.js");
  47. require("../../../sheep/api/migration/third.js");
  48. require("../../../sheep/api/pay/channel.js");
  49. require("../../../sheep/api/product/category.js");
  50. require("../../../sheep/api/product/comment.js");
  51. require("../../../sheep/api/product/favorite.js");
  52. require("../../../sheep/api/product/history.js");
  53. require("../../../sheep/api/product/spu.js");
  54. require("../../../sheep/api/promotion/activity.js");
  55. require("../../../sheep/api/promotion/article.js");
  56. require("../../../sheep/api/promotion/bargain.js");
  57. require("../../../sheep/api/promotion/combination.js");
  58. require("../../../sheep/api/promotion/rewardActivity.js");
  59. require("../../../sheep/api/promotion/seckill.js");
  60. require("../../../sheep/api/system/area.js");
  61. require("../../../sheep/api/system/voice.js");
  62. require("../../../sheep/api/trade/afterSale.js");
  63. require("../../../sheep/api/trade/brokerage.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_load_more2 = common_vendor.resolveComponent("uni-load-more");
  73. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  74. (_easycom_uni_datetime_picker2 + _easycom_su_tabs2 + _easycom_su_sticky2 + _easycom_s_empty2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
  75. }
  76. const _easycom_uni_datetime_picker = () => "../../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js";
  77. const _easycom_su_tabs = () => "../../../sheep/ui/su-tabs/su-tabs.js";
  78. const _easycom_su_sticky = () => "../../../sheep/ui/su-sticky/su-sticky.js";
  79. const _easycom_s_empty = () => "../../../sheep/components/s-empty/s-empty.js";
  80. const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
  81. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  82. if (!Math) {
  83. (_easycom_uni_datetime_picker + _easycom_su_tabs + _easycom_su_sticky + _easycom_s_empty + _easycom_uni_load_more + _easycom_s_layout)();
  84. }
  85. const _sfc_main = {
  86. __name: "money",
  87. setup(__props) {
  88. common_vendor.useCssVars((_ctx) => ({
  89. "05bea019": common_vendor.unref(headerBg)
  90. }));
  91. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/user/wallet_card_bg.png");
  92. const state = common_vendor.reactive({
  93. showMoney: false,
  94. date: [],
  95. // 筛选的时间段
  96. currentTab: 0,
  97. pagination: {
  98. list: [],
  99. total: 0,
  100. pageNo: 1,
  101. pageSize: 8
  102. },
  103. summary: {
  104. totalIncome: 0,
  105. totalExpense: 0
  106. },
  107. loadStatus: "",
  108. today: ""
  109. });
  110. const tabMaps = [
  111. {
  112. name: "全部",
  113. value: ""
  114. },
  115. {
  116. name: "收入",
  117. value: "1"
  118. },
  119. {
  120. name: "支出",
  121. value: "2"
  122. }
  123. ];
  124. const userWallet = common_vendor.computed(() => sheep_index.sheep.$store("user").userWallet);
  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. const { data, code } = await sheep_api_pay_wallet.PayWalletApi.getWalletTransactionPage({
  135. pageNo: state.pagination.pageNo,
  136. pageSize: state.pagination.pageSize,
  137. type: tabMaps[state.currentTab].value,
  138. "createTime[0]": state.date[0] + " 00:00:00",
  139. "createTime[1]": state.date[1] + " 23:59:59"
  140. });
  141. if (code !== 0) {
  142. return;
  143. }
  144. state.pagination.list = common_vendor._.concat(state.pagination.list, data.list);
  145. state.pagination.total = data.total;
  146. state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
  147. }
  148. async function getSummary() {
  149. const { data, code } = await sheep_api_pay_wallet.PayWalletApi.getWalletTransactionSummary({
  150. "createTime": [state.date[0] + " 00:00:00", state.date[1] + " 23:59:59"]
  151. });
  152. if (code !== 0) {
  153. return;
  154. }
  155. state.summary = data;
  156. }
  157. common_vendor.onLoad(() => {
  158. state.today = common_vendor.dayjs().format("YYYY-MM-DD");
  159. state.date = [state.today, state.today];
  160. getLogList();
  161. getSummary();
  162. sheep_index.sheep.$store("user").getWallet();
  163. });
  164. function onChange(e) {
  165. state.currentTab = e.index;
  166. sheep_util_index.resetPagination(state.pagination);
  167. getLogList();
  168. getSummary();
  169. }
  170. function onChangeTime(e) {
  171. state.date[0] = e[0];
  172. state.date[1] = e[e.length - 1];
  173. sheep_util_index.resetPagination(state.pagination);
  174. getLogList();
  175. getSummary();
  176. }
  177. common_vendor.onReachBottom(() => {
  178. if (state.loadStatus === "noMore") {
  179. return;
  180. }
  181. state.pagination.pageNo++;
  182. getLogList();
  183. });
  184. return (_ctx, _cache) => {
  185. return common_vendor.e({
  186. a: common_vendor.o(($event) => state.showMoney = !state.showMoney),
  187. b: common_vendor.n(state.showMoney ? "cicon-eye" : "cicon-eye-off"),
  188. c: common_vendor.t(state.showMoney ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(userWallet.value.balance) : "*****"),
  189. d: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/pay/recharge")),
  190. e: common_vendor.t(dateFilterText.value),
  191. f: common_vendor.o(onChangeTime),
  192. g: common_vendor.o(($event) => state.data = $event),
  193. h: common_vendor.p({
  194. type: "daterange",
  195. end: state.today,
  196. modelValue: state.data
  197. }),
  198. i: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.summary.totalIncome)),
  199. j: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.summary.totalExpense)),
  200. k: common_vendor.o(onChange),
  201. l: common_vendor.p({
  202. list: tabMaps,
  203. scrollable: false,
  204. current: state.currentTab
  205. }),
  206. m: state.pagination.total === 0
  207. }, state.pagination.total === 0 ? {
  208. n: common_vendor.p({
  209. text: "暂无数据",
  210. icon: "/static/data-empty.png"
  211. })
  212. } : {}, {
  213. o: state.pagination.total > 0
  214. }, state.pagination.total > 0 ? {
  215. p: common_vendor.f(state.pagination.list, (item, k0, i0) => {
  216. return common_vendor.e({
  217. a: common_vendor.t(item.title),
  218. b: item.price >= 0
  219. }, item.price >= 0 ? {
  220. c: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.price))
  221. } : {
  222. d: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.price))
  223. }, {
  224. e: item.id
  225. });
  226. }),
  227. q: common_vendor.t(common_vendor.unref(sheep_index.sheep).$helper.timeFormat(state.createTime, "yyyy-mm-dd hh:MM:ss"))
  228. } : {}, {
  229. r: state.pagination.total > 0
  230. }, state.pagination.total > 0 ? {
  231. s: common_vendor.p({
  232. status: state.loadStatus,
  233. ["content-text"]: {
  234. contentdown: "上拉加载更多"
  235. }
  236. })
  237. } : {}, {
  238. t: common_vendor.s(_ctx.__cssVars()),
  239. v: common_vendor.p({
  240. title: "钱包"
  241. })
  242. });
  243. };
  244. }
  245. };
  246. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-69f29528"], ["__file", "D:/zx/mall-front-app/pages/user/wallet/money.vue"]]);
  247. wx.createPage(MiniProgramPage);