index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <view class="traceability-page">
  3. <!-- 顶部导航栏 -->
  4. <uni-nav-bar
  5. fixed="true"
  6. statusBar="true"
  7. left-icon="back"
  8. title="溯源"
  9. background-color="#fff"
  10. color="#000"
  11. @clickLeft="handleBack"
  12. ></uni-nav-bar>
  13. <!-- 主内容区 -->
  14. <view class="content-wrapper">
  15. <!-- 编辑中标签 -->
  16. <view class="edit-tag">编辑中</view>
  17. <!-- 产品图片区域 -->
  18. <view class="product-image-section">
  19. <view class="image-container">
  20. <image class="product-image" :src="productImageSrc" mode="aspectFit"></image>
  21. </view>
  22. </view>
  23. <!-- 产品基本信息区域 -->
  24. <view class="product-info-section">
  25. <view class="info-title">产品基本信息</view>
  26. <view class="info-content">
  27. <u-row gutter="10" align="top" customStyle="margin-bottom: 10px">
  28. <u-col span="6">
  29. <view class="info-item">
  30. <text class="info-label">品名:</text>
  31. <text class="info-value">菝葜菝葜菝葜菝葜菝葜菝葜菝葜菝葜菝葜</text>
  32. </view>
  33. </u-col>
  34. <u-col span="6">
  35. <view class="info-item">
  36. <text class="info-label">产地:</text>
  37. <text class="info-value">湖南怀化</text>
  38. </view>
  39. </u-col>
  40. </u-row>
  41. <u-row gutter="10" align="top" customStyle="margin-bottom: 10px">
  42. <u-col span="6">
  43. <view class="info-item">
  44. <text class="info-label">商品编码:</text>
  45. <text class="info-value">AD0017</text>
  46. </view>
  47. </u-col>
  48. <u-col span="6">
  49. <view class="info-item">
  50. <text class="info-label">批号:</text>
  51. <text class="info-value">25072301</text>
  52. </view>
  53. </u-col>
  54. </u-row>
  55. </view>
  56. <!-- 查看更多信息按钮 -->
  57. <view class="more-info-btn" @click="toggleMoreInfo">
  58. <text>查看更多信息</text>
  59. <image class="dropdown-icon" :src="companyIconSrc" mode="aspectFit"></image>
  60. </view>
  61. </view>
  62. <!-- 功能按钮区域 -->
  63. <view class="function-buttons">
  64. <view class="button-row">
  65. <view class="function-btn" @click="navigateToPurchase">
  66. <image class="btn-icon" :src="cartIconSrc" mode="aspectFit"></image>
  67. <text class="btn-text">采购溯源</text>
  68. </view>
  69. <view class="function-btn" @click="navigateToProduction">
  70. <image class="btn-icon" :src="productionIconSrc" mode="aspectFit"></image>
  71. <text class="btn-text">生产溯源</text>
  72. </view>
  73. <!-- </view>
  74. <view class="button-row"> -->
  75. <view class="function-btn" @click="navigateToQuality">
  76. <image class="btn-icon" :src="qualityIconSrc" mode="aspectFit"></image>
  77. <text class="btn-text">质检溯源</text>
  78. </view>
  79. <view class="function-btn" @click="navigateToCompany">
  80. <image class="btn-icon" :src="companyIconSrc" mode="aspectFit"></image>
  81. <text class="btn-text">企业信息</text>
  82. </view>
  83. </view>
  84. </view>
  85. <!-- 底部装饰 -->
  86. <!-- <view class="bottom-decoration">
  87. <image :src="waveIconSrc" mode="aspectFill"></image>
  88. </view> -->
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. showMoreInfo: false,
  97. // 使用项目中已有的图标路径
  98. productImageSrc: '/static/product/1.svg',
  99. selectIconSrc: '/static/select.svg',
  100. cartIconSrc: '/static/product/2.svg',
  101. productionIconSrc: '/static/product/3.svg',
  102. qualityIconSrc: '/static/product/4.svg',
  103. companyIconSrc: '/static/product/xl.svg',
  104. waveIconSrc: '/static/svg-icons/wave.svg'
  105. };
  106. },
  107. methods: {
  108. handleBack() {
  109. // 返回上一页
  110. uni.navigateBack();
  111. },
  112. toggleMoreInfo() {
  113. // 切换显示更多信息
  114. this.showMoreInfo = !this.showMoreInfo;
  115. },
  116. navigateToPurchase() {
  117. // 跳转到采购溯源页面
  118. // uni.showToast({
  119. // title: '采购溯源功能待实现',
  120. // icon: 'none'
  121. // });
  122. uni.navigateTo({
  123. url: '/pages/traceability/traceabilityCode/purchase'
  124. })
  125. },
  126. navigateToProduction() {
  127. // 跳转到生产溯源页面
  128. // uni.showToast({
  129. // title: '生产溯源功能待实现',
  130. // icon: 'none'
  131. // });
  132. uni.navigateTo({
  133. url: '/pages/traceability/traceabilityCode/production'
  134. })
  135. },
  136. navigateToQuality() {
  137. // 跳转到质检溯源页面
  138. // uni.showToast({
  139. // title: '质检溯源功能待实现',
  140. // icon: 'none'
  141. // });
  142. uni.navigateTo({
  143. url: '/pages/traceability/traceabilityCode/quality'
  144. })
  145. },
  146. navigateToCompany() {
  147. // 跳转到企业信息页面
  148. // uni.showToast({
  149. // title: '企业信息功能待实现',
  150. // icon: 'none'
  151. // });
  152. uni.navigateTo({
  153. url: '/pages/traceability/traceabilityCode/company'
  154. })
  155. }
  156. }
  157. };
  158. </script>
  159. <style lang="scss" scoped>
  160. .traceability-page {
  161. background-color: #fff;
  162. min-height: 100vh;
  163. background-image: url('/static/svg-icons/bg-pattern.svg');
  164. background-size: cover;
  165. background-position: center;
  166. }
  167. .content-wrapper {
  168. padding: 120rpx 40rpx 40rpx;
  169. position: relative;
  170. }
  171. .edit-tag {
  172. position: absolute;
  173. top: 80rpx;
  174. left: 0;
  175. width: 160rpx;
  176. height: 60rpx;
  177. background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  178. color: #fff;
  179. text-align: center;
  180. line-height: 60rpx;
  181. font-size: 26rpx;
  182. border-radius: 0 30rpx 30rpx 0;
  183. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
  184. z-index: 10;
  185. }
  186. .product-image-section {
  187. display: flex;
  188. justify-content: center;
  189. margin-bottom: 60rpx;
  190. }
  191. .image-container {
  192. width: 300rpx;
  193. height: 300rpx;
  194. border-radius: 50%;
  195. background-color: #fff;
  196. display: flex;
  197. justify-content: center;
  198. align-items: center;
  199. box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.15);
  200. border: 16rpx solid #fff;
  201. position: relative;
  202. }
  203. // 添加红色装饰边框
  204. .image-container::before {
  205. content: '';
  206. position: absolute;
  207. top: -24rpx;
  208. left: -24rpx;
  209. right: -24rpx;
  210. bottom: -24rpx;
  211. border-radius: 50%;
  212. border: 2rpx dashed #ff6b6b;
  213. opacity: 0.6;
  214. }
  215. // .image-container::after {
  216. // content: '';
  217. // position: absolute;
  218. // top: -34rpx;
  219. // right: -34rpx;
  220. // width: 80rpx;
  221. // height: 80rpx;
  222. // background-image: url('/static/svg-icons/decorative-corner.svg');
  223. // background-size: contain;
  224. // background-repeat: no-repeat;
  225. // }
  226. .product-image {
  227. width: 240rpx;
  228. height: 240rpx;
  229. border-radius: 8rpx;
  230. }
  231. .product-info-section {
  232. background-color: rgba(255, 255, 255, 0.95);
  233. border-radius: 20rpx;
  234. padding: 30rpx;
  235. margin-bottom: 60rpx;
  236. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
  237. border: 2rpx solid #ffe6e6;
  238. position: relative;
  239. }
  240. .info-title {
  241. font-size: 32rpx;
  242. font-weight: bold;
  243. color: #fff;
  244. text-align: center;
  245. margin-bottom: 20rpx;
  246. padding: 10rpx 40rpx;
  247. background: #bd0402;
  248. border-radius: 10rpx;
  249. box-shadow: 0 2rpx 8rpx rgba(255, 107, 107, 0.3);
  250. position: absolute;
  251. top: -20rpx;
  252. left: 30%;
  253. }
  254. .info-content {
  255. margin-bottom: 20rpx;
  256. padding-top: 32rpx;
  257. }
  258. .info-item {
  259. display: flex;
  260. align-items: flex-start;
  261. }
  262. .info-label {
  263. font-size: 28rpx;
  264. color: #bd0402;
  265. margin-right: 10rpx;
  266. }
  267. .info-value {
  268. font-size: 28rpx;
  269. color: #333;
  270. font-weight: 500;
  271. flex: 1;
  272. }
  273. .more-info-btn {
  274. display: flex;
  275. justify-content: center;
  276. align-items: center;
  277. font-size: 26rpx;
  278. color: #bd0402;
  279. padding: 10rpx 0;
  280. }
  281. .dropdown-icon {
  282. width: 24rpx;
  283. height: 24rpx;
  284. margin-left: 10rpx;
  285. transform: rotate(0deg);
  286. transition: transform 0.3s;
  287. color: #bd0402;
  288. }
  289. .function-buttons {
  290. margin-bottom: 60rpx;
  291. }
  292. .button-row {
  293. display: flex;
  294. justify-content: space-between;
  295. margin-bottom: 30rpx;
  296. }
  297. .function-btn {
  298. width: 23%;
  299. height: 240rpx;
  300. // background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  301. background: #bd0402;
  302. border-radius: 20rpx;
  303. display: flex;
  304. flex-direction: column;
  305. justify-content: center;
  306. align-items: center;
  307. color: #fff;
  308. box-shadow: 0 8rpx 24rpx rgba(255, 107, 107, 0.3);
  309. transition: transform 0.2s;
  310. border: 2rpx solid #fff;
  311. }
  312. .function-btn:active {
  313. transform: scale(0.98);
  314. }
  315. .btn-icon {
  316. width: 60rpx;
  317. height: 60rpx;
  318. margin-bottom: 10rpx;
  319. }
  320. .btn-text {
  321. font-size: 28rpx;
  322. font-weight: 500;
  323. }
  324. .bottom-decoration {
  325. width: 100%;
  326. height: 100rpx;
  327. overflow: hidden;
  328. margin-top: 40rpx;
  329. }
  330. .bottom-decoration image {
  331. width: 100%;
  332. height: 100%;
  333. }
  334. </style>