account.uvue.ts 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. import _easycom_u_icon from '@/components/u-icon/u-icon.vue'
  2. import { ref } from 'vue';
  3. // --- 数据定义 ---
  4. type BillItem = { __$originalPosition?: UTSSourceMapPosition<"BillItem", "pages/index/account.uvue", 195, 7>;
  5. orderId : string;
  6. projectName : string;
  7. amount : number;
  8. splitType : string;
  9. splitDetail : string;
  10. recordTime : string;
  11. };
  12. // ✅ 修复点 2: 初始化时不写泛型 <BillItem[]>,让 TS 自动推断
  13. // 或者写成: const bills = ref<BillItem[]>([]); 然后单独 push,但直接推断最方便
  14. const __sfc__ = defineComponent({
  15. __name: 'account',
  16. setup(__props) {
  17. const __ins = getCurrentInstance()!;
  18. const _ctx = __ins.proxy as InstanceType<typeof __sfc__>;
  19. const _cache = __ins.renderCache;
  20. const totalAsset = ref('1978.2');
  21. const cumulativeIncome = ref('1889');
  22. const frozenIncome = ref('1000');
  23. const availableIncome = ref('889');
  24. const taxiFee = ref('89.2');
  25. const frozenTaxi = ref('50');
  26. const availableTaxi = ref('49.2');
  27. // ✅ 修复点 1: 定义类型 (可以用 interface 或 type)
  28. const bills = ref([
  29. {
  30. orderId: '202506091311123009874638',
  31. projectName: '中式推拿',
  32. amount: 170.00,
  33. splitType: '首单分成',
  34. splitDetail: '基本套餐车费收入 x90%=20\n项目套餐收入 x50%=150',
  35. recordTime: '2025-06-09 13:58'
  36. },
  37. {
  38. orderId: '202506091311123009874638',
  39. projectName: '中式推拿',
  40. amount: 150.00,
  41. splitType: '加钟分成',
  42. splitDetail: '项目套餐收入 x71%+(70%+等级v1)=150',
  43. recordTime: '2025-06-09 13:58'
  44. },
  45. {
  46. orderId: '202506091311123009874638',
  47. projectName: '中式推拿订单退款',
  48. amount: -150.00,
  49. splitType: '首单分成',
  50. splitDetail: '基本套餐车费收入 x90%=20\n项目套餐收入 x50%=150',
  51. recordTime: '2025-06-09 13:58'
  52. },
  53. {
  54. orderId: '',
  55. projectName: '打车费转出',
  56. amount: -50.00,
  57. splitType: '分成',
  58. splitDetail: '打车费转出刘大锤账户:45.00元\n费率:0.1 手续费:5.00元',
  59. recordTime: '2025-06-09 13:58'
  60. }
  61. ] as BillItem[]); // 如果自动推断不准,可以在末尾加 'as BillItem[]' 进行断言
  62. // --- 方法定义 ---
  63. const refreshData = () => {
  64. uni.showLoading({ title: '刷新中...' });
  65. setTimeout(() => {
  66. uni.hideLoading();
  67. uni.showToast({ title: '刷新成功', icon: 'success' });
  68. totalAsset.value = (parseFloat(totalAsset.value) + 0.1).toFixed(1);
  69. }, 800);
  70. };
  71. const handleWithdraw = (type : string) => {
  72. const amount = type === 'income' ? availableIncome.value : '0';
  73. uni.showModal({
  74. title: '提现确认',
  75. content: `确定要提现 ${amount} 元吗?`,
  76. success: (res) => {
  77. if (res.confirm) {
  78. uni.showToast({ title: '提现申请已提交', icon: 'success' });
  79. }
  80. }
  81. });
  82. };
  83. const handleTransfer = (type : string) => {
  84. uni.showModal({
  85. title: '转出确认',
  86. content: '确定要将打车费转出到其他账户吗?',
  87. success: (res) => {
  88. if (res.confirm) {
  89. uni.showToast({ title: '转出成功', icon: 'success' });
  90. }
  91. }
  92. });
  93. };
  94. const viewWithdrawRecords = () => {
  95. uni.showToast({ title: '查看提现记录', icon: 'none' });
  96. };
  97. const viewAllBills = () => {
  98. uni.showToast({ title: '查看全部账单', icon: 'none' });
  99. };
  100. return (): any | null => {
  101. const _component_u_icon = resolveEasyComponent("u-icon",_easycom_u_icon)
  102. return _cE("view", _uM({ class: "page-container" }), [
  103. _cE("view", _uM({ class: "asset-card" }), [
  104. _cE("view", _uM({ class: "total-asset-section row-between" }), [
  105. _cE("text", _uM({ class: "label" }), " 我的资产(元) "),
  106. _cE("view", _uM({ class: "amount-row row-start" }), [
  107. _cE("text", _uM({ class: "amount" }), _tD(totalAsset.value), 1 /* TEXT */),
  108. _cV(_component_u_icon, _uM({
  109. type: "eye",
  110. size: "20",
  111. color: "#333"
  112. }))
  113. ]),
  114. _cE("view", _uM({
  115. class: "refresh-btn row-center",
  116. onClick: refreshData
  117. }), [
  118. _cV(_component_u_icon, _uM({
  119. type: "refresh",
  120. size: "18",
  121. color: "#333"
  122. })),
  123. _cE("text", null, " 刷新 ")
  124. ])
  125. ]),
  126. _cE("view", _uM({ class: "income-section row-start" }), [
  127. _cE("view", _uM({ class: "income-item column" }), [
  128. _cE("view", _uM({ class: "income-header row-start" }), [
  129. _cE("text", _uM({ class: "income-label" }), " 累计收益(元) "),
  130. _cV(_component_u_icon, _uM({
  131. type: "help",
  132. size: "16",
  133. color: "#999"
  134. }))
  135. ]),
  136. _cE("view", _uM({ class: "income-main row-between" }), [
  137. _cE("text", _uM({ class: "income-value" }), _tD(cumulativeIncome.value), 1 /* TEXT */),
  138. _cE("view", _uM({
  139. class: "withdraw-btn",
  140. onClick: () => {handleWithdraw('income')}
  141. }), " 提现 ", 8 /* PROPS */, ["onClick"])
  142. ]),
  143. _cE("view", _uM({ class: "income-detail row-start" }), [
  144. _cE("view", _uM({ class: "detail-item column-center" }), [
  145. _cE("text", _uM({ class: "detail-label" }), " 冻结(元) "),
  146. _cE("text", _uM({ class: "detail-value" }), _tD(frozenIncome.value), 1 /* TEXT */)
  147. ]),
  148. _cE("view", _uM({ class: "divider" })),
  149. _cE("view", _uM({ class: "detail-item column-center" }), [
  150. _cE("text", _uM({ class: "detail-label" }), " 可提现(元) "),
  151. _cE("text", _uM({ class: "detail-value highlight" }), _tD(availableIncome.value), 1 /* TEXT */)
  152. ])
  153. ])
  154. ]),
  155. _cE("view", _uM({ class: "income-item column" }), [
  156. _cE("view", _uM({ class: "income-header row-start" }), [
  157. _cE("text", _uM({ class: "income-label" }), " 打车费(元) "),
  158. _cV(_component_u_icon, _uM({
  159. type: "help",
  160. size: "16",
  161. color: "#999"
  162. }))
  163. ]),
  164. _cE("view", _uM({ class: "income-main row-between" }), [
  165. _cE("text", _uM({ class: "income-value" }), _tD(taxiFee.value), 1 /* TEXT */),
  166. _cE("view", _uM({
  167. class: "transfer-btn",
  168. onClick: () => {handleTransfer('taxi')}
  169. }), " 转出 ", 8 /* PROPS */, ["onClick"])
  170. ]),
  171. _cE("view", _uM({ class: "income-detail row-start" }), [
  172. _cE("view", _uM({ class: "detail-item column-center" }), [
  173. _cE("text", _uM({ class: "detail-label" }), " 冻结(元) "),
  174. _cE("text", _uM({ class: "detail-value" }), _tD(frozenTaxi.value), 1 /* TEXT */)
  175. ]),
  176. _cE("view", _uM({ class: "divider" })),
  177. _cE("view", _uM({ class: "detail-item column-center" }), [
  178. _cE("text", _uM({ class: "detail-label" }), " 可使用(元) "),
  179. _cE("text", _uM({ class: "detail-value highlight" }), _tD(availableTaxi.value), 1 /* TEXT */)
  180. ])
  181. ])
  182. ])
  183. ]),
  184. _cE("view", _uM({
  185. class: "record-entry row-between",
  186. onClick: viewWithdrawRecords
  187. }), [
  188. _cE("text", null, " 提现记录 "),
  189. _cV(_component_u_icon, _uM({
  190. type: "arrowright",
  191. size: "16",
  192. color: "#999"
  193. }))
  194. ])
  195. ]),
  196. _cE("view", _uM({ class: "bill-header row-between" }), [
  197. _cE("text", _uM({ class: "bill-title" }), " 本月账单 "),
  198. _cE("text", _uM({
  199. class: "view-all",
  200. onClick: viewAllBills
  201. }), " 查看全部 ")
  202. ]),
  203. _cE("view", _uM({ class: "bill-list column" }), [
  204. _cE(Fragment, null, RenderHelpers.renderList(bills.value, (bill, idx, __index, _cached): any => {
  205. return _cE("view", _uM({
  206. key: idx,
  207. class: "bill-card column"
  208. }), [
  209. _cE("view", _uM({ class: "order-id-row row-between" }), [
  210. _cE("text", _uM({ class: "order-id" }), " 订单号:" + _tD(bill.orderId), 1 /* TEXT */),
  211. _cV(_component_u_icon, _uM({
  212. type: "arrowright",
  213. size: "16",
  214. color: "#999"
  215. }))
  216. ]),
  217. _cE("view", _uM({ class: "project-amount-row row-between" }), [
  218. _cE("text", _uM({ class: "project-name" }), _tD(bill.projectName), 1 /* TEXT */),
  219. _cE("text", _uM({
  220. class: _nC(['amount', bill.amount > 0 ? 'positive' : 'negative'])
  221. }), _tD(bill.amount > 0 ? '+' : '') + _tD(Math.abs(bill.amount).toFixed(2)), 3 /* TEXT, CLASS */)
  222. ]),
  223. _cE("view", _uM({ class: "split-info column" }), [
  224. _cE("text", _uM({ class: "split-type" }), _tD(bill.splitType), 1 /* TEXT */),
  225. _cE("text", _uM({ class: "split-detail" }), _tD(bill.splitDetail), 1 /* TEXT */)
  226. ]),
  227. _cE("view", _uM({ class: "time-row row-between" }), [
  228. _cE("text", _uM({ class: "time-label" }), " 记录时间 "),
  229. _cE("text", _uM({ class: "time-value" }), _tD(bill.recordTime), 1 /* TEXT */)
  230. ])
  231. ])
  232. }), 128 /* KEYED_FRAGMENT */)
  233. ])
  234. ])
  235. }
  236. }
  237. })
  238. export default __sfc__
  239. const GenPagesIndexAccountStyles = [_uM([["row-between", _pS(_uM([["flexDirection", "row"], ["justifyContent", "space-between"], ["alignItems", "center"]]))], ["row-start", _pS(_uM([["flexDirection", "row"], ["alignItems", "center"]]))], ["row-center", _pS(_uM([["flexDirection", "row"], ["justifyContent", "center"], ["alignItems", "center"]]))], ["column", _pS(_uM([["flexDirection", "column"]]))], ["column-center", _pS(_uM([["flexDirection", "column"], ["justifyContent", "center"], ["alignItems", "center"]]))], ["page-container", _pS(_uM([["backgroundColor", "#f5f6f8"], ["paddingBottom", "40rpx"]]))], ["asset-card", _pS(_uM([["backgroundImage", "linear-gradient(180deg, #fff9e6 0%, #ffeaa7 100%)"], ["backgroundColor", "rgba(0,0,0,0)"], ["marginTop", "20rpx"], ["marginRight", "20rpx"], ["marginBottom", "20rpx"], ["marginLeft", "20rpx"], ["borderTopLeftRadius", "16rpx"], ["borderTopRightRadius", "16rpx"], ["borderBottomRightRadius", "16rpx"], ["borderBottomLeftRadius", "16rpx"], ["paddingTop", "30rpx"], ["paddingRight", "30rpx"], ["paddingBottom", "30rpx"], ["paddingLeft", "30rpx"], ["boxShadow", "0 4rpx 12rpx rgba(0, 0, 0, 0.08)"]]))], ["total-asset-section", _pS(_uM([["marginBottom", "30rpx"]]))], ["label", _pS(_uM([["fontSize", "26rpx"], ["color", "#666666"]]))], ["amount", _uM([["", _uM([["fontSize", "48rpx"], ["fontWeight", "bold"], ["color", "#333333"]])], [".positive", _uM([["color", "#ff4d4f"], ["fontSize", "32rpx"], ["fontWeight", "bold"]])], [".negative", _uM([["color", "#333333"], ["fontSize", "32rpx"], ["fontWeight", "bold"]])]])], ["refresh-btn", _pS(_uM([["paddingTop", "10rpx"], ["paddingRight", "20rpx"], ["paddingBottom", "10rpx"], ["paddingLeft", "20rpx"], ["backgroundImage", "none"], ["backgroundColor", "#ffffff"], ["borderTopLeftRadius", "30rpx"], ["borderTopRightRadius", "30rpx"], ["borderBottomRightRadius", "30rpx"], ["borderBottomLeftRadius", "30rpx"], ["borderTopWidth", "1rpx"], ["borderRightWidth", "1rpx"], ["borderBottomWidth", "1rpx"], ["borderLeftWidth", "1rpx"], ["borderTopStyle", "solid"], ["borderRightStyle", "solid"], ["borderBottomStyle", "solid"], ["borderLeftStyle", "solid"], ["borderTopColor", "#dddddd"], ["borderRightColor", "#dddddd"], ["borderBottomColor", "#dddddd"], ["borderLeftColor", "#dddddd"], ["fontSize", "24rpx"], ["color", "#333333"]]))], ["income-section", _pS(_uM([["marginBottom", "20rpx"]]))], ["income-item", _pS(_uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"]]))], ["income-label", _pS(_uM([["fontSize", "24rpx"], ["color", "#666666"]]))], ["income-value", _pS(_uM([["fontSize", "40rpx"], ["fontWeight", "bold"], ["color", "#333333"]]))], ["withdraw-btn", _pS(_uM([["fontSize", "24rpx"], ["paddingTop", "8rpx"], ["paddingRight", "20rpx"], ["paddingBottom", "8rpx"], ["paddingLeft", "20rpx"], ["borderTopLeftRadius", "20rpx"], ["borderTopRightRadius", "20rpx"], ["borderBottomRightRadius", "20rpx"], ["borderBottomLeftRadius", "20rpx"], ["backgroundImage", "none"], ["backgroundColor", "#ffffff"], ["borderTopWidth", "1rpx"], ["borderRightWidth", "1rpx"], ["borderBottomWidth", "1rpx"], ["borderLeftWidth", "1rpx"], ["borderTopStyle", "solid"], ["borderRightStyle", "solid"], ["borderBottomStyle", "solid"], ["borderLeftStyle", "solid"], ["borderTopColor", "#ff9900"], ["borderRightColor", "#ff9900"], ["borderBottomColor", "#ff9900"], ["borderLeftColor", "#ff9900"], ["color", "#ff9900"]]))], ["transfer-btn", _pS(_uM([["fontSize", "24rpx"], ["paddingTop", "8rpx"], ["paddingRight", "20rpx"], ["paddingBottom", "8rpx"], ["paddingLeft", "20rpx"], ["borderTopLeftRadius", "20rpx"], ["borderTopRightRadius", "20rpx"], ["borderBottomRightRadius", "20rpx"], ["borderBottomLeftRadius", "20rpx"], ["backgroundImage", "none"], ["backgroundColor", "#ffffff"], ["borderTopWidth", "1rpx"], ["borderRightWidth", "1rpx"], ["borderBottomWidth", "1rpx"], ["borderLeftWidth", "1rpx"], ["borderTopStyle", "solid"], ["borderRightStyle", "solid"], ["borderBottomStyle", "solid"], ["borderLeftStyle", "solid"], ["borderTopColor", "#52c41a"], ["borderRightColor", "#52c41a"], ["borderBottomColor", "#52c41a"], ["borderLeftColor", "#52c41a"], ["color", "#52c41a"]]))], ["income-detail", _pS(_uM([["backgroundImage", "none"], ["backgroundColor", "rgba(255,255,255,0.6)"], ["borderTopLeftRadius", "12rpx"], ["borderTopRightRadius", "12rpx"], ["borderBottomRightRadius", "12rpx"], ["borderBottomLeftRadius", "12rpx"], ["paddingTop", "15rpx"], ["paddingRight", "15rpx"], ["paddingBottom", "15rpx"], ["paddingLeft", "15rpx"]]))], ["detail-item", _pS(_uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"]]))], ["detail-label", _pS(_uM([["fontSize", "22rpx"], ["color", "#999999"]]))], ["detail-value", _uM([["", _uM([["fontSize", "28rpx"], ["fontWeight", "bold"], ["color", "#333333"]])], [".highlight", _uM([["color", "#ff9900"]])]])], ["divider", _pS(_uM([["width", "1rpx"], ["backgroundImage", "none"], ["backgroundColor", "#dddddd"], ["marginTop", 0], ["marginRight", "10rpx"], ["marginBottom", 0], ["marginLeft", "10rpx"]]))], ["record-entry", _pS(_uM([["paddingTop", "20rpx"], ["paddingRight", 0], ["paddingBottom", "20rpx"], ["paddingLeft", 0], ["borderTopWidth", "1rpx"], ["borderTopStyle", "solid"], ["borderTopColor", "rgba(0,0,0,0.05)"], ["fontSize", "28rpx"], ["color", "#333333"]]))], ["bill-header", _pS(_uM([["paddingTop", "20rpx"], ["paddingRight", "30rpx"], ["paddingBottom", "20rpx"], ["paddingLeft", "30rpx"], ["marginTop", "20rpx"]]))], ["bill-title", _pS(_uM([["fontSize", "32rpx"], ["fontWeight", "bold"], ["color", "#333333"]]))], ["view-all", _pS(_uM([["fontSize", "26rpx"], ["color", "#666666"]]))], ["bill-list", _pS(_uM([["paddingTop", 0], ["paddingRight", "20rpx"], ["paddingBottom", 0], ["paddingLeft", "20rpx"]]))], ["bill-card", _pS(_uM([["backgroundImage", "none"], ["backgroundColor", "#ffffff"], ["borderTopLeftRadius", "16rpx"], ["borderTopRightRadius", "16rpx"], ["borderBottomRightRadius", "16rpx"], ["borderBottomLeftRadius", "16rpx"], ["paddingTop", "30rpx"], ["paddingRight", "30rpx"], ["paddingBottom", "30rpx"], ["paddingLeft", "30rpx"], ["boxShadow", "0 2rpx 8rpx rgba(0, 0, 0, 0.04)"]]))], ["order-id-row", _pS(_uM([["fontSize", "26rpx"], ["color", "#666666"]]))], ["project-name", _pS(_uM([["fontSize", "30rpx"], ["fontWeight", "bold"], ["color", "#333333"]]))], ["split-info", _pS(_uM([["fontSize", "24rpx"], ["color", "#999999"], ["lineHeight", 1.4]]))], ["split-type", _pS(_uM([["fontWeight", "400"], ["color", "#666666"]]))], ["time-row", _pS(_uM([["fontSize", "24rpx"], ["color", "#999999"]]))]])]