shippingPage.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <div class="p-4 bg-white dark:bg-[#0e1726]">
  3. <el-button type="text" @click="goBack">返回</el-button>
  4. <!-- <h2 class="text-center my-4">发货管理</h2> -->
  5. <div class="text-center my-4">
  6. <Vue3Barcode v-if="barcodeValue" :value='barcodeValue' width="1" height='30'></Vue3Barcode>
  7. <!-- <p>RYKS_DDD-20240527-00201</p> -->
  8. </div>
  9. <el-tabs v-model="activeTab" class="dark:bg-[#0e1726]">
  10. <el-tab-pane label="基本信息" name="basic-info">
  11. <div class="p-4">
  12. <span>预约类型:</span>
  13. <el-select v-model="shippingForm.appointment_type" clearable placeholder="Select" size="small"
  14. style="width: 100px">
  15. <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
  16. </el-select>
  17. <p class="mt-1 mb-1" v-if="shippingForm.appointment_type !== 0"><span>上门时间:</span>
  18. <el-date-picker v-model="shippingForm.appointment_time" style="width: 170px" size="small"
  19. type="datetime" placeholder="Select date and time" :default-time="defaultTime" />
  20. </p>
  21. <p>订单状态:{{ orderTypeName(shippingForm.order_vo.status) }}</p>
  22. <p>订单类型:{{ shippingForm.order_vo.type == 'TO_B' ? '销售订单' : '租赁订单' }}</p>
  23. <p>下单客户:{{ customerName(shippingForm.order_vo.member_id) }}</p>
  24. <p>付款方式:{{ collectingAccountName(shippingForm.order_vo.pay_type) }}</p>
  25. <p>实付金额:{{ shippingForm.order_vo.pay_price }}</p>
  26. <p>仓库:{{ warehouseName(shippingForm.warehouse_id) }}</p>
  27. <p>收货人:{{ shippingForm.order_vo.customer_name }}</p>
  28. <p>联系电话:{{ shippingForm.order_vo.customer_phone }}</p>
  29. <p>地址:{{ shippingForm.order_vo.province_city_area_address }}</p>
  30. <p>商品总数:{{ good_total }}</p>
  31. <p>客户备注:{{ shippingForm.order_vo.remark }}</p>
  32. <p v-if="send_type !== 'EXPRESS_DELIVERY'">
  33. <span v-if="shippingForm.order_vo.send_type !== 'SELF_PICKUP'">运单号:{{
  34. shippingForm.kdn_order_code }}</span>
  35. <span v-else>自提单号:{{ shippingForm.self_pickup_num }}</span>
  36. </p>
  37. <div v-else>
  38. <p>
  39. 快递公司: <el-select v-model="params.logistics_type" clearable>
  40. <el-option v-for="(item, index) in deliveryTypeList" :key="index" :label="item.name"
  41. :value="item.code"></el-option>
  42. </el-select>
  43. </p>
  44. <p>
  45. 物流单号: <el-input v-model="params.logistics_code" :minlength="1" :maxlength="20"
  46. placeholder="请输入物流单号"></el-input>
  47. </p>
  48. <p>
  49. 寄件人手机号: <el-input v-model="params.logistics_phone" :minlength="1" :maxlength="20"
  50. placeholder="请输入寄件人手机号后四位"></el-input>
  51. </p>
  52. </div>
  53. <p class="mt-1 mb-1">物品总重量:<el-input v-model.number="params.total_weight" size="small"
  54. :minlength="1" style="width: 170px" :maxlength="20" type="number" max="50" clearable
  55. placeholder="请输入物品总重量"><template #append>KG</template></el-input>
  56. </p>
  57. <p class="mt-1 mb-1">物品总体积: <el-input v-model="params.total_volume" ref="totalInput" size="small"
  58. :minlength="1" style="width: 170px" :maxlength="20" clearable
  59. placeholder="请输入物品总体积"><template #append>m³</template></el-input>
  60. </p>
  61. <p>物品价格: <el-input v-model="params.declared_value" size="small" :minlength="1" style="width: 170px"
  62. :maxlength="20" clearable placeholder="请输入物品价格"><template #append>元</template></el-input>
  63. </p>
  64. </div>
  65. <!-- <div class="p-4">
  66. <p>3.12 快递已收货</p>
  67. <p>3.13 快递已到达中转站</p>
  68. </div> -->
  69. </el-tab-pane>
  70. <el-tab-pane label="商品信息" name="product-info">
  71. <el-table :data="shippingForm.order_item_vos" style="width: 100%">
  72. <el-table-column prop="goods_vo.name" label="商品名称" />
  73. <el-table-column prop="product_vo.sku" label="SKU" />
  74. <el-table-column prop="orderNum" label="订单数量" />
  75. <el-table-column prop="num" label="出库数量">
  76. <template #default="scope">
  77. <span :style="{ color: scope.row.num > 0 ? 'red' : 'black' }">
  78. {{ scope.row.num }}
  79. </span>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. </el-tab-pane>
  84. </el-tabs>
  85. <el-dialog v-model="dialogVisible" :modal=false title="扫码出库" :close-on-click-modal="false" top="80px"
  86. width="90%" style="height: 190px" :before-close="handleClose">
  87. <el-form :model="snCodeForm" label-width="auto" style="max-width: 600px">
  88. <el-form-item label="SKU">
  89. <el-input class="hidden-input" v-model="snCodeForm.bar_code" @keyup.enter="toSearch()" clearable
  90. :inputmode="inputmode" ref="inputRef">
  91. <template #append> <img src="../../assets/images/JP.png" @click="getInfo" class="w-8 h-8" />
  92. </template>
  93. </el-input>
  94. </el-form-item>
  95. <el-form-item label="序列号">
  96. <el-input v-model="snCodeForm.sn_code" clearable :inputmode="inputmode" ref="snInputRef"
  97. @keyup.enter="toSnCode()" />
  98. </el-form-item>
  99. </el-form>
  100. <!-- <template #footer>
  101. <div class="dialog-footer">
  102. <el-button @click="dialogVisible = false"></el-button>
  103. <el-button type="primary" @click="dialogVisible = false">
  104. Confirm
  105. </el-button>
  106. </div>
  107. </template> -->
  108. </el-dialog>
  109. <div class="flex justify-center pt-2 pb-2 mt-4 w-full fixed bottom-0 bg-white left-0 z-50 dark:bg-[#0e1726]"
  110. v-if="send_type !== 'EXPRESS_DELIVERY'">
  111. <el-button type="primary" size="large" @click="scanCode">扫码出库</el-button>
  112. <el-button type="primary" size="large"
  113. v-if="shippingForm.kdn_order_code == '' || shippingForm.kdn_order_code == undefined"
  114. @click="getOrderNumber">获取运单号</el-button>
  115. <div v-else class="pl-2">
  116. <el-button type="primary" v-if="activeTab == 'basic-info'" size="large" @click="ship">发货</el-button>
  117. </div>
  118. </div>
  119. <div class="flex justify-center pt-2 pb-2 mt-4 w-full fixed bottom-0 bg-white left-0 z-50" v-else>
  120. <el-button type="primary" size="large" @click="scanCode">扫码出库</el-button>
  121. <el-button type="primary" size="large" v-if="activeTab == 'basic-info'" @click="ship">发货</el-button>
  122. </div>
  123. </div>
  124. </template>
  125. <script lang="ts" setup>
  126. import { ref, onMounted, watch, reactive, nextTick, onBeforeUnmount } from 'vue';
  127. import { useRouter, useRoute } from 'vue-router';
  128. import { orderApi, infoApi, dictionaryAPI } from '@/api/api'
  129. import { regionData, codeToText } from 'element-china-area-data'
  130. //引入
  131. import Vue3Barcode from 'vue3-barcode'
  132. //定义要生成条形码的值
  133. import { ElMessage } from 'element-plus'
  134. const appointment_time = ref('')
  135. const defaultTime = new Date(2000, 1, 1, 12, 0, 0)
  136. let dialogVisible = ref(false)
  137. const tableData = ref([])
  138. let barcodeValue = ref('')
  139. let inputmode = ref('text')
  140. const router = useRouter();
  141. const route = useRoute()
  142. const activeTab = ref('product-info');
  143. const id = ref(route.params.id);
  144. const send_type = ref(route.params.send_type);
  145. let shippingForm: any = ref({
  146. order_vo: {
  147. status: '',
  148. type: '',
  149. member_id: '',
  150. pay_type: '',
  151. pay_price: '',
  152. customer_name: '',
  153. customer_phone: '',
  154. province_city_area_address: '',
  155. remark: ''
  156. },
  157. warehouse_id: '',
  158. appointment_type: 0,
  159. order_item_vos: []
  160. });
  161. const options = [
  162. {
  163. label: "立即单",
  164. value: 0,
  165. },
  166. {
  167. label: "预约上门",
  168. value: 1,
  169. },
  170. ]
  171. //表单
  172. const snCodeForm = reactive({
  173. bar_code: "",
  174. sn_code: '',
  175. })
  176. const inputRef = ref();
  177. const snInputRef = ref<any>(null)
  178. const customerList: any = ref([])//初始化客户列表
  179. const warehouseList: any = ref([])//初始化客户列表
  180. const collectingAccountList: any = ref([])//初始化客户列表
  181. const deliveryList: any = ref([])//初始化客户列表
  182. const orderTypeList: any = ref([])//初始化客户列表
  183. const index = ref(-1);
  184. const deliveryTypeList: any = ref([])
  185. const params: any = ref({
  186. logistics_type: "shunfeng",
  187. logistics_code: "",
  188. logistics_phone: "",
  189. send_type: '',
  190. selfPickupNum: '',
  191. remark: "",//备注
  192. declared_value: "",//物品价格
  193. appointment_type: 0,
  194. total_weight: "",//物品总重量
  195. total_volume: "",//物品总体积
  196. //发货人
  197. sender: {
  198. name: "",
  199. phone: "",
  200. address: "",
  201. province_city_area_address: ""
  202. },
  203. //收货人
  204. receiver: {
  205. name: "",
  206. phone: "",
  207. address: "",
  208. province_city_area_address: ""
  209. },
  210. //商品信息列表
  211. order_item_vos: [],
  212. goods_list: [],
  213. warehouse_id: '',
  214. goods_num: '',
  215. })
  216. let isReadOnly: any = ref(false)
  217. let sku = ref('');
  218. watch(activeTab, (newValue, oldValue) => {
  219. console.log(`Tab changed from ${oldValue} to ${newValue}`);
  220. // 这里可以添加一些逻辑,但要确保不会再次修改 activeTab
  221. });
  222. const toggleReadOnly = () => {
  223. isReadOnly = !isReadOnly;
  224. };
  225. const enableVirtualKeyboard = (event) => {
  226. event.target.readOnly = false;
  227. };
  228. const getInfo = () => {
  229. if (inputmode.value == 'none') {
  230. inputmode.value = 'text'
  231. inputRef.value.focus();
  232. } else {
  233. inputmode.value = 'none'
  234. inputRef.value.focus();
  235. }
  236. }
  237. /* 扫sku */
  238. const toSearch = async () => {
  239. activeTab.value = 'product-info'
  240. try {
  241. if (!snCodeForm.bar_code) {
  242. console.log('扫码枪输入为空,忽略此次事件');
  243. return;
  244. }
  245. const res: any = await orderApi.getProduct(
  246. shippingForm.value.warehouse_id,
  247. snCodeForm.bar_code.replace(/\s+/g, '')
  248. );
  249. res.data.sn_code_list = [];
  250. sku.value = res.data.product_vo.sku;
  251. let indexs = shippingForm.value.order_item_vos.findIndex(el => (
  252. el.goods_vo.id === res.data.goods_id &&
  253. el.product_id === res.data.product_id &&
  254. el.product_vo.sku === res.data.product_vo.sku
  255. ));
  256. if (indexs === -1) {
  257. let existingProduct = shippingForm.value.order_item_vos.find(el => (
  258. el.goods_vo.id === res.data.goods_id &&
  259. el.product_id === res.data.product_id &&
  260. el.product_vo.sku === res.data.product_vo.sku
  261. ));
  262. if (!existingProduct) {
  263. //ElMessageBox.error('订单内没有该商品,请重新录入');
  264. nextTick(() => {
  265. inputRef.value.focus();
  266. });
  267. return;
  268. }
  269. index.value = shippingForm.value.order_item_vos.length;
  270. shippingForm.value.order_item_vos.push(res.data);
  271. } else {
  272. index.value = indexs;
  273. }
  274. if (res.data.product_vo.have_sn) {
  275. nextTick(() => {
  276. // Assuming there's a ref named snInputRef
  277. snInputRef.value.focus();
  278. });
  279. } else {
  280. if (shippingForm.value.order_item_vos[index.value].num >= shippingForm.value.order_item_vos[index.value].orderNum) return ElMessage.warning('出库数量不能大于订单数量!')
  281. shippingForm.value.order_item_vos[index.value].num += 1
  282. snCodeForm.bar_code = ''
  283. //dialogVisible.value = false;
  284. }
  285. } catch (error) {
  286. console.error('Error fetching product:', error);
  287. snCodeForm.bar_code = ''
  288. }
  289. };
  290. //扫描序列号
  291. const toSnCode = async () => {
  292. if (!sku.value) return ElMessage.error('请先扫描sku!')
  293. try {
  294. const res: any = await orderApi.getsnCode(
  295. "out",
  296. sku.value,
  297. snCodeForm.sn_code.replace(/\s+/g, '')
  298. );
  299. snCodeForm.sn_code = "";
  300. const exists = shippingForm.value.order_item_vos[index.value].sn_code_list.find(
  301. item => item.sn_code === res.sn_code && item.sku === res.sku
  302. );
  303. if (!exists) {
  304. /* 请求保存 */
  305. await infoApi.skuRedis({ send_order_id: id.value, item_id: shippingForm.value.order_item_vos[index.value].id, sku: res.data }).then((respons: any) => {
  306. shippingForm.value.order_item_vos[index.value].sn_code_list.push(res.data);
  307. })
  308. }
  309. shippingForm.value.order_item_vos[index.value].num = shippingForm.value.order_item_vos[index.value].sn_code_list.length;
  310. const indexs = shippingForm.value.order_item_vos.findIndex(el => (
  311. el.goods_id === res.goods_id &&
  312. el.product_id === res.product_id &&
  313. el.product_vo.sku === res.sku
  314. ));
  315. //shippingForm.value.order_item_vos[index.value].id = shippingForm.value.order_item_vos[indexs].id;
  316. if (shippingForm.value.order_item_vos[index.value].num === shippingForm.value.order_item_vos[index.value].orderNum) {
  317. snCodeForm.bar_code = "";
  318. return ElMessage.warning('录入完成,请录入下一条!')
  319. /* dialogVisible.value = false; */
  320. } else {
  321. snCodeForm.bar_code = "";
  322. nextTick(() => {
  323. inputRef.value.focus();
  324. });
  325. }
  326. } catch (error) {
  327. console.error('Error fetching SN code:', error);
  328. }
  329. }
  330. //关闭弹窗
  331. const handleClose = (done: () => void) => {
  332. done()
  333. }
  334. onMounted(() => {
  335. console.log(send_type);
  336. init()
  337. getInforList()
  338. });
  339. const goBack = () => {
  340. router.push({ name: 'order' });
  341. };
  342. const scanCode = () => {
  343. dialogVisible.value = true
  344. nextTick(() => {
  345. if (inputRef.value) {
  346. try {
  347. inputRef.value.focus(); // 先尝试聚焦 input 元素
  348. setTimeout(() => {
  349. if (inputRef.value) {
  350. // 首先,让输入框失去焦点,这会阻止键盘的唤起
  351. //inputRef.value.removeAttribute('readonly');
  352. inputRef.value.focus();
  353. inputmode.value = 'none'
  354. }
  355. }, 100);
  356. } catch (error) {
  357. console.error('Failed to select input:', error);
  358. }
  359. }
  360. });
  361. };
  362. const getOrderNumber = () => {
  363. if (params.value.total_weigh == 0) return ElMessage.error('请输入物品总重量!')
  364. if (params.value.total_volume == 0) return ElMessage.error('请输入物品总体积!')
  365. //发货详细地址
  366. if (params.value.receiver.city_name === '市辖区') {
  367. params.value.receiver.city_name = params.value.receiver.province_name;
  368. }
  369. if (params.value.sender.city_name === '市辖区') {
  370. params.value.sender.city_name = params.value.sender.province_name;
  371. }
  372. params.value.receiver.province_city_area_address =
  373. params.value.receiver.province_name +
  374. params.value.receiver.city_name +
  375. params.value.receiver.area_name +
  376. params.value.receiver.address;
  377. //收货详细地址
  378. params.value.sender.province_city_area_address =
  379. params.value.sender.province_name +
  380. params.value.sender.city_name +
  381. params.value.sender.area_name +
  382. params.value.sender.address;
  383. /* params.value.order_item_vos = shippingForm.value.order_item_vos */
  384. //商品信息
  385. const item = {
  386. goods_name: '',
  387. quantity: '',
  388. unit: ''
  389. };
  390. shippingForm.value.order_item_vos.map((el) => {
  391. item.goods_name = el.goods_vo.name;
  392. /* item.goods_price = el.product_vo.price; */
  393. item.quantity = el.orderNum;
  394. item.unit = el.product_vo.unit;
  395. return params.value.goods_list.push(item);
  396. });
  397. params.value.goods_num = shippingForm.value.order_item_vos.reduce(
  398. (sum, e) => sum + Number(e.orderNum || 0),
  399. 0
  400. );
  401. if (shippingForm.appointment_type !== 0) {
  402. params.value.appointment_time = shippingForm.appointment_time
  403. }
  404. params.value.warehouse_id = shippingForm.value.warehouse_id
  405. params.value.send_type = send_type.value
  406. params.value.order_code = id.value
  407. /*console.log(shippingForm);
  408. //商品信息
  409. const item = {};
  410. shippingForm.order_item_vos.map((el) => {
  411. item.goods_name = el.goods_vo.name;
  412. item.quantity = el.orderNum;
  413. item.unit = el.product_vo.unit;
  414. return params.goods_list.push(item);
  415. });
  416. params.goods_num = this.product_list.reduce(
  417. (sum, e) => sum + Number(e.orderNum || 0),
  418. 0
  419. );
  420. params.total_weight = Number(params.total_weight);
  421. params.total_volume = Number(params.total_volume);
  422. params.declared_value = Number(params.declared_value);
  423. //地址
  424. params.send_address = this.send_address;
  425. params.receive_address = this.receive_address;
  426. params.order_code = this.id; */
  427. orderApi.getkdShip(id.value, params.value).then(res => {
  428. init()
  429. location.reload();
  430. })
  431. };
  432. const ship = () => {
  433. if (send_type.value !== 'EXPRESS_DELIVERY') {
  434. } else {
  435. if (params.value.logistics_type == '') return ElMessage.error('请选择快递公司!')
  436. if (params.value.logistics_code == '') return ElMessage.error('请填写物流单号!')
  437. if (params.value.logistics_phone == '') return ElMessage.error('请输入寄件人手机号后四位!')
  438. }
  439. if (params.value.total_weigh == 0) return ElMessage.error('请输入物品总重量!')
  440. if (params.value.total_volume == 0) return ElMessage.error('请输入物品总体积!')
  441. //发货详细地址
  442. params.value.receiver.province_city_area_address =
  443. params.value.receiver.province_name +
  444. params.value.receiver.city_name +
  445. params.value.receiver.area_name +
  446. params.value.receiver.address;
  447. //收货详细地址
  448. params.value.sender.province_city_area_address =
  449. params.value.sender.province_name +
  450. params.value.sender.city_name +
  451. params.value.sender.area_name +
  452. params.value.sender.address;
  453. params.value.order_item_vos = shippingForm.value.order_item_vos
  454. if (shippingForm.appointment_type !== 0) {
  455. params.value.appointment_time = shippingForm.appointment_time
  456. }
  457. const item = {
  458. goods_name: "",
  459. quantity: '',
  460. unit: "",
  461. };
  462. params.value.goods_list.map((el) => {
  463. item.goods_name = el.goods_vo.name;
  464. item.quantity = el.num;
  465. item.unit = el.product_vo.unit;
  466. return params.value.goods_list.push(item);
  467. });
  468. orderApi.orderSend(id.value, params.value).then(res => {
  469. ElMessage.success("发货成功!");
  470. router.push({ name: 'order' });
  471. })
  472. orderApi.queryLogistics({ shipper_code: params.value.logistics_type, logistic_code: params.value.logistics_code, customer_name: params.value.logistics_phone }).then(res => {
  473. console.log(res);
  474. })
  475. };
  476. const kdsShip = () => {
  477. }
  478. /* 商品总数 */
  479. let good_total = 0
  480. const init = async () => {
  481. try {
  482. const res: any = await orderApi.getSendOrderDetail(id.value);
  483. if (res && res.data && res.data.order_vo && res.data.order_vo.sn) {
  484. await infoApi.skuRedis({ send_order_id: id.value, type: 'enter' }).then((response: any) => {
  485. res.data.order_item_vos.map((el: any) => {
  486. params.value.total_weight = Number(
  487. el.product_vo.weight * el.num
  488. );
  489. if (params.value.total_weight == 0) {
  490. params.value.total_weight = 1
  491. }
  492. el.orderNum = el.num
  493. if (res.data.kdn_order_code == undefined || res.data.kdn_order_code == '') {
  494. el.num = 0
  495. }
  496. Object.keys(response.data).map(item => {
  497. if (el.id == item) {
  498. el.sn_code_list = response.data[item]
  499. el.num = el.sn_code_list.length
  500. }
  501. })
  502. if (!el.sn_code_list) {
  503. el.sn_code_list = []
  504. } else {
  505. /* el.num = el.sn_code_list.length */
  506. }
  507. })
  508. })
  509. barcodeValue.value = res.data.order_vo.sn;
  510. //物品价格
  511. if (res.data.total_volume !== undefined && res.data.total_volume !== 0) {
  512. params.value.total_volume = Number(res.data.total_volume)
  513. } else {
  514. params.value.total_volume = 0.01
  515. }
  516. params.value.declared_value = Number(res.data.order_vo.real_price)
  517. res.data.appointment_type = 0
  518. /* 发货人地址 */
  519. const addressLiat = res.data.warehouse_vo.ware_pro_city_area.split(",")
  520. params.value.sender.name = res.data.warehouse_vo.user_name;
  521. params.value.sender.phone = res.data.warehouse_vo.phone;
  522. params.value.sender.province_name = codeToText[addressLiat[0]]
  523. params.value.sender.city_name = codeToText[addressLiat[1]]
  524. params.value.sender.area_name = codeToText[addressLiat[2]]
  525. params.value.sender.address = res.data.warehouse_vo.warehouse_address;
  526. /* 收货地址 */
  527. const receiverList = res.data.order_vo.province_city_area.split(",")
  528. params.value.receiver.name = res.data.order_vo.customer_name;
  529. params.value.receiver.phone = res.data.order_vo.customer_phone;
  530. params.value.receiver.province_name = codeToText[receiverList[0]];
  531. params.value.receiver.city_name = codeToText[receiverList[1]];
  532. params.value.receiver.area_name = codeToText[receiverList[2]];
  533. params.value.receiver.address = res.data.order_vo.address;
  534. shippingForm.value = res.data;
  535. res.data.order_item_vos.map(el => {
  536. good_total += el.orderNum
  537. })
  538. console.log(good_total);
  539. console.log("Barcode value set to:", shippingForm);
  540. } else {
  541. console.error("Invalid response structure:", res);
  542. }
  543. } catch (error) {
  544. console.error("Failed to fetch order details:", error);
  545. }
  546. }
  547. /* 处理客户名称 */
  548. const customerName = (value) => {
  549. if (value && customerList.value && customerList.value.data && customerList.value.data.data) {
  550. const type = customerList.value.data.data.find(type => type.id === value);
  551. return type ? type.name : '';
  552. }
  553. }
  554. /* 仓库名称 */
  555. const warehouseName = (value) => {
  556. if (value && warehouseList.value && warehouseList.value.data) {
  557. const type = warehouseList.value.data.find(type => type.id === value);
  558. return type ? type.name : '';
  559. }
  560. }
  561. /* 支付列表*/
  562. const collectingAccountName = (value) => {
  563. if (value && collectingAccountList.value && collectingAccountList.value.data && collectingAccountList.value.data.data) {
  564. const type = collectingAccountList.value.data.data.find(type => type.id === value);
  565. return type ? type.name : '';
  566. }
  567. }
  568. /* 配送方式*/
  569. const deliveryName = (value) => {
  570. if (value && deliveryList.value && deliveryList.value.data && deliveryList.value.data.data) {
  571. const type = deliveryList.value.data.data.find(type => type.value === value);
  572. return type ? type.label : '';
  573. }
  574. }
  575. /* 订单状态*/
  576. const orderTypeName = (value) => {
  577. if (value && orderTypeList.value && orderTypeList.value.data && orderTypeList.value.data.data) {
  578. const type = orderTypeList.value.data.data.find(type => type.value === value);
  579. return type ? type.label : '';
  580. }
  581. }
  582. /* 获取仓库,字典,客户信息 */
  583. const getInforList = async () => {
  584. warehouseList.value = await infoApi.warehouseList({})//获取仓库列表
  585. customerList.value = await infoApi.customer({})//获取客户列表
  586. collectingAccountList.value = await infoApi.collectingAccount({})//获取支付方式列表
  587. deliveryList.value = await dictionaryAPI.getPage({ dictType: "order_send_type" })//获取配送方式
  588. orderTypeList.value = await dictionaryAPI.getPage({ dictType: "Sale_order_send_status" })//获取订单状态
  589. const expressList: any = await infoApi.getExpressList({//获取物流公司
  590. page_no: 1,
  591. page_size: 9999,
  592. })
  593. deliveryTypeList.value = expressList.data.data
  594. }
  595. </script>
  596. <style scoped>
  597. .text-center {
  598. text-align: center;
  599. }
  600. .my-4 {
  601. margin-top: 1rem;
  602. margin-bottom: 1rem;
  603. }
  604. .mx-auto {
  605. margin-left: auto;
  606. margin-right: auto;
  607. }
  608. .p-4 {
  609. padding: 1rem;
  610. }
  611. .hidden-input .el-input__inner {
  612. width: 0;
  613. padding: 0;
  614. }
  615. </style>