index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <view class="detail-page-container">
  3. <!-- 1. 顶部自定义导航栏:白色背景 + 黑色文字 -->
  4. <view class="white-nav-section" :style="{ paddingTop: statusBarHeight + 'px' }">
  5. <view class="custom-nav-bar">
  6. <view class="back-icon" @click="goBack">
  7. <view class="arrow-left"></view>
  8. </view>
  9. <text class="nav-title">订单详情</text>
  10. <view class="placeholder-right"></view>
  11. </view>
  12. </view>
  13. <!-- 2. 状态横幅区域:不再包含状态栏边距 -->
  14. <view class="status-banner-container" :class="order.statusType" id="nav-header">
  15. <view class="status-banner-content">
  16. <view class="header-main">
  17. <text class="status-title">{{ order.statusName }}</text>
  18. <text class="status-sub">{{ statusSubText }}</text>
  19. </view>
  20. <view class="header-icon-wrap">
  21. <view class="status-visual-icon"></view>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- 2. 主内容滚动区:计算锁定高度以支持 100% 滚动 -->
  26. <scroll-view scroll-y class="main-content-scroll" :style="{ height: scrollHeight }" :show-scrollbar="false">
  27. <view class="detail-inner-box">
  28. <!-- 卡片:规格清单 (支持多个型号展现) -->
  29. <view class="model-item-card-inner" v-for="(model, mIdx) in (order.models || [order])" :key="mIdx">
  30. <view class="data-group-card" :class="{ 'first-card': mIdx === 0 }">
  31. <view class="card-head">规格清单 #{{ mIdx + 1 }}</view>
  32. <view class="data-item"><text class="l">产品型号</text><text class="v bold">{{ model.type }}</text>
  33. </view>
  34. <view class="data-item"><text class="l">型号名称</text><text class="v">{{ model.typeName ||
  35. '铝型材主料'}}</text></view>
  36. <view class="data-item"><text class="l">型材材质</text><text class="v">{{ model.material ||
  37. '6063-T5'}}</text></view>
  38. <view class="line-split"></view>
  39. <view class="data-item"><text class="l">表面处理</text><text class="v">{{ model.surface }}</text>
  40. </view>
  41. <view class="data-item"><text class="l">包装方式</text><text class="v">{{ model.package ||
  42. '普通包装'}}</text></view>
  43. <view class="line-split"></view>
  44. <view class="data-item"><text class="l">订单长度</text><text class="v">{{ model.length }} mm</text>
  45. </view>
  46. <view class="data-item"><text class="l">型材壁厚</text><text class="v">{{ model.wallThickness ||
  47. '1.2'}} mm</text></view>
  48. <view class="data-item"><text class="l">需求支数</text><text class="v highlight">{{ model.count }}
  49. 支</text></view>
  50. </view>
  51. </view>
  52. <!-- 卡片:订单详情 -->
  53. <view class="data-group-card shadow-less">
  54. <view class="card-head">订单详情</view>
  55. <view class="data-item"><text class="l">订单单号</text><text
  56. class="v selectable">{{ order.orderNo }}</text></view>
  57. <!-- 新增:ERP单号 (特定状态下显示) -->
  58. <view class="data-item" v-if="[2, 3, 4].includes(order.status)">
  59. <text class="l">ERP 单号</text>
  60. <text class="v selectable erp-no">{{ order.erpNo || 'ERP' + order.orderNo.slice(-8) }}</text>
  61. </view>
  62. <view class="data-item"><text class="l">下单日期</text><text class="v">{{ order.time }}</text></view>
  63. <view class="data-item"><text class="l">支付方式</text><text class="v">月结扣款</text></view>
  64. </view>
  65. <!-- 底部占位 -->
  66. <view class="list-bottom-placeholder"></view>
  67. </view>
  68. </scroll-view>
  69. <!-- 3. 底部固定操作栏 -->
  70. <view class="detail-action-bar-fixed" id="footer-bar">
  71. <view class="action-btn-wrap" v-if="order.status === 1">
  72. <button class="action-btn cancel" @click="doCancel">撤销该订单</button>
  73. <button class="action-btn primary" @click="callSales">呼叫业务员</button>
  74. </view>
  75. <view class="action-btn-wrap single" v-else>
  76. <button class="action-btn primary" @click="goHome">再下一单</button>
  77. </view>
  78. <view class="safe-area-bottom-support"></view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. export default {
  84. data() {
  85. return {
  86. statusBarHeight: 20,
  87. footerHeight: 80, // px
  88. headerHeight: 120, // px
  89. order: {
  90. orderNo: '-',
  91. status: 1,
  92. statusName: '加载中',
  93. statusType: 'pending',
  94. models: [],
  95. erpNo: '',
  96. time: '-'
  97. }
  98. }
  99. },
  100. computed: {
  101. statusSubText() {
  102. const map = {
  103. pending: '您的订单已提交,正在排队等待审核...',
  104. process: '审核已完成,正在由相关主管签批...',
  105. making: '订单已入库排产,工厂正在全力生产中...',
  106. finish: '该订单生产已完成并正式入库。',
  107. expired: '该订单已由客户主动撤销。'
  108. };
  109. return map[this.order.statusType] || '订单状态更新中';
  110. },
  111. scrollHeight() {
  112. // 获取系统安全区域
  113. const info = uni.getSystemInfoSync();
  114. const safeBottom = info.safeAreaInsets ? info.safeAreaInsets.bottom : 0;
  115. // 动态计算滚动区高度:屏幕总高 - 顶部高(状态栏+导航栏+横幅) - 底部固定栏(内含安全区)
  116. // 顶部高度估算:statusBarHeight + 44(nav) + 120(banner)
  117. return `calc(100vh - ${this.statusBarHeight + 164}px - ${80 + safeBottom}px)`;
  118. }
  119. },
  120. onLoad(options) {
  121. const info = uni.getSystemInfoSync();
  122. this.statusBarHeight = info.statusBarHeight;
  123. if (options.data) {
  124. try {
  125. this.order = JSON.parse(decodeURIComponent(options.data));
  126. } catch (e) { console.error('Data Error'); }
  127. }
  128. },
  129. methods: {
  130. goBack() { uni.navigateBack(); },
  131. doCancel() {
  132. uni.showModal({
  133. title: '确认撤销',
  134. content: '订单撤销后将流转至已撤销状态,确定吗?',
  135. confirmColor: '#ff3b30',
  136. success: (res) => {
  137. if (res.confirm) {
  138. this.order.status = 0;
  139. this.order.statusName = '已撤销';
  140. this.order.statusType = 'expired';
  141. uni.showToast({ title: '撤销成功' });
  142. }
  143. }
  144. });
  145. },
  146. callSales() { uni.makePhoneCall({ phoneNumber: '13888888888' }); },
  147. goHome() { uni.reLaunch({ url: '/pages/order/index' }); }
  148. }
  149. }
  150. </script>
  151. <style scoped>
  152. /deep/ ::-webkit-scrollbar {
  153. display: none !important;
  154. width: 0 !important;
  155. height: 0 !important;
  156. -webkit-appearance: none;
  157. background: transparent;
  158. }
  159. .detail-page-container {
  160. width: 100vw;
  161. height: 100vh;
  162. background: #f8fbfd;
  163. display: flex;
  164. flex-direction: column;
  165. overflow: hidden;
  166. position: relative;
  167. }
  168. .white-nav-section {
  169. background: #fff;
  170. width: 100%;
  171. flex-shrink: 0;
  172. }
  173. .custom-nav-bar {
  174. height: 44px;
  175. display: flex;
  176. align-items: center;
  177. justify-content: space-between;
  178. padding: 0 30rpx;
  179. }
  180. .back-icon {
  181. width: 60rpx;
  182. height: 44px;
  183. display: flex;
  184. align-items: center;
  185. }
  186. .arrow-left {
  187. width: 20rpx;
  188. height: 20rpx;
  189. border-left: 4rpx solid #333;
  190. border-bottom: 4rpx solid #333;
  191. transform: rotate(45deg);
  192. margin-left: 10rpx;
  193. }
  194. .nav-title {
  195. font-size: 34rpx;
  196. font-weight: bold;
  197. color: #1a1a1a;
  198. }
  199. .placeholder-right {
  200. width: 60rpx;
  201. }
  202. .status-banner-container {
  203. color: #fff;
  204. flex-shrink: 0;
  205. }
  206. .status-banner-container.pending {
  207. background: linear-gradient(135deg, #C1001C 0%, #FF4D4F 100%);
  208. }
  209. .status-banner-container.process {
  210. background: linear-gradient(135deg, #FF6A00 0%, #EE0979 100%);
  211. }
  212. .status-banner-container.making {
  213. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  214. }
  215. .status-banner-container.finish {
  216. background: linear-gradient(135deg, #2af598 0%, #009efd 100%);
  217. }
  218. .status-banner-container.expired {
  219. background: linear-gradient(135deg, #868f96 0%, #596164 100%);
  220. }
  221. /* 状态横幅内容 */
  222. .status-banner-content {
  223. padding: 40rpx;
  224. padding-bottom: 60rpx;
  225. display: flex;
  226. justify-content: space-between;
  227. align-items: center;
  228. }
  229. .header-main {
  230. flex: 1;
  231. }
  232. .status-title {
  233. font-size: 48rpx;
  234. font-weight: bold;
  235. display: block;
  236. margin-bottom: 12rpx;
  237. }
  238. .status-sub {
  239. font-size: 26rpx;
  240. opacity: 0.9;
  241. }
  242. .status-visual-icon {
  243. width: 60rpx;
  244. height: 60rpx;
  245. border: 4rpx solid rgba(255, 255, 255, 0.3);
  246. border-radius: 50%;
  247. opacity: 0.6;
  248. }
  249. /* 修正:移除负边距,并明确滚动方向 */
  250. .main-content-scroll {
  251. width: 100%;
  252. flex: 1;
  253. }
  254. .detail-inner-box {
  255. padding: 30rpx;
  256. padding-top: 10rpx;
  257. }
  258. .data-group-card {
  259. background: #fff;
  260. border-radius: 30rpx;
  261. padding: 40rpx;
  262. margin-bottom: 30rpx;
  263. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.02);
  264. }
  265. /* 第一张卡片增加顶部间隔(红框1优化点) */
  266. .first-card {
  267. margin-top: 20rpx;
  268. }
  269. .card-head {
  270. font-size: 30rpx;
  271. font-weight: bold;
  272. color: #333;
  273. margin-bottom: 30rpx;
  274. border-left: 8rpx solid #C1001C;
  275. padding-left: 20rpx;
  276. }
  277. .line-split {
  278. height: 1rpx;
  279. background: #f5f5f5;
  280. margin: 24rpx 0;
  281. }
  282. .data-item {
  283. display: flex;
  284. justify-content: space-between;
  285. margin-bottom: 24rpx;
  286. font-size: 28rpx;
  287. align-items: center;
  288. }
  289. .l {
  290. color: #999;
  291. }
  292. .v {
  293. color: #333;
  294. font-weight: 500;
  295. }
  296. .v.bold {
  297. font-weight: bold;
  298. font-size: 30rpx;
  299. }
  300. .v.erp-no {
  301. color: #C1001C;
  302. font-weight: bold;
  303. }
  304. .v.highlight {
  305. color: #ff3b30;
  306. font-weight: bold;
  307. font-size: 34rpx;
  308. }
  309. .list-bottom-placeholder {
  310. height: 260rpx;
  311. }
  312. .detail-action-bar-fixed {
  313. position: fixed;
  314. bottom: 0;
  315. left: 0;
  316. right: 0;
  317. background: #fff;
  318. padding: 30rpx 40rpx;
  319. box-shadow: 0 -10rpx 40rpx rgba(0, 0, 0, 0.04);
  320. z-index: 999;
  321. flex-shrink: 0;
  322. }
  323. .action-btn-wrap {
  324. display: flex;
  325. gap: 24rpx;
  326. }
  327. .action-btn {
  328. flex: 1;
  329. height: 96rpx;
  330. border-radius: 48rpx;
  331. display: flex;
  332. align-items: center;
  333. justify-content: center;
  334. font-size: 32rpx;
  335. font-weight: bold;
  336. }
  337. .action-btn.primary {
  338. background: #C1001C;
  339. color: #fff;
  340. border: none;
  341. }
  342. .action-btn.cancel {
  343. background: #fff1f0;
  344. color: #ff3b30;
  345. border: 1rpx solid #ffccc7;
  346. font-weight: normal;
  347. }
  348. .safe-area-bottom-support {
  349. height: constant(safe-area-inset-bottom);
  350. height: env(safe-area-inset-bottom);
  351. }
  352. </style>