delivery.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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. } else {
  126. uni.$u.toast(res.data.msg)
  127. }
  128. })
  129. } else {
  130. uni.$u.toast('请先扫钢瓶编号')
  131. }
  132. }
  133. },
  134. // 扫一扫
  135. sweep() {
  136. // 允许从相机和相册扫码
  137. uni.scanCode({
  138. scanType: ["qrCode"],
  139. success: (res) => {
  140. // console.log(res);
  141. if (res.result) {
  142. let url = res.result;
  143. this.frequencyCoding = url
  144. if (this.selectiveType != '99' || this.selectiveType != '100') {
  145. this.list.push(url)
  146. function methods1(arr) {
  147. return Array.from(new Set(arr));
  148. }
  149. this.list = methods1(this.list)
  150. }
  151. } else {
  152. console.log('请重新扫描');
  153. return false;
  154. }
  155. },
  156. fail: (res) => {
  157. console.log('未识别到二维码');
  158. }
  159. })
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .card_order_details {
  166. margin: 40rpx;
  167. }
  168. .details_title {
  169. color: #333;
  170. font-size: 34rpx;
  171. font-weight: 500;
  172. margin-bottom: 10rpx;
  173. }
  174. .card_search {
  175. display: flex;
  176. align-items: center;
  177. margin: 20rpx 0rpx;
  178. }
  179. .scan_title {
  180. font-size: 20rpx;
  181. }
  182. .card_sweep {
  183. display: flex;
  184. flex-direction: column;
  185. align-items: center;
  186. flex: none;
  187. }
  188. .card_input {
  189. width: 100%;
  190. margin-left: 30rpx;
  191. }
  192. .line_title {
  193. color: red;
  194. }
  195. .card_high {
  196. margin-top: 30rpx;
  197. }
  198. .card_frequency {
  199. display: flex;
  200. flex-wrap: wrap;
  201. }
  202. .card_frequency_title {
  203. font-size: 32rpx;
  204. }
  205. .card_bottle {
  206. font-size: 30rpx;
  207. span {
  208. color: red;
  209. }
  210. }
  211. .item_coding {
  212. margin-top: 26rpx;
  213. width: 100%;
  214. padding-bottom: 15rpx;
  215. border-bottom: 2rpx solid #dfdfdf;
  216. }
  217. .card_empty {
  218. width: 100%;
  219. margin-top: 50rpx;
  220. display: flex;
  221. align-items: center;
  222. justify-content: center;
  223. }
  224. .card_btn {
  225. position: fixed;
  226. left: 0;
  227. right: 0;
  228. bottom: 0;
  229. padding-left: 30rpx;
  230. padding-right: 30rpx;
  231. padding-top: 20rpx;
  232. background-color: #fff;
  233. padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
  234. padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
  235. }
  236. .card_examine {
  237. margin-top: 50rpx;
  238. }
  239. .card_examine_item {
  240. display: flex;
  241. margin-bottom: 20rpx;
  242. }
  243. .title_entry {
  244. font-size: 26rpx;
  245. }
  246. .center_row {
  247. display: flex;
  248. height: 70rpx;
  249. align-items: center;
  250. }
  251. .input_item {
  252. width: 240rpx;
  253. }
  254. </style>