delivery.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <!-- 确认送达 -->
  3. <view>
  4. <u-navbar :title="navTitle" autoBack placeholder @leftClick="leftClick"></u-navbar>
  5. <view class="card_order_details">
  6. <view class="details_title">高频编码 <span class="line_title">*</span></view>
  7. <view class="card_search">
  8. <view class="card_sweep" @click="sweep">
  9. <u-icon name="scan" size="36"></u-icon>
  10. <view class="scan_title">扫一扫</view>
  11. </view>
  12. <view class="card_input">
  13. <u-input border="surround" v-model="frequencyCoding"></u-input>
  14. </view>
  15. </view>
  16. <view v-if="selectiveType != '99' && selectiveType != '100'">
  17. <view class="card_frequency" v-if="selectiveType != 'inspect'">
  18. <view class="card_high space_between">
  19. <view class="card_frequency_title">高频编码列表</view>
  20. <view class="card_bottle">已扫<span>{{list.length}}</span>瓶</view>
  21. </view>
  22. <view style="width: 100%;" v-if="list.length > 0">
  23. <view class="item_coding" v-for="(item,index) in list" :key="index">
  24. {{item}}
  25. </view>
  26. </view>
  27. <view class="card_empty" v-else>
  28. <u-empty mode="list"></u-empty>
  29. </view>
  30. </view>
  31. <view class="card_examine" v-else>
  32. <view class="card_examine_item space_between" v-for="(item,index) in checkEntry" :key="index">
  33. <view class="title_entry">{{item.label}}</view>
  34. <view style="height: 40rpx;" v-if="item.type == 'radio'">
  35. <u-radio-group v-model="ruleForm.state" placement="row">
  36. <u-radio shape="circle" :customStyle="{width:'130rpx'}"
  37. v-for="(item, index) in item.options" :key="index" :label="item.label"
  38. :name="item.value"></u-radio>
  39. </u-radio-group>
  40. </view>
  41. <view class="center_row" v-if="item.type == 'input'">
  42. <u--input class="input_item" border="surround"
  43. v-model="ruleForm[`${item.field}`]"></u--input>
  44. <view style="margin-left: 15rpx;width: 90rpx;">{{item.unit}}</view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view style="width: 100%;height: 120rpx;"></view>
  50. <view class="card_btn">
  51. <u-button style="margin-bottom: 20rpx;" type="primary" @click="submit">提交</u-button>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import {
  58. formRules,
  59. } from "./new_file.js";
  60. export default {
  61. data() {
  62. return {
  63. frequencyCoding: '',
  64. navTitle: '',
  65. selectiveType: '',
  66. cmpCode: '',
  67. list: [],
  68. checkEntry: formRules(),
  69. ruleForm: {},
  70. orderId: '',
  71. }
  72. },
  73. onLoad(receive) {
  74. console.log(receive, 666)
  75. this.navTitle = receive.title
  76. this.selectiveType = receive.id
  77. this.cmpCode = receive.cmpCode
  78. this.orderId = receive.orderId
  79. },
  80. methods: {
  81. leftClick() {
  82. uni.$emit('refresh');
  83. },
  84. submit() {
  85. if (this.selectiveType == '99' || this.selectiveType == '100') {
  86. // 修改订单状态
  87. if (this.frequencyCoding) {
  88. const param = {
  89. id: Number(this.orderId),
  90. state: null,
  91. chipUid: this.frequencyCoding,
  92. }
  93. if (this.selectiveType == '99') {
  94. param.state = 3
  95. } else if (this.selectiveType == '100') {
  96. param.state = 4
  97. }
  98. this.$api.put('/api/order/state', param).then(res => {
  99. if (res.code == 200) {
  100. this.frequencyCoding = ''
  101. uni.$u.toast('操作成功')
  102. } else {
  103. uni.$u.toast(res.data.msg)
  104. }
  105. })
  106. } else {
  107. uni.$u.toast('请先扫高频编码')
  108. }
  109. } else {
  110. if (this.list.length > 0) {
  111. // 操作记录
  112. const param = {
  113. chipUidList: this.list,
  114. currentEnterprise: this.cmpCode,
  115. optType: this.selectiveType,
  116. }
  117. if (!param.currentEnterprise) {
  118. delete param.currentEnterprise
  119. }
  120. this.$api.post('/api/operation-log', param).then(res => {
  121. if (res.code == 200) {
  122. this.list = []
  123. this.frequencyCoding = ''
  124. uni.$u.toast('操作成功')
  125. }
  126. })
  127. } else {
  128. uni.$u.toast('请先扫高频编码')
  129. }
  130. }
  131. },
  132. // 扫一扫
  133. sweep() {
  134. // 允许从相机和相册扫码
  135. uni.scanCode({
  136. scanType: ["qrCode"],
  137. success: (res) => {
  138. // console.log(res);
  139. if (res.result) {
  140. let url = res.result;
  141. this.frequencyCoding = url
  142. if (this.selectiveType != '99' || this.selectiveType != '100') {
  143. this.list.push(url)
  144. function methods1(arr) {
  145. return Array.from(new Set(arr));
  146. }
  147. this.list = methods1(this.list)
  148. }
  149. } else {
  150. console.log('请重新扫描');
  151. return false;
  152. }
  153. },
  154. fail: (res) => {
  155. console.log('未识别到二维码');
  156. }
  157. })
  158. }
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. .card_order_details {
  164. margin: 40rpx;
  165. }
  166. .details_title {
  167. color: #333;
  168. font-size: 34rpx;
  169. font-weight: 500;
  170. margin-bottom: 10rpx;
  171. }
  172. .card_search {
  173. display: flex;
  174. align-items: center;
  175. margin: 20rpx 0rpx;
  176. }
  177. .scan_title {
  178. font-size: 20rpx;
  179. }
  180. .card_sweep {
  181. display: flex;
  182. flex-direction: column;
  183. align-items: center;
  184. flex: none;
  185. }
  186. .card_input {
  187. width: 100%;
  188. margin-left: 30rpx;
  189. }
  190. .line_title {
  191. color: red;
  192. }
  193. .card_high {
  194. margin-top: 30rpx;
  195. }
  196. .card_frequency {
  197. display: flex;
  198. flex-wrap: wrap;
  199. }
  200. .card_frequency_title {
  201. font-size: 32rpx;
  202. }
  203. .card_bottle {
  204. font-size: 30rpx;
  205. span {
  206. color: red;
  207. }
  208. }
  209. .item_coding {
  210. margin-top: 26rpx;
  211. width: 100%;
  212. padding-bottom: 15rpx;
  213. border-bottom: 2rpx solid #dfdfdf;
  214. }
  215. .card_empty {
  216. width: 100%;
  217. margin-top: 50rpx;
  218. display: flex;
  219. align-items: center;
  220. justify-content: center;
  221. }
  222. .card_btn {
  223. position: fixed;
  224. left: 0;
  225. right: 0;
  226. bottom: 0;
  227. padding-left: 30rpx;
  228. padding-right: 30rpx;
  229. padding-top: 20rpx;
  230. background-color: #fff;
  231. padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
  232. padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
  233. }
  234. .card_examine {
  235. margin-top: 50rpx;
  236. }
  237. .card_examine_item {
  238. display: flex;
  239. margin-bottom: 20rpx;
  240. }
  241. .title_entry {
  242. font-size: 26rpx;
  243. }
  244. .center_row {
  245. display: flex;
  246. height: 70rpx;
  247. align-items: center;
  248. }
  249. .input_item {
  250. width: 240rpx;
  251. }
  252. </style>