delivery.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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 class="deleteCurrent" @click="removeWaybill(frequencyCoding)">
  16. <u-icon class="icon_current" name="backspace" height="10" size="20"></u-icon>
  17. <view class="title_nape">删除</view>
  18. </view>
  19. </view>
  20. <view v-if="selectiveType != '99' && selectiveType != '100'">
  21. <view class="card_frequency" v-if="selectiveType != 'inspect'">
  22. <view class="card_high space_between">
  23. <view class="card_frequency_title">高频编码列表</view>
  24. <view class="card_bottle">已扫<span>{{list.length}}</span>瓶</view>
  25. </view>
  26. <view style="width: 100%;" v-if="list.length > 0">
  27. <view class="item_coding" v-for="(item,index) in list" :key="index">
  28. <view class="title_coding">{{item}}</view>
  29. <u-icon name="close-circle-fill" color="#c0c4cc" size="20"
  30. @click="removeWaybill(item)"></u-icon>
  31. </view>
  32. </view>
  33. <view class="card_empty" v-else>
  34. <u-empty mode="list"></u-empty>
  35. </view>
  36. </view>
  37. <view class="card_examine" v-else>
  38. <view class="card_examine_item space_between" v-for="(item,index) in checkEntry" :key="index">
  39. <view class="title_entry">{{item.label}}</view>
  40. <view style="height: 40rpx;" v-if="item.type == 'radio'">
  41. <u-radio-group v-model="ruleForm.state" placement="row">
  42. <u-radio shape="circle" :customStyle="{width:'140rpx'}"
  43. v-for="(item, index) in item.options" :key="index" :label="item.label"
  44. :name="item.value"></u-radio>
  45. </u-radio-group>
  46. </view>
  47. <view class="center_row" v-if="item.type == 'input'">
  48. <u-input class="input_item" border="surround" v-model="ruleForm[`${item.field}`]"></u-input>
  49. <view style="margin-left: 15rpx;width: 90rpx;">{{item.unit}}</view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view style="width: 100%;height: 120rpx;"></view>
  55. <view class="card_btn">
  56. <u-button style="margin-bottom: 20rpx;" type="primary" @click="submit">提交</u-button>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import {
  63. formRules,
  64. } from "./new_file.js";
  65. export default {
  66. data() {
  67. return {
  68. frequencyCoding: '',
  69. navTitle: '',
  70. selectiveType: '',
  71. cmpCode: '',
  72. list: [],
  73. checkEntry: formRules(),
  74. ruleForm: {},
  75. orderId: '',
  76. }
  77. },
  78. onLoad(receive) {
  79. this.navTitle = receive.title
  80. this.selectiveType = receive.id
  81. this.cmpCode = receive.cmpCode
  82. this.orderId = receive.orderId
  83. },
  84. methods: {
  85. leftClick() {
  86. uni.$emit('refresh');
  87. },
  88. submit() {
  89. if (this.selectiveType == '99' || this.selectiveType == '100') {
  90. // 修改订单状态
  91. if (this.frequencyCoding) {
  92. const param = {
  93. id: Number(this.orderId),
  94. state: null,
  95. chipUid: this.frequencyCoding,
  96. }
  97. if (this.selectiveType == '99') {
  98. param.state = 3
  99. } else if (this.selectiveType == '100') {
  100. param.state = 4
  101. }
  102. this.$api.put('/api/order/state', param).then(res => {
  103. if (res.code == 200) {
  104. this.frequencyCoding = ''
  105. uni.$u.toast('操作成功')
  106. } else {
  107. uni.$u.toast(res.data.msg)
  108. }
  109. })
  110. } else {
  111. uni.$u.toast('请先扫高频编码')
  112. }
  113. } else {
  114. if (this.list.length > 0) {
  115. // 操作记录
  116. const param = {
  117. chipUidList: this.list,
  118. currentEnterprise: this.cmpCode,
  119. optType: this.selectiveType,
  120. }
  121. if (!param.currentEnterprise) {
  122. delete param.currentEnterprise
  123. }
  124. this.$api.post('/api/operation-log', param).then(res => {
  125. if (res.code == 200) {
  126. this.list = []
  127. this.frequencyCoding = ''
  128. uni.$u.toast('操作成功')
  129. } else {
  130. uni.$u.toast(res.data.msg)
  131. }
  132. })
  133. } else {
  134. uni.$u.toast('请先扫高频编码')
  135. }
  136. }
  137. },
  138. // 扫一扫
  139. sweep() {
  140. // 允许从相机和相册扫码
  141. uni.scanCode({
  142. scanType: ['qrCode'],
  143. autoZoom: false,
  144. success: (res) => {
  145. console.log(res, '--------');
  146. if (res.result) {
  147. let url = res.result;
  148. const arrf = url.split('=')
  149. this.unitCoding(arrf[1])
  150. } else {
  151. console.log('请重新扫描');
  152. return false;
  153. }
  154. },
  155. fail: (res) => {
  156. console.log('未识别到二维码1');
  157. }
  158. })
  159. },
  160. // 单位内编码获取
  161. unitCoding(qrid) {
  162. uni.showLoading({
  163. title: '加载中'
  164. });
  165. uni.request({
  166. url: 'http://qr.uinshine.com:9000/CommonAPI/product/getDetails', //仅为示例,并非真实接口地址。
  167. method: 'POST',
  168. header: {
  169. 'content-type': 'application/x-www-form-urlencoded', // 默认值
  170. },
  171. data: {
  172. qr_id: qrid,
  173. },
  174. success: (res) => {
  175. if (res.data.code == 0) {
  176. var arr = res.data.data
  177. this.frequencyCoding = arr.inner_code
  178. if (this.selectiveType != '99' || this.selectiveType != '100') {
  179. this.list.push(arr.inner_code)
  180. function methods1(arr) {
  181. return Array.from(new Set(arr));
  182. }
  183. this.list = methods1(this.list)
  184. }
  185. uni.hideLoading();
  186. }
  187. }
  188. });
  189. },
  190. // 移除错误运单号
  191. removeWaybill(value) {
  192. if (this.frequencyCoding == value) {
  193. this.frequencyCoding = ''
  194. }
  195. const arr = deleteElementById(this.list, value)
  196. this.list = arr
  197. function deleteElementById(arr, key) {
  198. return arr.filter((item) => item !== key);
  199. }
  200. },
  201. }
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. .card_order_details {
  206. margin: 25rpx;
  207. }
  208. .details_title {
  209. color: #333;
  210. font-size: 34rpx;
  211. font-weight: 500;
  212. margin-bottom: 10rpx;
  213. }
  214. .card_search {
  215. display: flex;
  216. align-items: center;
  217. margin: 20rpx 0rpx;
  218. }
  219. .scan_title {
  220. font-size: 20rpx;
  221. }
  222. .card_sweep {
  223. display: flex;
  224. flex-direction: column;
  225. align-items: center;
  226. flex: none;
  227. }
  228. .card_input {
  229. width: 100%;
  230. margin-left: 30rpx;
  231. }
  232. .line_title {
  233. color: red;
  234. }
  235. .card_high {
  236. margin-top: 30rpx;
  237. }
  238. .card_frequency {
  239. display: flex;
  240. flex-wrap: wrap;
  241. }
  242. .card_frequency_title {
  243. font-size: 32rpx;
  244. }
  245. .card_bottle {
  246. font-size: 30rpx;
  247. span {
  248. color: red;
  249. }
  250. }
  251. .item_coding {
  252. display: flex;
  253. justify-content: space-between;
  254. align-items: center;
  255. width: 100%;
  256. margin-top: 10px;
  257. padding: 25rpx 0rpx;
  258. border-bottom: 2rpx solid #dfdfdf;
  259. }
  260. .title_coding {
  261. font-size: 30rpx;
  262. }
  263. .card_empty {
  264. width: 100%;
  265. margin-top: 50rpx;
  266. display: flex;
  267. align-items: center;
  268. justify-content: center;
  269. }
  270. .card_btn {
  271. position: fixed;
  272. left: 0;
  273. right: 0;
  274. bottom: 0;
  275. padding-left: 30rpx;
  276. padding-right: 30rpx;
  277. padding-top: 20rpx;
  278. background-color: #fff;
  279. padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
  280. padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
  281. }
  282. .card_examine {
  283. margin-top: 50rpx;
  284. }
  285. .card_examine_item {
  286. display: flex;
  287. margin-bottom: 20rpx;
  288. }
  289. .title_entry {
  290. font-size: 26rpx;
  291. }
  292. .center_row {
  293. display: flex;
  294. height: 70rpx;
  295. align-items: center;
  296. }
  297. .input_item {
  298. width: 240rpx;
  299. }
  300. .deleteCurrent {
  301. display: flex;
  302. align-items: center;
  303. flex-direction: column;
  304. justify-content: center;
  305. border: 1px solid #e5e5e5;
  306. padding: 5rpx 0rpx 5rpx 5rpx;
  307. margin-left: 10rpx;
  308. border-radius: 8rpx;
  309. height: 66rpx;
  310. .icon_current {
  311. height: 15px;
  312. }
  313. .title_nape {
  314. margin: 0rpx 10rpx;
  315. display: flex;
  316. font-size: 20rpx;
  317. width: 40rpx;
  318. }
  319. }
  320. </style>