money.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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/url/index.js");
  8. require("../../../sheep/store/index.js");
  9. require("../../../sheep/store/app.js");
  10. require("../../../sheep/api/promotion/diy.js");
  11. require("../../../sheep/request/index.js");
  12. require("../../../sheep/config/index.js");
  13. require("../../../sheep/platform/index.js");
  14. require("../../../sheep/platform/provider/wechat/index.js");
  15. require("../../../sheep/platform/provider/wechat/miniProgram.js");
  16. require("../../../sheep/api/member/auth.js");
  17. require("../../../sheep/api/member/social.js");
  18. require("../../../sheep/api/member/user.js");
  19. require("../../../sheep/platform/provider/apple/index.js");
  20. require("../../../sheep/platform/share.js");
  21. require("../../../sheep/router/index.js");
  22. require("../../../sheep/hooks/useModal.js");
  23. require("../../../sheep/helper/index.js");
  24. require("../../../sheep/helper/test.js");
  25. require("../../../sheep/helper/digit.js");
  26. require("../../../sheep/api/member/signin.js");
  27. require("../../../sheep/helper/throttle.js");
  28. require("../../../sheep/platform/pay.js");
  29. require("../../../sheep/api/pay/order.js");
  30. require("../../../sheep/store/user.js");
  31. require("../../../sheep/store/cart.js");
  32. require("../../../sheep/api/trade/cart.js");
  33. require("../../../sheep/api/trade/order.js");
  34. require("../../../sheep/api/promotion/coupon.js");
  35. require("../../../sheep/store/sys.js");
  36. require("../../../sheep/store/modal.js");
  37. require("../../../sheep/config/zIndex.js");
  38. if (!Array) {
  39. const _easycom_uni_datetime_picker2 = common_vendor.resolveComponent("uni-datetime-picker");
  40. const _easycom_su_tabs2 = common_vendor.resolveComponent("su-tabs");
  41. const _easycom_su_sticky2 = common_vendor.resolveComponent("su-sticky");
  42. const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  43. const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  44. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  45. (_easycom_uni_datetime_picker2 + _easycom_su_tabs2 + _easycom_su_sticky2 + _easycom_s_empty2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
  46. }
  47. const _easycom_uni_datetime_picker = () => "../../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js";
  48. const _easycom_su_tabs = () => "../../../sheep/ui/su-tabs/su-tabs.js";
  49. const _easycom_su_sticky = () => "../../../sheep/ui/su-sticky/su-sticky.js";
  50. const _easycom_s_empty = () => "../../../sheep/components/s-empty/s-empty.js";
  51. const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
  52. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  53. if (!Math) {
  54. (_easycom_uni_datetime_picker + _easycom_su_tabs + _easycom_su_sticky + _easycom_s_empty + _easycom_uni_load_more + _easycom_s_layout)();
  55. }
  56. const _sfc_main = {
  57. __name: "money",
  58. setup(__props) {
  59. common_vendor.useCssVars((_ctx) => ({
  60. "05bea019": common_vendor.unref(headerBg)
  61. }));
  62. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/user/wallet_card_bg.png");
  63. const state = common_vendor.reactive({
  64. showMoney: false,
  65. date: [],
  66. // 筛选的时间段
  67. currentTab: 0,
  68. pagination: {
  69. list: [],
  70. total: 0,
  71. pageNo: 1,
  72. pageSize: 8
  73. },
  74. summary: {
  75. totalIncome: 0,
  76. totalExpense: 0
  77. },
  78. loadStatus: "",
  79. today: ""
  80. });
  81. const tabMaps = [
  82. {
  83. name: "全部",
  84. value: ""
  85. },
  86. {
  87. name: "收入",
  88. value: "1"
  89. },
  90. {
  91. name: "支出",
  92. value: "2"
  93. }
  94. ];
  95. const userWallet = common_vendor.computed(() => sheep_index.sheep.$store("user").userWallet);
  96. const dateFilterText = common_vendor.computed(() => {
  97. if (state.date[0] === state.date[1]) {
  98. return state.date[0];
  99. } else {
  100. return state.date.join("~");
  101. }
  102. });
  103. async function getLogList() {
  104. state.loadStatus = "loading";
  105. const { data, code } = await sheep_api_pay_wallet.PayWalletApi.getWalletTransactionPage({
  106. pageNo: state.pagination.pageNo,
  107. pageSize: state.pagination.pageSize,
  108. type: tabMaps[state.currentTab].value,
  109. "createTime[0]": state.date[0] + " 00:00:00",
  110. "createTime[1]": state.date[1] + " 23:59:59"
  111. });
  112. if (code !== 0) {
  113. return;
  114. }
  115. state.pagination.list = common_vendor._.concat(state.pagination.list, data.list);
  116. state.pagination.total = data.total;
  117. state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
  118. }
  119. async function getSummary() {
  120. const { data, code } = await sheep_api_pay_wallet.PayWalletApi.getWalletTransactionSummary({
  121. "createTime": [state.date[0] + " 00:00:00", state.date[1] + " 23:59:59"]
  122. });
  123. if (code !== 0) {
  124. return;
  125. }
  126. state.summary = data;
  127. }
  128. common_vendor.onLoad(() => {
  129. state.today = common_vendor.dayjs().format("YYYY-MM-DD");
  130. state.date = [state.today, state.today];
  131. getLogList();
  132. getSummary();
  133. sheep_index.sheep.$store("user").getWallet();
  134. });
  135. function onChange(e) {
  136. state.currentTab = e.index;
  137. sheep_util_index.resetPagination(state.pagination);
  138. getLogList();
  139. getSummary();
  140. }
  141. function onChangeTime(e) {
  142. state.date[0] = e[0];
  143. state.date[1] = e[e.length - 1];
  144. sheep_util_index.resetPagination(state.pagination);
  145. getLogList();
  146. getSummary();
  147. }
  148. common_vendor.onReachBottom(() => {
  149. if (state.loadStatus === "noMore") {
  150. return;
  151. }
  152. state.pagination.pageNo++;
  153. getLogList();
  154. });
  155. return (_ctx, _cache) => {
  156. return common_vendor.e({
  157. a: common_vendor.o(($event) => state.showMoney = !state.showMoney),
  158. b: common_vendor.n(state.showMoney ? "cicon-eye" : "cicon-eye-off"),
  159. c: common_vendor.t(state.showMoney ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(userWallet.value.balance) : "*****"),
  160. d: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/pay/recharge")),
  161. e: common_vendor.t(dateFilterText.value),
  162. f: common_vendor.o(onChangeTime),
  163. g: common_vendor.o(($event) => state.data = $event),
  164. h: common_vendor.p({
  165. type: "daterange",
  166. end: state.today,
  167. modelValue: state.data
  168. }),
  169. i: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.summary.totalIncome)),
  170. j: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(state.summary.totalExpense)),
  171. k: common_vendor.o(onChange),
  172. l: common_vendor.p({
  173. list: tabMaps,
  174. scrollable: false,
  175. current: state.currentTab
  176. }),
  177. m: state.pagination.total === 0
  178. }, state.pagination.total === 0 ? {
  179. n: common_vendor.p({
  180. text: "暂无数据",
  181. icon: "/static/data-empty.png"
  182. })
  183. } : {}, {
  184. o: state.pagination.total > 0
  185. }, state.pagination.total > 0 ? {
  186. p: common_vendor.f(state.pagination.list, (item, k0, i0) => {
  187. return common_vendor.e({
  188. a: common_vendor.t(item.title),
  189. b: item.price >= 0
  190. }, item.price >= 0 ? {
  191. c: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.price))
  192. } : {
  193. d: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.price))
  194. }, {
  195. e: item.id
  196. });
  197. }),
  198. q: common_vendor.t(common_vendor.unref(sheep_index.sheep).$helper.timeFormat(state.createTime, "yyyy-mm-dd hh:MM:ss"))
  199. } : {}, {
  200. r: state.pagination.total > 0
  201. }, state.pagination.total > 0 ? {
  202. s: common_vendor.p({
  203. status: state.loadStatus,
  204. ["content-text"]: {
  205. contentdown: "上拉加载更多"
  206. }
  207. })
  208. } : {}, {
  209. t: common_vendor.s(_ctx.__cssVars()),
  210. v: common_vendor.p({
  211. title: "钱包"
  212. })
  213. });
  214. };
  215. }
  216. };
  217. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-69f29528"], ["__file", "D:/zx/mall-front-app/pages/user/wallet/money.vue"]]);
  218. wx.createPage(MiniProgramPage);