order.uvue.ts 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. import _easycom_u_icon from '@/components/u-icon/u-icon.vue'
  2. import { ref } from 'vue';
  3. // --- 数据 ---
  4. type OrderTag = { __$originalPosition?: UTSSourceMapPosition<"OrderTag", "pages/index/order.uvue", 120, 7>;
  5. text : string;
  6. type : 'orange' | 'green' | 'red';
  7. }
  8. type OrderItem = { __$originalPosition?: UTSSourceMapPosition<"OrderItem", "pages/index/order.uvue", 125, 7>;
  9. id : number;
  10. time : string;
  11. serviceName : string;
  12. tags : OrderTag[];
  13. contact : string;
  14. price : string;
  15. address : string;
  16. distance : string;
  17. income : string;
  18. image : string;
  19. };
  20. // orders data – no need for reactivity, use a plain typed array
  21. const __sfc__ = defineComponent({
  22. __name: 'order',
  23. setup(__props) {
  24. const __ins = getCurrentInstance()!;
  25. const _ctx = __ins.proxy as InstanceType<typeof __sfc__>;
  26. const _cache = __ins.renderCache;
  27. const tabs = ['新订单',
  28. '进行中',
  29. '取消/售后',
  30. '已完成',
  31. '全部'];
  32. const currentTab = ref(0);
  33. const orders : OrderItem[] = [
  34. {
  35. id: 1,
  36. time: '2025-06-18 4:00',
  37. serviceName: '润养SPA',
  38. tags: [
  39. { text: '上门', type: 'orange' } as OrderTag,
  40. { text: '首单', type: 'orange' } as OrderTag,
  41. ],
  42. contact: '刘',
  43. price: '286.6',
  44. address: '烟台 芝罘区楚风一街楚凤花园(烟台吾悦)广场附近',
  45. distance: '2.24',
  46. income: '186.6',
  47. image: '/static/testInfo/demo.png'
  48. },
  49. {
  50. id: 2,
  51. time: '2025-06-18 8:00',
  52. serviceName: '润养SPA',
  53. tags: [
  54. { text: '加钟', type: 'red' } as OrderTag
  55. ],
  56. contact: '刘',
  57. price: '286.6',
  58. address: '烟台 芝罘区楚风一街楚凤花园(烟台吾悦)广场附近',
  59. distance: '2.24',
  60. income: '186.6',
  61. image: '/static/testInfo/demo.png'
  62. }
  63. ] as OrderItem[];
  64. // --- 方法 ---
  65. const onNavigate = (addr : string) => {
  66. uni.showToast({ title: '启动导航', icon: 'none' });
  67. };
  68. // helper used in template to give v-for a typed array source
  69. function tagList(order: OrderItem): OrderTag[] {
  70. return order.tags;
  71. }
  72. const onTransfer = (id : number) => {
  73. uni.showModal({
  74. title: '转单确认',
  75. content: '确定将此订单转给其他技师吗?',
  76. success: (res) => {
  77. if (res.confirm) uni.showToast({ title: '转单成功', icon: 'success' });
  78. }
  79. });
  80. };
  81. const onConfirm = (id : number) => {
  82. uni.showLoading({ title: '处理中...' });
  83. setTimeout(() => {
  84. uni.hideLoading();
  85. uni.showToast({ title: '接单成功', icon: 'success' });
  86. }, 600);
  87. };
  88. return (): any | null => {
  89. const _component_u_icon = resolveEasyComponent("u-icon",_easycom_u_icon)
  90. return _cE("view", _uM({ class: "page-container" }), [
  91. _cE("scroll-view", _uM({
  92. "scroll-x": "",
  93. class: "tab-scroll",
  94. "show-scrollbar": "false",
  95. "enable-flex": true
  96. }), [
  97. _cE("view", _uM({ class: "tab-wrapper" }), [
  98. _cE(Fragment, null, RenderHelpers.renderList(tabs, (tab, index, __index, _cached): any => {
  99. return _cE("view", _uM({
  100. key: index,
  101. class: _nC(['tab-item', currentTab.value === index ? 'active' : '']),
  102. onClick: () => {currentTab.value = index}
  103. }), [
  104. _cE("text", null, _tD(tab), 1 /* TEXT */),
  105. currentTab.value === index
  106. ? _cE("view", _uM({
  107. key: 0,
  108. class: "tab-indicator"
  109. }))
  110. : _cC("v-if", true)
  111. ], 10 /* CLASS, PROPS */, ["onClick"])
  112. }), 64 /* STABLE_FRAGMENT */)
  113. ])
  114. ]),
  115. _cE("view", _uM({ class: "order-list" }), [
  116. _cE(Fragment, null, RenderHelpers.renderList(orders, (order, idx, __index, _cached): any => {
  117. return _cE("view", _uM({
  118. key: order['id'],
  119. class: "order-card"
  120. }), [
  121. _cE("view", _uM({ class: "card-header" }), [
  122. _cE("text", _uM({ class: "time-text" }), " 预约时间:" + _tD(order['time']), 1 /* TEXT */),
  123. _cE("text", _uM({ class: "status-badge paid" }), " 已支付 ")
  124. ]),
  125. _cE("view", _uM({ class: "service-section" }), [
  126. _cE("image", _uM({
  127. src: order['image'],
  128. class: "service-image",
  129. mode: "aspectFill"
  130. }), null, 8 /* PROPS */, ["src"]),
  131. _cE("view", _uM({ class: "service-details" }), [
  132. _cE("view", _uM({ class: "service-title-row" }), [
  133. _cE("text", _uM({ class: "service-name" }), _tD(order['serviceName']), 1 /* TEXT */),
  134. _cE(Fragment, null, RenderHelpers.renderList(tagList(order), (tag, tIdx, __index, _cached): any => {
  135. return _cE("text", _uM({
  136. key: tIdx,
  137. class: _nC(['tag-pill', tag.type])
  138. }), _tD(tag.text), 3 /* TEXT, CLASS */)
  139. }), 128 /* KEYED_FRAGMENT */)
  140. ]),
  141. _cE("view", _uM({ class: "contact-info-row" }), [
  142. _cE("text", _uM({ class: "contact-info" }), " 联系人:" + _tD(order['contact']), 1 /* TEXT */),
  143. _cE("text", _uM({ class: "tag-pill green" }), " 新客 ")
  144. ])
  145. ]),
  146. _cE("text", _uM({ class: "service-price" }), " ¥" + _tD(order.price), 1 /* TEXT */)
  147. ]),
  148. _cE("view", _uM({ class: "address-section" }), [
  149. _cV(_component_u_icon, _uM({
  150. type: "location",
  151. size: "16",
  152. color: "#999999"
  153. })),
  154. _cE("text", _uM({ class: "address-content" }), _tD(order.address), 1 /* TEXT */),
  155. _cE("text", _uM({ class: "distance-text" }), _tD(order.distance) + "km ", 1 /* TEXT */)
  156. ]),
  157. _cE("view", _uM({ class: "income-section" }), [
  158. _cE("text", _uM({ class: "income-label" }), " 预估收入 "),
  159. _cE("view", _uM({ class: "income-value-group" }), [
  160. _cE("text", _uM({ class: "income-main" }), " ¥" + _tD(order.income), 1 /* TEXT */),
  161. _cE("text", _uM({ class: "income-sub" }), " (含路费) ")
  162. ])
  163. ]),
  164. _cE("view", _uM({ class: "action-section" }), [
  165. _cE("view", _uM({
  166. class: "btn btn-nav",
  167. onClick: () => {onNavigate(order.address)}
  168. }), [
  169. _cV(_component_u_icon, _uM({
  170. type: "navigation",
  171. size: "14",
  172. color: "#333333"
  173. })),
  174. _cE("text", null, " 地址导航 ")
  175. ], 8 /* PROPS */, ["onClick"]),
  176. _cE("text", _uM({
  177. class: "btn btn-transfer",
  178. onClick: () => {onTransfer(order.id)}
  179. }), " 我要转单 ", 8 /* PROPS */, ["onClick"]),
  180. _cE("text", _uM({
  181. class: "btn btn-confirm",
  182. onClick: () => {onConfirm(order.id)}
  183. }), " 确认接单 ", 8 /* PROPS */, ["onClick"])
  184. ])
  185. ])
  186. }), 64 /* STABLE_FRAGMENT */)
  187. ])
  188. ])
  189. }
  190. }
  191. })
  192. export default __sfc__
  193. const GenPagesIndexOrderStyles = [_uM([["page-container", _pS(_uM([["backgroundColor", "#f5f6f8"], ["minHeight", "1000rpx"], ["boxSizing", "border-box"]]))], ["tab-scroll", _pS(_uM([["backgroundColor", "#ffffff"], ["height", "88rpx"]]))], ["tab-wrapper", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["alignItems", "center"], ["height", "88rpx"], ["paddingTop", 0], ["paddingRight", "20rpx"], ["paddingBottom", 0], ["paddingLeft", "20rpx"], ["whiteSpace", "nowrap"]]))], ["tab-item", _uM([["", _uM([["position", "relative"], ["paddingTop", 0], ["paddingRight", "30rpx"], ["paddingBottom", 0], ["paddingLeft", "30rpx"], ["height", "88rpx"], ["display", "flex"], ["alignItems", "center"], ["justifyContent", "center"], ["fontSize", "30rpx"], ["color", "#666666"]])], [".active", _uM([["color", "#333333"], ["fontWeight", "bold"]])]])], ["tab-indicator", _pS(_uM([["position", "absolute"], ["bottom", "16rpx"], ["left", 0], ["right", 0], ["marginTop", 0], ["marginRight", "auto"], ["marginBottom", 0], ["marginLeft", "auto"], ["width", "40rpx"], ["height", "6rpx"], ["backgroundColor", "#ffc107"], ["borderTopLeftRadius", "3rpx"], ["borderTopRightRadius", "3rpx"], ["borderBottomRightRadius", "3rpx"], ["borderBottomLeftRadius", "3rpx"]]))], ["order-list", _pS(_uM([["paddingTop", "20rpx"], ["paddingRight", "20rpx"], ["paddingBottom", "20rpx"], ["paddingLeft", "20rpx"], ["display", "flex"], ["flexDirection", "column"]]))], ["order-card", _pS(_uM([["backgroundColor", "#ffffff"], ["borderTopLeftRadius", "16rpx"], ["borderTopRightRadius", "16rpx"], ["borderBottomRightRadius", "16rpx"], ["borderBottomLeftRadius", "16rpx"], ["paddingTop", "30rpx"], ["paddingRight", "30rpx"], ["paddingBottom", "30rpx"], ["paddingLeft", "30rpx"], ["display", "flex"], ["flexDirection", "column"]]))], ["card-header", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["justifyContent", "space-between"], ["alignItems", "center"]]))], ["time-text", _pS(_uM([["fontSize", "28rpx"], ["color", "#333333"], ["fontWeight", "400"]]))], ["status-badge", _uM([["", _uM([["fontSize", "24rpx"], ["paddingTop", "6rpx"], ["paddingRight", "16rpx"], ["paddingBottom", "6rpx"], ["paddingLeft", "16rpx"], ["borderTopLeftRadius", "20rpx"], ["borderTopRightRadius", "20rpx"], ["borderBottomRightRadius", "20rpx"], ["borderBottomLeftRadius", "20rpx"]])], [".paid", _uM([["backgroundColor", "#fff7e6"], ["color", "#ff9900"]])]])], ["service-section", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["alignItems", "flex-start"]]))], ["service-image", _pS(_uM([["width", "110rpx"], ["height", "110rpx"], ["borderTopLeftRadius", "12rpx"], ["borderTopRightRadius", "12rpx"], ["borderBottomRightRadius", "12rpx"], ["borderBottomLeftRadius", "12rpx"], ["backgroundColor", "#f0f0f0"], ["flexShrink", 0]]))], ["service-details", _pS(_uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"], ["display", "flex"], ["justifyContent", "space-between"]]))], ["service-title-row", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["alignItems", "center"]]))], ["service-name", _pS(_uM([["fontSize", "32rpx"], ["fontWeight", "bold"], ["color", "#333333"]]))], ["service-price", _pS(_uM([["fontSize", "34rpx"], ["fontWeight", "bold"], ["color", "#333333"]]))], ["tags-container", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["flexWrap", "wrap"]]))], ["tag-pill", _uM([["", _uM([["fontSize", "22rpx"], ["paddingTop", "4rpx"], ["paddingRight", "12rpx"], ["paddingBottom", "4rpx"], ["paddingLeft", "12rpx"], ["borderTopLeftRadius", "20rpx"], ["borderTopRightRadius", "20rpx"], ["borderBottomRightRadius", "20rpx"], ["borderBottomLeftRadius", "20rpx"], ["borderTopWidth", "1rpx"], ["borderRightWidth", "1rpx"], ["borderBottomWidth", "1rpx"], ["borderLeftWidth", "1rpx"], ["borderTopStyle", "solid"], ["borderRightStyle", "solid"], ["borderBottomStyle", "solid"], ["borderLeftStyle", "solid"], ["lineHeight", 1.2]])], [".orange", _uM([["color", "#ff9900"], ["borderTopColor", "#ff9900"], ["borderRightColor", "#ff9900"], ["borderBottomColor", "#ff9900"], ["borderLeftColor", "#ff9900"], ["backgroundColor", "#fffaf0"]])], [".green", _uM([["color", "#52c41a"], ["borderTopColor", "#52c41a"], ["borderRightColor", "#52c41a"], ["borderBottomColor", "#52c41a"], ["borderLeftColor", "#52c41a"], ["backgroundColor", "#f6ffed"]])], [".red", _uM([["color", "#ff4d4f"], ["borderTopColor", "#ff4d4f"], ["borderRightColor", "#ff4d4f"], ["borderBottomColor", "#ff4d4f"], ["borderLeftColor", "#ff4d4f"], ["backgroundColor", "#fff1f0"]])]])], ["contact-info-row", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["alignItems", "center"]]))], ["contact-info", _pS(_uM([["fontSize", "26rpx"], ["color", "#999999"]]))], ["address-section", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["alignItems", "flex-start"], ["paddingBottom", "20rpx"], ["borderBottomWidth", "1rpx"], ["borderBottomColor", "#f5f5f5"], ["borderBottomStyle", "solid"]]))], ["address-content", _pS(_uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"], ["fontSize", "26rpx"], ["color", "#666666"], ["lineHeight", 1.4]]))], ["distance-text", _pS(_uM([["fontSize", "24rpx"], ["color", "#999999"], ["whiteSpace", "nowrap"], ["marginLeft", "10rpx"]]))], ["income-section", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["justifyContent", "space-between"], ["alignItems", "center"]]))], ["income-label", _pS(_uM([["fontSize", "28rpx"], ["color", "#666666"]]))], ["income-value-group", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["alignItems", "center"]]))], ["income-main", _pS(_uM([["fontSize", "36rpx"], ["fontWeight", "bold"], ["color", "#ff4d4f"]]))], ["income-sub", _pS(_uM([["fontSize", "24rpx"], ["color", "#999999"]]))], ["action-section", _pS(_uM([["display", "flex"], ["flexDirection", "row"], ["justifyContent", "space-between"]]))], ["btn", _pS(_uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"], ["height", "72rpx"], ["borderTopLeftRadius", "36rpx"], ["borderTopRightRadius", "36rpx"], ["borderBottomRightRadius", "36rpx"], ["borderBottomLeftRadius", "36rpx"], ["fontSize", "28rpx"], ["fontWeight", "400"], ["display", "flex"], ["flexDirection", "row"], ["justifyContent", "center"], ["alignItems", "center"]]))], ["btn-nav", _pS(_uM([["backgroundColor", "#f5f5f5"], ["color", "#333333"]]))], ["btn-transfer", _pS(_uM([["backgroundColor", "#ffffff"], ["color", "#ff9900"], ["borderTopWidth", "1rpx"], ["borderRightWidth", "1rpx"], ["borderBottomWidth", "1rpx"], ["borderLeftWidth", "1rpx"], ["borderTopColor", "#ff9900"], ["borderRightColor", "#ff9900"], ["borderBottomColor", "#ff9900"], ["borderLeftColor", "#ff9900"], ["borderTopStyle", "solid"], ["borderRightStyle", "solid"], ["borderBottomStyle", "solid"], ["borderLeftStyle", "solid"]]))], ["btn-confirm", _pS(_uM([["backgroundColor", "#ffc107"], ["color", "#333333"], ["borderTopWidth", "1rpx"], ["borderRightWidth", "1rpx"], ["borderBottomWidth", "1rpx"], ["borderLeftWidth", "1rpx"], ["borderTopColor", "#ffc107"], ["borderRightColor", "#ffc107"], ["borderBottomColor", "#ffc107"], ["borderLeftColor", "#ffc107"], ["borderTopStyle", "solid"], ["borderRightStyle", "solid"], ["borderBottomStyle", "solid"], ["borderLeftStyle", "solid"]]))]])]