index.vue 5.3 KB

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