index.vue 8.7 KB

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