traceability.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view class="intro-page common">
  3. <view class="top-class"></view>
  4. <view class="title">
  5. 产品溯源
  6. </view>
  7. <view class="head">
  8. <u-row class="row-class">
  9. <u-col span="4">
  10. <image class="logo-img" src="/static/images/common/logo.png" mode="aspectFit" />
  11. </u-col>
  12. <u-col span="4">
  13. <image class="commodity-img" src="/static/images/common/commodity.png" mode="aspectFit" />
  14. </u-col>
  15. <u-col span="4">
  16. </u-col>
  17. </u-row>
  18. </view>
  19. <view class="theme-text">
  20. <image src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/guzhenganzi/text.png"
  21. class="textImage"></image>
  22. </view>
  23. <!-- 公司简介内容卡片 -->
  24. <view class="intro-card">
  25. <view class="image-display">
  26. <image class="company-img" src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/guzhenganzi/companyImg.png" mode="aspectFill" />
  27. </view>
  28. <view class="intro-view">
  29. <view class="intro-label">
  30. <view class="label-title">
  31. 产品信息
  32. </view>
  33. </view>
  34. <view class="intro-content">
  35. <u-row class="row-class" customStyle="margin-bottom: 5px">
  36. <u-col span="4">
  37. <view class="item-left item-text">产品名称</view>
  38. </u-col>
  39. <u-col span="8">
  40. <view class="item-text">{{info.productName}}</view>
  41. </u-col>
  42. </u-row>
  43. <!-- <u-row class="row-class" customStyle="margin-bottom: 5px">
  44. <u-col span="4">
  45. <view class="item-left item-text">生产日期</view>
  46. </u-col>
  47. <u-col span="8">
  48. <view class="item-text">{{info.formatted_time}}</view>
  49. </u-col>
  50. </u-row> -->
  51. <u-row class="row-class" customStyle="margin-bottom: 5px">
  52. <u-col span="4">
  53. <view class="item-left item-text">批&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</view>
  54. </u-col>
  55. <u-col span="8">
  56. <view class="item-text">{{info.pici}}</view>
  57. </u-col>
  58. </u-row>
  59. <u-row class="row-class" customStyle="margin-bottom: 5px">
  60. <u-col span="4">
  61. <view class="item-left item-text">保&nbsp;&nbsp;质&nbsp;&nbsp;期</view>
  62. </u-col>
  63. <u-col span="8">
  64. <view class="item-text">60天</view>
  65. </u-col>
  66. </u-row>
  67. </view>
  68. </view>
  69. <view class="intro-view" >
  70. <view class="intro-label" style="right: 20px;">
  71. <view class="label-title">
  72. 产家信息
  73. </view>
  74. </view>
  75. <view class="intro-content">
  76. <u-row class="row-class" customStyle="margin-bottom: 5px">
  77. <u-col span="4">
  78. <view class="item-left item-text">出&nbsp;&nbsp;品&nbsp;&nbsp;商</view>
  79. </u-col>
  80. <u-col span="8">
  81. <view class="item-text">湖南王爷山食品股份有限公司</view>
  82. </u-col>
  83. </u-row>
  84. <u-row class="row-class" customStyle="margin-bottom: 5px">
  85. <u-col span="4">
  86. <view class="item-left item-text">生产地址</view>
  87. </u-col>
  88. <u-col span="8">
  89. <span class="item-text">湖南省娄底市新化县</span>
  90. </u-col>
  91. </u-row>
  92. <u-row class="row-class">
  93. <u-col span="4">
  94. <view class="item-left item-text">商标名称</view>
  95. </u-col>
  96. <u-col span="8">
  97. <view class="item-text">梅山古镇</view>
  98. </u-col>
  99. </u-row>
  100. </view>
  101. </view>
  102. <view style="height:5px"></view>
  103. </view>
  104. <!-- 返回按钮 -->
  105. <view class="footer-btn">
  106. <view @click="goBack" class="return-button">返回</view>
  107. </view>
  108. </view>
  109. </template>
  110. <script>
  111. import {
  112. suyuanData
  113. } from '@/api/scan'
  114. export default {
  115. data() {
  116. return {
  117. scanCode:'',
  118. info:{}
  119. }
  120. },
  121. onLoad() {
  122. this.scanCode = uni.getStorageSync('scanCode');
  123. this.initData();
  124. },
  125. methods: {
  126. goBack() {
  127. uni.navigateBack();
  128. },
  129. initData(){
  130. suyuanData(this.scanCode).then(res => {
  131. console.log(res)
  132. if (res.code == 0) {
  133. this.info = res.data.info;
  134. this.info.formatted_time = this.info.create_time.split(' ')[0];
  135. }
  136. })
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. @import url('../../../static/scss/common.css');
  143. .row-class {
  144. height: 60rpx;
  145. }
  146. .logo-img {
  147. background-size: cover;
  148. /* 确保背景图片自适应填充整个容器 */
  149. background-position: center;
  150. /* 背景图片居中显示 */
  151. background-repeat: no-repeat;
  152. /* 防止背景图重复 */
  153. height: 42rpx;
  154. width: 62%;
  155. }
  156. .commodity-img {
  157. background-size: cover;
  158. /* 确保背景图片自适应填充整个容器 */
  159. background-position: center;
  160. /* 背景图片居中显示 */
  161. background-repeat: no-repeat;
  162. /* 防止背景图重复 */
  163. height: 35rpx;
  164. width: 100%;
  165. }
  166. .theme-text {
  167. height: 10vh;
  168. text-align: center;
  169. line-height: 11vh;
  170. .textImage {
  171. height: 80rpx;
  172. width: 400rpx;
  173. }
  174. }
  175. .intro-card {
  176. margin: 0 32rpx;
  177. background: rgba(131, 100, 71, 0.5);
  178. border-radius: 10rpx;
  179. max-height: 65vh;
  180. overflow: auto;
  181. .intro-view {
  182. border: 2rpx solid #341B10;
  183. padding: 20rpx;
  184. margin: 20rpx;
  185. position: relative;
  186. margin-top: 30rpx;
  187. .intro-label {
  188. background-image:
  189. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/guzhenganzi/label.png");
  190. /* 使用绝对路径 */
  191. background-size: contain;
  192. background-repeat: no-repeat;
  193. width: 220rpx;
  194. height: 120rpx;
  195. position: absolute;
  196. margin-top: -70rpx;
  197. align-content: center;
  198. margin-left: -28rpx;
  199. .label-title {
  200. font-weight: bold;
  201. font-size: 30rpx;
  202. color: #341B10;
  203. text-align: center;
  204. margin-left: 10px;
  205. height: 120rpx;
  206. line-height: 110rpx;
  207. }
  208. }
  209. .intro-content {
  210. font-size: 28rpx;
  211. color: #5c4322;
  212. line-height: 1.8;
  213. margin-top: 20rpx;
  214. text-align: justify;
  215. }
  216. }
  217. }
  218. .image-display{
  219. text-align: center;
  220. .company-img {
  221. width: 80%;
  222. height: 240rpx;
  223. border-radius: 12rpx;
  224. object-fit: cover;
  225. margin-top: 20rpx;
  226. background: #eee;
  227. }
  228. }
  229. ::v-deep .item-left{
  230. background: #442812;
  231. border-radius: 6rpx !important;
  232. text-align: center;
  233. width: 160rpx !important;
  234. }
  235. .item-text{
  236. font-weight: 500;
  237. font-size: 30rpx;
  238. color: #FFFFFF;
  239. }
  240. </style>