result.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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>{{text}}</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. text:'查询失败'
  65. }
  66. },
  67. onReady() {
  68. uni.getNetworkType({
  69. success: function(res) {
  70. let none = res.networkType
  71. console.log(res.networkType);
  72. if (none == 'none') {
  73. uni.showToast({
  74. icon: 'none',
  75. title: '无网络,请连接网络后再试~',
  76. position: "bottom"
  77. })
  78. }
  79. }
  80. });
  81. setTimeout(() => {
  82. this.scanning()
  83. }, 100)
  84. },
  85. methods: {
  86. rendering() {
  87. console.log(this.datalist)
  88. request({
  89. url: '/myapp/mouldSelect',
  90. method: 'Post',
  91. data: {
  92. storeId: this.$store.state.storeInfo.storeId,
  93. userId: this.$store.state.storeInfo.userId,
  94. tireNumber: this.datalist,
  95. }
  96. }).then(res => {
  97. console.log(res.data)
  98. if(res.data.code == 0){
  99. uni.showToast({
  100. icon: 'none',
  101. title: '查询成功',
  102. position: "bottom"
  103. })
  104. this.empty = false
  105. this.tireNumber = res.data.data.tireNumber
  106. this.mouldType = res.data.data.mouldType
  107. this.brand = res.data.data.brand
  108. this.specification = res.data.data.specification
  109. this.createTime = res.data.data.createTime
  110. }else if (res.data.code == 500) {
  111. this.empty = true
  112. uni.showToast({
  113. icon: 'none',
  114. title: res.data.msg,
  115. position: "bottom"
  116. })
  117. }
  118. this.text = res.data.msg
  119. }).catch(err => {
  120. console.log(err)
  121. uni.showToast({
  122. icon: 'none',
  123. title: '出错了请联系管理员~',
  124. position: "bottom"
  125. })
  126. }).finally(() => {
  127. // Loading.close()
  128. })
  129. },
  130. scanning() {
  131. let this_ = this
  132. uni.scanCode({
  133. success: function(res) {
  134. console.log('条码类型:' + res.scanType);
  135. console.log('条码内容:' + res.result);
  136. this_.datalist = res.result
  137. this_.rendering()
  138. }
  139. })
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .button {
  146. width: 90%;
  147. margin-top: 200rpx;
  148. }
  149. .head {
  150. width: 750rpx;
  151. height: 440rpx;
  152. background-color: #0095FF;
  153. .stripe {
  154. width: 650rpx;
  155. height: 30rpx;
  156. background: rgba(0, 0, 0, 0.2);
  157. border-radius: 12rpx;
  158. margin: 0 auto;
  159. margin-top: 40rpx;
  160. }
  161. .roll>view:nth-child(1) {
  162. font-size: 42rpx;
  163. font-weight: bold;
  164. color: #0192FD;
  165. text-align: center;
  166. margin-bottom: 50rpx;
  167. }
  168. .roll {
  169. width: 600rpx;
  170. height: auto;
  171. background: #FFFFFF;
  172. margin: 0 auto;
  173. margin-top: -15rpx;
  174. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(101, 176, 249, 0.3);
  175. border-bottom-left-radius: 10rpx;
  176. border-bottom-right-radius: 10rpx;
  177. padding-top: 50rpx;
  178. padding-bottom: 40rpx;
  179. view:nth-child(2) {
  180. width: 100%;
  181. height: auto;
  182. view:nth-child(1),
  183. {
  184. width: 50rpx;
  185. height: 50rpx;
  186. background-color: #F4F4F4;
  187. border-radius: 100%;
  188. float: left;
  189. margin-left: -30rpx;
  190. }
  191. view:nth-child(2) {
  192. width: 50rpx;
  193. height: 50rpx;
  194. background-color: #F4F4F4;
  195. border-radius: 100%;
  196. float: right;
  197. margin-right: -30rpx;
  198. }
  199. }
  200. }
  201. .tips {
  202. text-align: center;
  203. image {
  204. margin-top: 60rpx;
  205. width: 106rpx;
  206. height: 112rpx;
  207. margin-left: 10rpx;
  208. }
  209. view {
  210. margin-top: 50rpx;
  211. color: #FFFFFF;
  212. font-size: 32rpx;
  213. font-weight: bold;
  214. }
  215. }
  216. }
  217. .Exhibition {
  218. width: 94%;
  219. margin: 0 auto;
  220. margin-top: 25rpx;
  221. }
  222. .Exhibition>view {
  223. margin-bottom: 10rpx;
  224. }
  225. .Exhibition>view>text:nth-child(2) {
  226. float: right;
  227. }
  228. </style>