result.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <!-- 胎号查询成功页面 -->
  2. <template>
  3. <view>
  4. <view class="head" v-if="empty == true">
  5. <view class="tips">
  6. <br>
  7. <br>
  8. <u-empty icon-color="#FFFFFF" color="#FFFFFF" text="查询失败" mode="data"></u-empty>
  9. </view>
  10. <view class="stripe"></view>
  11. <view class="roll">
  12. <view>查询失败</view>
  13. <view>
  14. <view></view>
  15. <view></view>
  16. <u-line color="#f4f4f4" border-style="dashed" :hair-line="true" length="94%" style="margin: 0 auto;padding-top: 30rpx;" />
  17. </view>
  18. <view class="Exhibition">
  19. <u-empty text="查询失败" mode="list"></u-empty>
  20. </view>
  21. </view>
  22. <u-button type="primary" shape="circle" class="button" @click="scanning">立即查询</u-button>
  23. </view>
  24. <view class="head" v-else>
  25. <view class="tips">
  26. <image src="../../../static/sailun/successful.png" mode=""></image>
  27. <view>查询成功</view>
  28. </view>
  29. <view class="stripe"></view>
  30. <view class="roll">
  31. <view>{{tireNumber}}</view>
  32. <view>
  33. <view></view>
  34. <view></view>
  35. <u-line color="#f4f4f4" border-style="dashed" :hair-line="true" length="94%" style="margin: 0 auto;padding-top: 30rpx;" />
  36. </view>
  37. <view class="Exhibition">
  38. <view><text>轮胎胎号</text><text>{{tireNumber}}</text></view>
  39. <view><text>轮胎类型</text><text>{{mouldType}}</text></view>
  40. <view><text>轮胎品牌</text><text>{{brand}}</text></view>
  41. <view><text>轮胎规格</text><text>{{specification}}</text></view>
  42. <view><text>创建时间</text><text>{{createTime}}</text></view>
  43. </view>
  44. </view>
  45. <u-button type="primary" shape="circle" class="button" @click="scanning">继续查询</u-button>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import {
  51. request
  52. } from '../../../common/request/request'
  53. require("promise.prototype.finally").shim()
  54. export default {
  55. data() {
  56. return {
  57. datalist: '',
  58. empty: true,
  59. tireNumber: "未查询",
  60. mouldType: '未查询',
  61. brand: '未查询',
  62. specification: '未查询',
  63. createTime: '未查询'
  64. }
  65. },
  66. onReady() {
  67. uni.getNetworkType({
  68. success: function(res) {
  69. let none = res.networkType
  70. console.log(res.networkType);
  71. if (none == 'none') {
  72. uni.showToast({
  73. icon: 'none',
  74. title: '无网络,请连接网络后再试~',
  75. position: "bottom"
  76. })
  77. }
  78. }
  79. });
  80. setTimeout(() => {
  81. this.scanning()
  82. }, 100)
  83. },
  84. methods: {
  85. rendering() {
  86. console.log(this.datalist)
  87. request({
  88. url: '/myapp/mouldSelect',
  89. method: 'Post',
  90. data: {
  91. storeId: this.$store.state.storeInfo.storeId,
  92. userId: this.$store.state.storeInfo.userId,
  93. tireNumber: this.datalist,
  94. }
  95. }).then(res => {
  96. console.log(res.data)
  97. if(res.data.code == 0){
  98. uni.showToast({
  99. icon: 'none',
  100. title: '查询成功',
  101. position: "bottom"
  102. })
  103. this.empty = false
  104. this.tireNumber = res.data.data.tireNumber
  105. this.mouldType = res.data.data.mouldType
  106. this.brand = res.data.data.brand
  107. this.specification = res.data.data.specification
  108. this.createTime = res.data.data.createTime
  109. }else if (res.data.code == 500) {
  110. this.empty = true
  111. uni.showToast({
  112. icon: 'none',
  113. title: res.data.msg,
  114. position: "bottom"
  115. })
  116. }
  117. }).catch(err => {
  118. console.log(err)
  119. uni.showToast({
  120. icon: 'none',
  121. title: '出错了请联系管理员~',
  122. position: "bottom"
  123. })
  124. }).finally(() => {
  125. // Loading.close()
  126. })
  127. },
  128. scanning() {
  129. let this_ = this
  130. uni.scanCode({
  131. success: function(res) {
  132. console.log('条码类型:' + res.scanType);
  133. console.log('条码内容:' + res.result);
  134. this_.datalist = res.result
  135. this_.rendering()
  136. }
  137. })
  138. }
  139. }
  140. }
  141. </script>
  142. <style lang="scss" scoped>
  143. .button {
  144. width: 90%;
  145. margin-top: 200rpx;
  146. }
  147. .head {
  148. width: 750rpx;
  149. height: 440rpx;
  150. background-color: #0095FF;
  151. .stripe {
  152. width: 650rpx;
  153. height: 30rpx;
  154. background: rgba(0, 0, 0, 0.2);
  155. border-radius: 12rpx;
  156. margin: 0 auto;
  157. margin-top: 40rpx;
  158. }
  159. .roll>view:nth-child(1) {
  160. font-size: 42rpx;
  161. font-weight: bold;
  162. color: #0192FD;
  163. text-align: center;
  164. margin-bottom: 50rpx;
  165. }
  166. .roll {
  167. width: 600rpx;
  168. height: auto;
  169. background: #FFFFFF;
  170. margin: 0 auto;
  171. margin-top: -15rpx;
  172. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(101, 176, 249, 0.3);
  173. border-bottom-left-radius: 10rpx;
  174. border-bottom-right-radius: 10rpx;
  175. padding-top: 50rpx;
  176. padding-bottom: 40rpx;
  177. view:nth-child(2) {
  178. width: 100%;
  179. height: auto;
  180. view:nth-child(1),
  181. {
  182. width: 50rpx;
  183. height: 50rpx;
  184. background-color: #F4F4F4;
  185. border-radius: 100%;
  186. float: left;
  187. margin-left: -30rpx;
  188. }
  189. view:nth-child(2) {
  190. width: 50rpx;
  191. height: 50rpx;
  192. background-color: #F4F4F4;
  193. border-radius: 100%;
  194. float: right;
  195. margin-right: -30rpx;
  196. }
  197. }
  198. }
  199. .tips {
  200. text-align: center;
  201. image {
  202. margin-top: 60rpx;
  203. width: 106rpx;
  204. height: 112rpx;
  205. margin-left: 10rpx;
  206. }
  207. view {
  208. margin-top: 50rpx;
  209. color: #FFFFFF;
  210. font-size: 32rpx;
  211. font-weight: bold;
  212. }
  213. }
  214. }
  215. .Exhibition {
  216. width: 94%;
  217. margin: 0 auto;
  218. margin-top: 25rpx;
  219. }
  220. .Exhibition>view {
  221. margin-bottom: 10rpx;
  222. }
  223. .Exhibition>view>text:nth-child(2) {
  224. float: right;
  225. }
  226. </style>