index.vue 5.9 KB

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