index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <!-- 首页 -->
  3. <view class="card_index_bgc">
  4. <view class="card_gas_cylinder">气瓶安全追溯管理系统</view>
  5. <view class="card_port center_in">{{genreTitle}}</view>
  6. <!-- <view class="card_cylinder">
  7. <view class="card_bottle" v-for="(item,index) in dataList" :key="index" @click="scanCodes(item)">
  8. <view class="card_fiche" :style="{backgroundColor:item.color}">
  9. <span class="iconfont icon_image" :class="item.icon"></span>
  10. </view>
  11. <view class="title_hint">{{item.title}}</view>
  12. </view>
  13. <view style="width: 25%;"></view>
  14. <view style="width: 25%;"></view>
  15. <view style="width: 25%;"></view>
  16. </view> -->
  17. <view class="card_cylinder border_top">
  18. <view class="card_bottle" v-for="(item,index) in addList" :key="index" @click="scanCodes(item)">
  19. <view class="card_fiche" :style="{backgroundColor:item.color}">
  20. <span class="iconfont icon_image" :class="item.icon"></span>
  21. <view class="title_hint">{{item.title}}</view>
  22. </view>
  23. </view>
  24. <view style="width: 25%;"></view>
  25. <view style="width: 25%;"></view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. props: {
  32. dataList: {
  33. type: Array,
  34. default: []
  35. },
  36. genreTitle: {
  37. type: String,
  38. default: ''
  39. },
  40. },
  41. data() {
  42. return {
  43. addList: [{
  44. id: 'add',
  45. title: '添加钢瓶',
  46. icon: 'icon-saoyisao',
  47. color: '#1ee94d',
  48. }, {
  49. id: 'step',
  50. title: '流转信息',
  51. icon: 'icon-saomachaxun',
  52. color: '#6db1ff',
  53. }, {
  54. id: 'allot',
  55. title: '钢瓶调拨',
  56. icon: 'icon-moveais',
  57. color: '#19baea',
  58. }, {
  59. id: 'record',
  60. title: '调拨记录',
  61. icon: 'icon-tiaobodan',
  62. color: '#ead719',
  63. }],
  64. }
  65. },
  66. mounted() {},
  67. methods: {
  68. scanCodes(value) {
  69. if (['11', '12', '17', '19', '16', '033'].includes(value.id)) {
  70. uni.navigateTo({
  71. url: '/pages/home/selectStore?id=' + value.id + '&title=' + value.title
  72. });
  73. } else if (value.id == 'add') {
  74. uni.navigateTo({
  75. url: '/pages/order/quickMark?id=' + value.id + '&title=' + value.title
  76. });
  77. } else if (value.id == 'step') {
  78. this.getInformation()
  79. } else if (value.id == 'allot') {
  80. uni.navigateTo({
  81. url: '/pages/order/cylinderTransfer'
  82. });
  83. } else if (value.id == 'record') {
  84. uni.navigateTo({
  85. url: '/pages/information/transferRecord'
  86. });
  87. } else if (value.id == '14') {
  88. this.$emit('tankFilling')
  89. } else {
  90. uni.navigateTo({
  91. url: '/pages/order/delivery?id=' + value.id + '&title=' + value.title
  92. });
  93. }
  94. },
  95. // 扫码溯源
  96. scanning() {
  97. uni.navigateTo({
  98. url: '/pages/index/codeTracing'
  99. });
  100. },
  101. getInformation() {
  102. // 允许从相机和相册扫码
  103. uni.scanCode({
  104. scanType: ['qrCode'],
  105. autoZoom: false,
  106. success: (res) => {
  107. console.log(res, '--------');
  108. if (res.result) {
  109. let url = res.result;
  110. const arrf = url.split('=')
  111. this.unitCoding(arrf[1])
  112. } else {
  113. console.log('请重新扫描');
  114. return false;
  115. }
  116. },
  117. fail: (res) => {
  118. console.log('未识别到二维码1');
  119. }
  120. })
  121. },
  122. // 单位内编码获取
  123. unitCoding(qrid) {
  124. uni.showLoading({
  125. title: '加载中'
  126. });
  127. uni.request({
  128. url: 'http://qr.uinshine.com:9000/CommonAPI/product/getDetails', //仅为示例,并非真实接口地址。
  129. method: 'POST',
  130. header: {
  131. 'content-type': 'application/x-www-form-urlencoded', // 默认值
  132. },
  133. data: {
  134. qr_id: qrid,
  135. },
  136. success: (res) => {
  137. if (res.data.code == 0) {
  138. var arr = res.data.data
  139. // this.frequencyCoding = arr.inner_code
  140. uni.hideLoading();
  141. uni.navigateTo({
  142. url: '/pages/index/codeTracing?code=' + arr.inner_code
  143. });
  144. } else {
  145. uni.$u.toast(res.data.msg)
  146. uni.hideLoading();
  147. }
  148. }
  149. });
  150. },
  151. }
  152. }
  153. </script>
  154. <style lang="scss">
  155. .card_index_bgc {
  156. padding-top: constant(safe-area-inset-top);
  157. padding-top: env(safe-area-inset-top);
  158. background-image: linear-gradient(#a9e3f1, #f3f4f6, #ffffff);
  159. }
  160. .card_gas_cylinder {
  161. display: flex;
  162. justify-content: center;
  163. align-items: center;
  164. font-size: 46rpx;
  165. font-weight: bold;
  166. color: #027DB4;
  167. padding: 50rpx 20rpx 0rpx 20rpx;
  168. }
  169. .card_port {
  170. font-size: 40rpx;
  171. font-weight: bold;
  172. color: #027DB4;
  173. padding-bottom: 20rpx;
  174. }
  175. .card_cylinder {
  176. display: flex;
  177. flex-direction: row;
  178. flex-wrap: wrap;
  179. justify-content: space-evenly;
  180. margin: 30rpx;
  181. background-color: #fff;
  182. border-radius: 16rpx;
  183. padding: 20rpx 0rpx;
  184. // box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  185. }
  186. .card_bottle {
  187. width: 45%;
  188. margin: 10rpx 0rpx;
  189. display: flex;
  190. flex-direction: column;
  191. align-items: center;
  192. }
  193. .card_fiche {
  194. display: flex;
  195. align-items: center;
  196. flex-direction: column;
  197. justify-content: center;
  198. width: 100%;
  199. padding: 20rpx 0rpx;
  200. height: 120rpx;
  201. background-color: #027DB4;
  202. border-radius: 16rpx;
  203. }
  204. .icon_image {
  205. color: #fff;
  206. font-size: 70rpx;
  207. }
  208. .title_hint {
  209. // height: 78rpx;
  210. margin-top: 10rpx;
  211. color: #ffffff;
  212. width: 85%;
  213. text-align: center;
  214. font-size: 26rpx;
  215. }
  216. .border_top {
  217. padding-top: 30rpx;
  218. }
  219. </style>