index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <template>
  2. <view>
  3. <view class="goods-section">
  4. <view class="g-item" style="padding-top: 10px;">
  5. <view class="right">
  6. <view class="price-box">
  7. <text class="font12">¥</text>
  8. <text class="price">{{ ((state.detail.amount) / 100).toFixed(2) }}</text>
  9. <text class="font12">元</text>
  10. </view>
  11. <block class="price-dsc">洗车消费</block>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="yt-list">
  16. <view class="yt-list-cell b-b">
  17. <text class="cell-tit clamp">订单编号</text>
  18. <text class="cell-tip copy" @click="handleCopy">{{ state.detail.orderId }}
  19. <uv-icon name="info-circle"></uv-icon>
  20. </text>
  21. </view>
  22. <view class="yt-list-cell b-b">
  23. <text class="cell-tit clamp">总消费金额</text>
  24. <text class="cell-tip red">-¥{{ ((state.detail.amount) / 100).toFixed(2) }}元</text>
  25. </view>
  26. <view class="yt-list-cell b-b">
  27. <text class="cell-tit clamp">充值款支付金额</text>
  28. <text class="cell-tip red">-¥{{ ((state.detail.rechargePayment) / 100).toFixed(2) }}元</text>
  29. </view>
  30. <view class="yt-list-cell b-b">
  31. <text class="cell-tit clamp">赠款支付金额</text>
  32. <text class="cell-tip red">-¥{{ ((state.detail.grantsPayment) / 100).toFixed(2) }}元</text>
  33. </view>
  34. <view class="yt-list-cell b-b">
  35. <text class="cell-tit clamp">优惠金额</text>
  36. <text class="cell-tip red">-¥{{ ((state.detail.discountMoney) / 100).toFixed(2) }}元</text>
  37. </view>
  38. <view class="yt-list-cell b-b">
  39. <text class="cell-tit clamp">订单状态</text>
  40. <text class="cell-tip" :class="state.detail.orderStatus==0?'primary':(state.detail.orderStatus==1?'success':'error')">
  41. {{ fmtDictName('Order.status', state.detail.orderStatus) }}
  42. </text>
  43. </view>
  44. <view class="yt-list-cell b-b">
  45. <text class="cell-tit clamp">支付状态</text>
  46. <text class="cell-tip" :class="state.detail.payStatus==0?'primary':(state.detail.payStatus==1?'success':'error')">
  47. {{ fmtDictName('Order.pay', state.detail.payStatus) }}
  48. </text>
  49. </view>
  50. <view class="yt-list-cell b-b">
  51. <text class="cell-tit clamp">开始时间</text>
  52. <text class="cell-tip">{{ fmtDateTime(state.detail.startTime) }}</text>
  53. </view>
  54. <view class="yt-list-cell b-b">
  55. <text class="cell-tit clamp">结束时间</text>
  56. <text class="cell-tip">{{ fmtDateTime(state.detail.endTime) }}</text>
  57. </view>
  58. <view class="yt-list-cell desc-cell">
  59. <text class="cell-tit clamp">备注</text>
  60. {{ state.detail.remark }}
  61. </view>
  62. <!-- <view class="yt-list-cell b-b">
  63. <text class="cell-tit clamp">交易时间</text>
  64. <text class="cell-tip">{{ fmtDateTime(state.detail.transactionTime) }}</text>
  65. </view>-->
  66. </view>
  67. <view class="btn">
  68. <!-- <view class="btn_2" @click="jump_torefund(my_order.order_id)">退款</view>-->
  69. </view>
  70. <view class="w100 gap"></view>
  71. <!-- 金额明细 -->
  72. <view class="order-item ml5 font14 color-info">费用明细</view>
  73. <!-- <view class="yt-list">
  74. <view class="yt-list-cell b-b">
  75. <text class="cell-tit clamp">订单编号</text>
  76. <text class="cell-tip copy" @click="handleCopy">{{ state.detail.orderNo }}
  77. <uv-icon name="info-circle"></uv-icon>
  78. </text>
  79. </view>
  80. </view>-->
  81. <view class="order-item_header">
  82. <view class="order-item_header_left">
  83. <text class="order-item_header_left_title">项目</text>
  84. <text class="order-item_header_left_price">时长</text>
  85. <text class="order-item_header_left_num">单价</text>
  86. <text class="order-item_header_left_total">小计</text>
  87. </view>
  88. </view>
  89. <view class="order-item_body">
  90. <view class="order-item_body_item" v-for="item in state.detail.orderItems" :key="item.id">
  91. <view class="order-item_body_item_left">
  92. <text class="order-item_body_item_left_name clamp">{{ item.name }}</text>
  93. <text class="order-item_body_item_left_num">{{ item.seconds }}</text>
  94. <text class="order-item_body_item_left_price">{{ item.price }}</text>
  95. <text class="order-item_body_item_left_total">¥{{ item.amount }}元</text>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </template>
  101. <script setup lang="ts">
  102. import {onHide, onShow, onLoad} from "@dcloudio/uni-app";
  103. import {reactive} from "vue";
  104. import {get} from "@/utils/https";
  105. import {fmtDictName, fmtDateTime, fmtDuration, fmtMoney} from "@/utils/common";
  106. const initState = () => ({
  107. detail: {
  108. orderItems:[] as any[]
  109. } as any
  110. })
  111. const state = reactive(initState())
  112. onLoad((options: any) => {
  113. console.log("onshow", options)
  114. let user = getApp<any>().globalData.user;
  115. if (!user || !user.id) {
  116. uni.showToast({
  117. title: '请先登录',
  118. icon: 'none'
  119. })
  120. setTimeout(() => {
  121. uni.redirectTo({url: '/pages/index/index'})
  122. }, 200)
  123. return;
  124. }
  125. let {orderNo, id, type} = options;
  126. get(`/wash-order/detailWashOrder?userId=${user.id}&orderId=${orderNo}`).then((res: any) => {
  127. state.detail = res;
  128. state.detail.orderItems = res.detail?.filter((k: any) => k.amount > 0 || k.seconds > 0).map((s: any) => {
  129. return {
  130. name: fmtDictName('Order.feeType',s.name),
  131. seconds: fmtDuration(s.seconds*1000),
  132. price: fmtMoney(s.price),
  133. amount: fmtMoney(s.amount),
  134. }
  135. })
  136. console.log(state.detail)
  137. })
  138. })
  139. onHide(() => {
  140. Object.assign(state, initState());
  141. })
  142. const handleCopy = () => {
  143. if (!state.detail.orderNo) return;
  144. uni.setClipboardData({
  145. data: state.detail.orderNo,
  146. success: function () {
  147. uni.showToast({
  148. title: '复制成功',
  149. icon: 'success',
  150. })
  151. }
  152. })
  153. }
  154. </script>
  155. <style lang="scss" scoped>
  156. page {
  157. background: #f8f8f8;
  158. padding-bottom: 100rpx;
  159. }
  160. .copy {
  161. color: $uni-color-primary !important;
  162. }
  163. .goods-section {
  164. margin-top: 16rpx;
  165. background: #fff;
  166. padding-bottom: 1px;
  167. .g-header {
  168. display: flex;
  169. align-items: center;
  170. height: 84rpx;
  171. padding: 0 30rpx;
  172. position: relative;
  173. }
  174. .logo {
  175. display: block;
  176. width: 50rpx;
  177. height: 50rpx;
  178. border-radius: 100px;
  179. }
  180. .name {
  181. font-size: 30rpx;
  182. color: #606266;
  183. margin-left: 24rpx;
  184. }
  185. .g-item {
  186. display: flex;
  187. margin: 20rpx 30rpx;
  188. image {
  189. flex-shrink: 0;
  190. display: block;
  191. width: 140rpx;
  192. height: 140rpx;
  193. border-radius: 4rpx;
  194. }
  195. .right {
  196. flex: 1;
  197. padding-left: 24rpx;
  198. overflow: hidden;
  199. text-align: center;
  200. }
  201. .title {
  202. font-size: 30rpx;
  203. color: #303133;
  204. }
  205. .spec {
  206. font-size: 26rpx;
  207. color: #909399;
  208. }
  209. .price-box {
  210. /* display: flex; */
  211. /* align-items: center; */
  212. color: #303133;
  213. padding-top: 10rpx;
  214. .price {
  215. margin-bottom: 4rpx;
  216. font-size: 48rpx;
  217. }
  218. .number {
  219. font-size: 26rpx;
  220. color: #606266;
  221. margin-left: 20rpx;
  222. }
  223. }
  224. .price-dsc {
  225. font-size: 26rpx;
  226. color: $uni-text-color-grey;
  227. }
  228. .step-box {
  229. position: relative;
  230. }
  231. }
  232. }
  233. .yt-list {
  234. margin-top: 16rpx;
  235. background: #fff;
  236. }
  237. .yt-list-cell {
  238. display: flex;
  239. align-items: center;
  240. padding: 10rpx 30rpx 10rpx 40rpx;
  241. line-height: 50rpx;
  242. position: relative;
  243. &.cell-hover {
  244. background: #fafafa;
  245. }
  246. &.b-b:after {
  247. left: 30rpx;
  248. }
  249. .cell-icon {
  250. height: 32rpx;
  251. width: 32rpx;
  252. font-size: 22rpx;
  253. color: #fff;
  254. text-align: center;
  255. line-height: 32rpx;
  256. background: #f85e52;
  257. border-radius: 4rpx;
  258. margin-right: 12rpx;
  259. &.hb {
  260. background: #ffaa0e;
  261. }
  262. &.lpk {
  263. background: #3ab54a;
  264. }
  265. }
  266. .cell-more {
  267. align-self: center;
  268. font-size: 24rpx;
  269. color: #909399;
  270. margin-left: 8rpx;
  271. margin-right: -10upx;
  272. }
  273. .cell-tit {
  274. flex: 1;
  275. font-size: 26rpx;
  276. color: #909399;
  277. margin-right: 10rpx;
  278. }
  279. .cell-tip {
  280. font-size: 26rpx;
  281. color: #303133;
  282. &.disabled {
  283. color: #909399;
  284. }
  285. &.active {
  286. color: #fa436a;
  287. }
  288. &.red {
  289. color: #fa436a;
  290. }
  291. }
  292. &.desc-cell {
  293. .cell-tit {
  294. max-width: 90rpx;
  295. }
  296. }
  297. .desc {
  298. flex: 1;
  299. font-size: 28rpx;
  300. color: #303133;
  301. }
  302. }
  303. .primary {
  304. color: $uni-color-primary !important;
  305. }
  306. .success {
  307. color: $uni-color-success !important;
  308. }
  309. .error {
  310. color: $uni-color-error !important;
  311. }
  312. .gap {
  313. width: 100%;
  314. height: 36rpx;
  315. background-color: #f5f3f3;
  316. margin-top: 15rpx;
  317. margin-bottom: 10rpx;
  318. }
  319. .order-item{
  320. &_header{
  321. width: 100%;
  322. &_left{
  323. padding:5px;
  324. width: 100%;
  325. background-color: #eeefff;
  326. color: #2c405a;
  327. font-size: 16px;
  328. display: inline-flex;
  329. justify-content: space-around;
  330. &_title,&_price,&_total,&_num{
  331. width: 25%;
  332. text-align: center;
  333. }
  334. }
  335. }
  336. &_body{
  337. width: 100%;
  338. &_item{
  339. font-size: 14px;
  340. &_left{
  341. display: inline-flex;
  342. justify-content: space-around;
  343. width: 100%;
  344. &_left,&_price,&_total,&_num,&_name{
  345. width: 25%;
  346. text-align: center;
  347. border: 1px solid #ccc;
  348. border-right: none;
  349. border-top: none;
  350. }
  351. }
  352. }
  353. }
  354. }
  355. </style>