爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

340 lines
9.1 KiB

1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
  1. <template>
  2. <view class="inspect-container">
  3. <!-- 顶部导航栏 -->
  4. <view class="nav-bar">
  5. <uni-icons type="left" @tap="goBack" size="24" color="#222" />
  6. <text class="nav-title">步骤一数量确认</text>
  7. <view class="nav-icons">
  8. <uni-icons type="scan" size="24" color="#222" />
  9. </view>
  10. </view>
  11. <view class="main-content">
  12. <!-- 左侧分类导航 -->
  13. <view class="category-nav">
  14. <view v-for="(cat, idx) in categories" :key="cat.name" :class="['category-item', {active: idx === currentCategory}]" @tap="switchCategory(idx)">
  15. <text>{{cat.name}}</text>
  16. <view v-if="cat.badge" class="category-badge">{{cat.badge}}</view>
  17. </view>
  18. </view>
  19. <!-- 右侧商品卡片区 -->
  20. <view class="goods-list">
  21. <view v-for="(item, idx) in currentGoods" :key="item.id" class="goods-card">
  22. <view class="goods-header">
  23. <image :src="item.img" class="goods-img" />
  24. <view class="goods-info">
  25. <view class="goods-title-row">
  26. <text class="goods-name">{{item.name}}</text>
  27. <text class="goods-price">¥ {{item.price}} <text class="goods-unit">/</text></text>
  28. </view>
  29. <text class="goods-desc">{{item.desc}}</text>
  30. </view>
  31. </view>
  32. <view class="goods-row">
  33. <text class="row-label">合格数量</text>
  34. <view class="num-ctrl">
  35. <button class="num-btn" @tap="changeNum(item, 'qualified', -1)">-</button>
  36. <text class="num">{{item.qualified}}</text>
  37. <button class="num-btn" @tap="changeNum(item, 'qualified', 1)">+</button>
  38. </view>
  39. </view>
  40. <view class="goods-row">
  41. <text class="row-label">不合格数量</text>
  42. <view class="num-ctrl">
  43. <button class="num-btn" @tap="changeNum(item, 'unqualified', -1)">-</button>
  44. <text class="num">{{item.unqualified}}</text>
  45. <button class="num-btn" @tap="changeNum(item, 'unqualified', 1)">+</button>
  46. </view>
  47. </view>
  48. <view class="goods-row">
  49. <text class="row-label">总金额</text>
  50. <input class="amount-input" v-model="item.amount" placeholder="请输入金额" />
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 底部操作按钮 -->
  56. <view class="footer-btns">
  57. <button class="btn-outline" @tap="goBack">返回订单详情</button>
  58. <button class="btn-main" @tap="goNext">下一步</button>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import pullRefreshMixin from '../mixins/pullRefreshMixin.js'
  64. export default {
  65. mixins: [pullRefreshMixin],
  66. data() {
  67. return {
  68. categories: [
  69. { name: '羽绒服', badge: 1 },
  70. { name: '鞋子' },
  71. { name: '包包' },
  72. { name: '床被' },
  73. { name: '品牌服饰' },
  74. { name: '不可回收' }
  75. ],
  76. currentCategory: 0,
  77. goodsData: [
  78. // 示例数据结构
  79. [
  80. { id: 1, name: '羽绒服', img: '/static/coat1.png', price: 8, desc: '允许脏破烂,160码以上', qualified: 8, unqualified: 2, amount: '' },
  81. { id: 2, name: '羽绒裤', img: '/static/coat2.png', price: 8, desc: '允许脏破烂,160码以上', qualified: 0, unqualified: 0, amount: '' },
  82. { id: 3, name: '儿童羽绒服', img: '/static/coat3.png', price: 8, desc: '允许脏破烂,160码以上', qualified: 0, unqualified: 0, amount: '' }
  83. ],
  84. // 其他分类...(可补充)
  85. ]
  86. }
  87. },
  88. computed: {
  89. currentGoods() {
  90. return this.goodsData[this.currentCategory] || []
  91. }
  92. },
  93. methods: {
  94. goBack() {
  95. uni.navigateBack()
  96. },
  97. goNext() {
  98. // 跳转到下一步页面,带上质检数据
  99. uni.navigateTo({
  100. url: '/pages/manager/inspect-result'
  101. })
  102. },
  103. switchCategory(idx) {
  104. this.currentCategory = idx
  105. },
  106. changeNum(item, key, delta) {
  107. if (key === 'qualified') {
  108. item.qualified = Math.max(0, (item.qualified || 0) + delta)
  109. } else {
  110. item.unqualified = Math.max(0, (item.unqualified || 0) + delta)
  111. }
  112. },
  113. refreshData() {
  114. // 可根据实际需求刷新商品数据、分类等
  115. // 例如重新请求接口或重置数据
  116. },
  117. async onRefresh() {
  118. await this.refreshData && this.refreshData()
  119. }
  120. },
  121. onPullDownRefresh() {
  122. this.refreshData && this.refreshData()
  123. uni.stopPullDownRefresh()
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. .inspect-container {
  129. min-height: 100vh;
  130. background: #f8f8f8;
  131. display: flex;
  132. flex-direction: column;
  133. }
  134. .nav-bar {
  135. display: flex;
  136. align-items: center;
  137. justify-content: space-between;
  138. height: 56px;
  139. background: #fff;
  140. padding: 0 16px;
  141. box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  142. .nav-title {
  143. font-size: 18px;
  144. font-weight: bold;
  145. flex: 1;
  146. text-align: center;
  147. color: #222;
  148. }
  149. .nav-icons {
  150. display: flex;
  151. align-items: center;
  152. gap: 12px;
  153. }
  154. }
  155. .main-content {
  156. display: flex;
  157. flex: 1;
  158. min-height: 0;
  159. padding: 0 0 100px 0;
  160. }
  161. .category-nav {
  162. width: 90px;
  163. background: #f6f6f6;
  164. border-radius: 24px 0 0 24px;
  165. padding: 24px 0;
  166. display: flex;
  167. flex-direction: column;
  168. align-items: center;
  169. .category-item {
  170. width: 72px;
  171. height: 48px;
  172. border-radius: 16px 0 0 16px;
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. font-size: 16px;
  177. color: #222;
  178. margin-bottom: 12px;
  179. background: #fff;
  180. position: relative;
  181. &.active {
  182. background: #fff7e6;
  183. color: #ffb400;
  184. font-weight: bold;
  185. }
  186. .category-badge {
  187. position: absolute;
  188. top: 6px;
  189. right: 10px;
  190. background: #ff4d4f;
  191. color: #fff;
  192. font-size: 12px;
  193. border-radius: 50%;
  194. width: 18px;
  195. height: 18px;
  196. display: flex;
  197. align-items: center;
  198. justify-content: center;
  199. }
  200. }
  201. }
  202. .goods-list {
  203. flex: 1;
  204. padding: 24px 24px 0 24px;
  205. overflow-y: auto;
  206. }
  207. .goods-card {
  208. background: linear-gradient(180deg, #fff7e6 0%, #fff 100%);
  209. border-radius: 24px;
  210. box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  211. margin-bottom: 24px;
  212. padding: 24px 24px 0 24px;
  213. }
  214. .goods-header {
  215. display: flex;
  216. align-items: center;
  217. margin-bottom: 12px;
  218. .goods-img {
  219. width: 72px;
  220. height: 72px;
  221. border-radius: 16px;
  222. margin-right: 18px;
  223. background: #f8f8f8;
  224. object-fit: contain;
  225. }
  226. .goods-info {
  227. flex: 1;
  228. display: flex;
  229. flex-direction: column;
  230. justify-content: center;
  231. min-width: 0;
  232. .goods-title-row {
  233. display: flex;
  234. align-items: baseline;
  235. .goods-name {
  236. font-size: 18px;
  237. font-weight: bold;
  238. color: #222;
  239. margin-right: 8px;
  240. }
  241. .goods-price {
  242. font-size: 16px;
  243. color: #ffb400;
  244. font-weight: bold;
  245. .goods-unit {
  246. font-size: 14px;
  247. color: #bbb;
  248. }
  249. }
  250. }
  251. .goods-desc {
  252. font-size: 14px;
  253. color: #999;
  254. margin-top: 4px;
  255. }
  256. }
  257. }
  258. .goods-row {
  259. display: flex;
  260. align-items: center;
  261. margin-bottom: 18px;
  262. .row-label {
  263. font-size: 15px;
  264. color: #888;
  265. width: 90px;
  266. flex-shrink: 0;
  267. }
  268. .num-ctrl {
  269. display: flex;
  270. align-items: center;
  271. .num-btn {
  272. width: 40px;
  273. height: 40px;
  274. border-radius: 50%;
  275. background: #f6f6f6;
  276. color: #bbb;
  277. font-size: 24px;
  278. border: none;
  279. display: flex;
  280. align-items: center;
  281. justify-content: center;
  282. margin: 0 8px;
  283. }
  284. .num {
  285. font-size: 18px;
  286. color: #222;
  287. width: 32px;
  288. text-align: center;
  289. }
  290. }
  291. .amount-input {
  292. flex: 1;
  293. height: 40px;
  294. border-radius: 12px;
  295. background: #f6f6f6;
  296. border: none;
  297. font-size: 16px;
  298. color: #222;
  299. padding-left: 12px;
  300. margin-left: 8px;
  301. }
  302. }
  303. .footer-btns {
  304. position: fixed;
  305. left: 0;
  306. right: 0;
  307. bottom: 0;
  308. background: #fff;
  309. display: flex;
  310. gap: 24px;
  311. padding: 16px 24px 32px 24px;
  312. z-index: 101;
  313. .btn-outline {
  314. flex: 1;
  315. height: 48px;
  316. border-radius: 24px;
  317. border: 2px solid #ffd01e;
  318. color: #ffb400;
  319. background: #fff;
  320. font-size: 18px;
  321. font-weight: bold;
  322. box-shadow: none;
  323. padding: 0 18px;
  324. }
  325. .btn-main {
  326. flex: 1;
  327. height: 48px;
  328. border-radius: 24px;
  329. background: linear-gradient(90deg, #ffd01e 0%, #ffac04 100%);
  330. color: #fff;
  331. border: none;
  332. font-size: 18px;
  333. font-weight: bold;
  334. box-shadow: none;
  335. padding: 0 18px;
  336. }
  337. }
  338. </style>