vehicleOrderList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <template>
  2. <view class="order-list content">
  3. <view class="swiper-box">
  4. <template v-if="orderList.length">
  5. <u-list @scrolltolower="scrolltolower" :preLoadScreen="1.5">
  6. <u-list-item v-for="(item, index) in orderList" :key="index">
  7. <view class="order-card">
  8. <view class="order-card-title">
  9. <span class="type" v-if="item.orderType == '1'">{{
  10. $t("order.temp")
  11. }}</span>
  12. <span class="type fixed" v-if="item.orderType == '2'">{{
  13. $t("order.fixed")
  14. }}</span>
  15. <span class="type fixed" v-if="item.orderType == '5'">{{
  16. $t("order.plan")
  17. }}</span>
  18. <text class="info">{{ item.tenantName || "" }}</text>
  19. <!-- <text class="no">No {{ item.code || '' }}</text> -->
  20. <view class="out-type" v-if="item.backFlag == '1'">
  21. {{
  22. item.vehicleType == "101"
  23. ? $t("order.isBackOut")
  24. : $t("order.return")
  25. }}
  26. </view>
  27. <template v-if="item.orderType != '4'">
  28. <span class="status" v-if="item.orderStatus == '0'"
  29. >未进厂</span
  30. >
  31. <span
  32. class="status"
  33. v-if="item.orderStatus == '1' && item.weighingStatus == '0'"
  34. >已进厂</span
  35. >
  36. <span class="status" v-if="item.orderStatus == '2'"
  37. >已完成</span
  38. >
  39. <span
  40. class="status"
  41. v-if="item.orderStatus == '1' && item.weighingStatus != '0'"
  42. >已过磅</span
  43. >
  44. <span class="status bad-status" v-if="item.orderStatus == '4'"
  45. >已作废</span
  46. >
  47. </template>
  48. <template v-if="item.orderType == '4'">
  49. <span class="status" v-if="item.orderStatus == '0'"
  50. >未接单</span
  51. >
  52. <span class="status" v-if="item.orderStatus == '1'"
  53. >接单中</span
  54. >
  55. <span class="status" v-if="item.orderStatus == '2'"
  56. >已完成</span
  57. >
  58. <span
  59. class="status bad-status"
  60. v-if="
  61. item.enabledMarkType == '1' || item.orderStatus == '4'
  62. "
  63. >已作废</span
  64. >
  65. </template>
  66. </view>
  67. <view class="order-card-info">
  68. <view class="order-type">
  69. <u-tag
  70. :text="$t('order.suppOrder')"
  71. type="error"
  72. v-if="item.isMain == 1"
  73. ></u-tag>
  74. <u-tag
  75. :text="$t('order.mixed')"
  76. type="success"
  77. v-if="item.isMain == 2"
  78. ></u-tag>
  79. </view>
  80. <view class="row">
  81. <p class="cell">
  82. <!-- <text class="label">{{ $t('order.companyName') }}</text> -->
  83. <text class="info">{{ item.companyName || "" }}</text>
  84. </p>
  85. </view>
  86. <view class="row">
  87. <p class="cell">
  88. <!-- <text class="label">{{ $t('order.orderDate') }}</text> -->
  89. <text class="info">{{ item.setDate || "" }}</text>
  90. </p>
  91. <p class="cell">
  92. <text class="info" v-if="item.vehicleType == '101'">{{
  93. $t("order.saleOrder")
  94. }}</text>
  95. <text class="info" v-if="item.vehicleType == '102'">{{
  96. $t("order.purchaseOrder")
  97. }}</text>
  98. <text class="info" v-if="item.vehicleType == '103'">{{
  99. $t("order.materialsOrder")
  100. }}</text>
  101. <text class="info" v-if="item.vehicleType == '104'">{{
  102. $t("order.transferOrder")
  103. }}</text>
  104. </p>
  105. </view>
  106. <view class="row">
  107. <p class="cell">
  108. <!-- <text class="label">{{ $t('order.materialName') }}</text> -->
  109. <text class="info">{{ item.materialName || "" }}</text>
  110. </p>
  111. <p class="cell">
  112. <!-- <text class="label">{{ $t('order.orderNumber') }}</text> -->
  113. <text
  114. class="info"
  115. :style="
  116. 'font-size: 9pt;font-weight: bold;' +
  117. (item.companyClientType == '109'
  118. ? 'color: green;'
  119. : 'color: red;')
  120. "
  121. >{{ item.orderNumber || ""
  122. }}{{
  123. item.materialKind == "101" &&
  124. item.companyClientType == "109"
  125. ? $t("customer_meter.unitB")
  126. : item.orderType == "4"
  127. ? $t("customer_meter.unitN")
  128. : $t("customer_meter.unitT")
  129. }}</text
  130. >
  131. </p>
  132. </view>
  133. <view class="row">
  134. <p class="cell">
  135. <!-- <text class="label">{{ $t('order.driver') }}</text> -->
  136. <text class="info"
  137. >{{ item.driver || "" }}-{{ item.phone || "" }}</text
  138. >
  139. </p>
  140. <p class="cell">
  141. <!-- <text class="label">{{ $t('order.vehicle') }}</text> -->
  142. <text class="info">{{ item.vehicle || "" }}</text>
  143. </p>
  144. </view>
  145. </view>
  146. <view class="code">
  147. <view class="label">{{ $t("spare.orderCode") }}</view>
  148. <view class="info">{{ item.code || "" }}</view>
  149. <view class="label">{{ $t("order.source") }}</view>
  150. <view class="info"> {{$t('order.mini')}}</view>
  151. <!-- <view class="info">{{ getLabel(item.orderSource, orderSourceList) }}</view> -->
  152. </view>
  153. <view class="order-card-bottom">
  154. <view class="btn" v-if="item.orderStatus != 4">
  155. <button
  156. class="oper-btn"
  157. type="primary"
  158. shape="circle"
  159. color="#CCCCCC"
  160. size="small"
  161. @click="onOrderInfoClick(item)"
  162. >
  163. {{ $t("settings.confirmText") }}
  164. </button>
  165. </view>
  166. </view>
  167. </view>
  168. </u-list-item>
  169. </u-list>
  170. </template>
  171. <template v-else>
  172. <u-empty
  173. mode="orderTypeList"
  174. icon="https://cdn.uviewui.com/uview/empty/list.png"
  175. >
  176. </u-empty>
  177. </template>
  178. </view>
  179. </view>
  180. </template>
  181. <script>
  182. import { getOrderPage, replaceVehicleOrder } from "../../../api/order";
  183. import PopupSelect from "../../../components/popup-select/index";
  184. import { getLabel } from "../../../utils/util.js";
  185. import dayjs from "dayjs";
  186. export default {
  187. components: {
  188. PopupSelect,
  189. },
  190. data() {
  191. return {
  192. getLabel,
  193. maxDate: dayjs().format("YYYY-MM-DD"),
  194. searchOption: {
  195. range: [
  196. dayjs().add(-30, "day").format("YYYY-MM-DD"),
  197. dayjs().format("YYYY-MM-DD"),
  198. ],
  199. vehicleTypeList: [
  200. {
  201. name: this.$t("mine.all"),
  202. disabled: false,
  203. value: "0",
  204. },
  205. ],
  206. },
  207. loading: true, //页面加载状态
  208. showQrcode: false, // 二维码展示
  209. currentOrder: {}, //订单id
  210. vehicleOption: [],
  211. form: {
  212. type: "0",
  213. orderType: "",
  214. orderStatus: 0,
  215. tenantId: "",
  216. tenantName: "",
  217. dealerId: "", //客商
  218. dealerName: "", //客商
  219. vehicle: "",
  220. },
  221. currentOrderType: 0,
  222. orderTypeList: [
  223. {
  224. name: this.$t("mine.all"),
  225. disabled: false,
  226. value: "",
  227. index: 0,
  228. },
  229. {
  230. name: this.$t("order.temp"),
  231. disabled: false,
  232. value: "1",
  233. index: 1,
  234. },
  235. {
  236. name: this.$t("order.fixed"),
  237. disabled: false,
  238. value: "2",
  239. index: 2,
  240. },
  241. {
  242. name: this.$t("order.share"),
  243. disabled: false,
  244. value: "4",
  245. index: 3,
  246. },
  247. ],
  248. orderStatusList: [
  249. {
  250. name: this.$t("mine.reviewed"),
  251. value: "0",
  252. },
  253. {
  254. name: this.$t("mine.unpaid"),
  255. value: "1",
  256. },
  257. {
  258. name: this.$t("mine.weigh"),
  259. value: "3",
  260. },
  261. {
  262. name: this.$t("mine.ongoing"),
  263. value: "2",
  264. },
  265. {
  266. name: this.$t("mine.invalid"),
  267. value: "4",
  268. },
  269. ],
  270. orderSourceList: [
  271. {
  272. name: this.$t("order.pc"), //PC端
  273. value: "1",
  274. },
  275. {
  276. name: this.$t("order.mini"), //小程序
  277. value: "2",
  278. },
  279. {
  280. name: this.$t("order.fixed"), //固定订单生成
  281. value: "3",
  282. },
  283. {
  284. name: this.$t("order.special"), //由特殊订单生成
  285. value: "4",
  286. },
  287. {
  288. name: this.$t("order.handWeigh"), //由手工过磅生成
  289. value: "5",
  290. },
  291. {
  292. name: this.$t("order.repair"), //由补录生成
  293. value: "6",
  294. },
  295. {
  296. name: this.$t("order.bath"), //由批量订单生成
  297. value: "7",
  298. },
  299. {
  300. name: this.$t("order.third"), //第三方生成
  301. value: "8",
  302. },
  303. {
  304. name: this.$t("order.share"), //共享订单
  305. value: "12",
  306. },
  307. {
  308. name: this.$t("order.plan"), //计划订单
  309. value: "13",
  310. },
  311. ],
  312. shareOrderStatusList: [
  313. {
  314. name: this.$t("order.waitOrderReceive"),
  315. value: "0",
  316. },
  317. {
  318. name: this.$t("order.orderReceiving"),
  319. value: "1",
  320. },
  321. {
  322. name: this.$t("order.orderReceiveComplete"),
  323. value: "2",
  324. },
  325. {
  326. name: this.$t("mine.invalid"),
  327. value: "4",
  328. },
  329. ],
  330. page: {
  331. pages: 1,
  332. size: 5,
  333. },
  334. currentOrderType: "",
  335. orderList: [],
  336. showSearch: false,
  337. keyword: "",
  338. hasMore: false,
  339. tenantOption: [
  340. {
  341. text: this.$t("base.common.noData"),
  342. value: null,
  343. },
  344. ], //企业选项
  345. companyOption: [], //客户选项
  346. materialOption: [
  347. {
  348. text: this.$t("base.common.noData"),
  349. value: null,
  350. },
  351. ], //物料选项
  352. //业务对应的客户信息
  353. vehicleTypeCompanyList: [],
  354. //客户对应的物料信息
  355. companyMaterialList: [],
  356. //业务类型对应的物料信息
  357. appAllMaterial: [],
  358. isAuditUser: false,
  359. isDealerUser: false,
  360. isDriverUser: false,
  361. isRefresh: false,
  362. vehicle: "",
  363. tenantId: "",
  364. orderId: "",
  365. };
  366. },
  367. mounted() {
  368. console.log("order list mounted");
  369. },
  370. onLoad(options) {
  371. this.vehicle = options.vehicle;
  372. this.tenantId = options.tenantId;
  373. this.orderId = options.orderId;
  374. this.searchList();
  375. },
  376. onShow() {},
  377. methods: {
  378. //搜索列表
  379. searchList() {
  380. this.page.pages = 1;
  381. this.hasMore = false;
  382. this.isRefresh = false;
  383. this.bindOrderList();
  384. },
  385. //获取订单列表
  386. bindOrderList() {
  387. var that = this;
  388. if (!that.tenantId) {
  389. uni.showToast({
  390. title:
  391. that.$t("base.common.placeholderS") + that.$t("base.common.tenant"),
  392. icon: "none",
  393. duration: 2000,
  394. });
  395. return;
  396. }
  397. that.showSearch = false;
  398. let data = {
  399. appUserType: "5",
  400. current: that.page.pages,
  401. size: that.page.size,
  402. // orderType: '1',
  403. tenantId: that.tenantId || "",
  404. vehicle: that.vehicle || "",
  405. orderStatus: "0",
  406. };
  407. getOrderPage(data).then((res) => {
  408. if (res.statusCode == 200) {
  409. // that.orderList = res.data.data.records;
  410. if (res.data.data.records.length == 0) {
  411. that.orderList = [];
  412. }
  413. if (that.hasMore) {
  414. that.orderList = [...that.orderList, ...res.data.data.records];
  415. } else {
  416. that.orderList = res.data.data.records;
  417. }
  418. that.total = res.data.data.total;
  419. if (that.orderList.length >= that.total) {
  420. that.hasMore = false;
  421. } else {
  422. that.hasMore = true;
  423. }
  424. console.log("当前订单信息、", that.orderList);
  425. }
  426. that.loading = false;
  427. });
  428. },
  429. //加载更多
  430. scrolltolower() {
  431. console.log("1111111111111111");
  432. if (this.hasMore) {
  433. this.page.pages += 1;
  434. this.bindOrderList();
  435. }
  436. },
  437. //确定更换
  438. onOrderInfoClick(item) {
  439. let that = this;
  440. console.log("item-----", JSON.stringify(item));
  441. //显示加载框
  442. uni.showLoading({
  443. title: that.$t('userinfo.setting')
  444. });
  445. let data = {
  446. tenantId: that.tenantId,
  447. orderId: that.orderId,
  448. newOrderId: item.id,
  449. };
  450. replaceVehicleOrder(data).then((res) => {
  451. if (res.statusCode == 200) {
  452. uni.showToast({
  453. title: that.$t("mine.operateOk"),
  454. icon: "none",
  455. duration: 2000,
  456. });
  457. uni.navigateTo({
  458. url: `/substaticpages/cargoOperator/deliver/orderDeliverList?isDeliver=1'`,
  459. });
  460. return;
  461. }
  462. //隐藏加载框
  463. uni.hideLoading();
  464. });
  465. },
  466. clear() {},
  467. },
  468. };
  469. </script>
  470. <style>
  471. /* #ifndef APP-NVUE */
  472. page {
  473. background-color: #f5f7fa;
  474. }
  475. /* #endif */
  476. </style>
  477. <style lang="scss" scoped>
  478. @import "../../../common/css/public.scss";
  479. </style>