orderList.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. <template>
  2. <view class="order-list">
  3. <u-sticky bgColor="#fff">
  4. <view class="search-wrap">
  5. <view class="input-wrap">
  6. <view @click="showPopup('popupTenant')" class="input">
  7. {{form.tenantName}}
  8. </view>
  9. </view>
  10. </view>
  11. <view class="tabs-box">
  12. <u-tabs lineWidth="40" :list="vehicleTypeList.filter((item)=>{return item.isShow==true})"
  13. :current="currentVehicleType" @change="onVehicleTypeChange" lineColor="#3275F5"
  14. :itemStyle="{'height':'90rpx','padding':'0 32rpx'}">
  15. <view slot="right" style="padding-left: 160rpx;">
  16. </view>
  17. </u-tabs>
  18. <view @click="onClickRight" class="sx-btn">
  19. <uni-icons type="settings-filled" size='24'></uni-icons>
  20. <view>筛选</view>
  21. </view>
  22. <view class="orderStatus-tab abreast" v-if="form.vehicleType == '102'">
  23. <span :class="form.isCheck == item.value ? 'active' : ''" v-for="item in orderCheckList"
  24. @click="onOrderCheckChange(item)" :key="item.name">
  25. {{ item.name }}
  26. </span>
  27. </view>
  28. <view class="orderStatus-tab abreast" v-if="form.vehicleType == '101'">
  29. <span :class="form.loadFlag == item.value ? 'active' : ''" v-for="item in orderDeliverList"
  30. @click="onOrderDeliverChange(item)" :key="item.name">
  31. {{ item.name }}
  32. </span>
  33. </view>
  34. </view>
  35. <PopupSelect ref="popupTenant" :hasSearch='false' :option="tenantOption" @onConfirm="onTenantConfirm"
  36. @search="bindOption" />
  37. </u-sticky>
  38. <!-- 企业选项 -->
  39. <view class="swiper-box">
  40. <template v-if="orderList.length">
  41. <u-list @scrolltolower="scrolltolower" :preLoadScreen="1.5">
  42. <u-list-item v-for="(item, index) in orderList" :key="index">
  43. <view class="order-card">
  44. <view class="order-card-title">
  45. <span class="type" v-if="item.orderType == '1'">{{ $t('order.temp') }}</span>
  46. <span class="type fixed" v-if="item.orderType == '2'">{{ $t('order.fixed') }}</span>
  47. <span class="type fixed" v-if="item.orderType == '5'">{{ $t('order.plan') }}</span>
  48. <text class="info">{{ item.tenantName || '' }}</text>
  49. <view class="out-type" v-if="item.backFlag == '1'">
  50. {{item.vehicleType=='101'?$t('order.isBackOut'):$t('order.return')}}
  51. </view>
  52. <template v-if="item.vehicleType == '101'">
  53. <span class="status" v-if="item.loadFlag == '0'">未发货</span>
  54. <span class="status" v-if="item.loadFlag == '2'">已发货</span>
  55. </template>
  56. <template v-if="item.vehicleType == '102'">
  57. <span class="status" v-if="item.isCheck == '0'">未验收</span>
  58. <span class="status" v-if="item.isCheck == '1'">已验收</span>
  59. </template>
  60. </view>
  61. <view class="order-card-info">
  62. <view class="order-type">
  63. <u-tag :text="$t('order.suppOrder')" type="error" v-if="item.isMain == 1"></u-tag>
  64. <u-tag :text="$t('order.mixed')" type="success" v-if="item.isMain == 2"></u-tag>
  65. </view>
  66. <view class="row">
  67. <p class="cell">
  68. <!-- <text class="label">{{ $t('order.companyName') }}</text> -->
  69. <text class="info">{{ item.companyName || '' }}</text>
  70. </p>
  71. </view>
  72. <view class="row">
  73. <p class="cell">
  74. <!-- <text class="label">{{ $t('order.orderDate') }}</text> -->
  75. <text class="info">{{ item.setDate || '' }}</text>
  76. </p>
  77. <p class="cell">
  78. <!-- <text class="label">{{ $t('order.vehicleType') }}</text> -->
  79. <text class="info"
  80. v-if="item.vehicleType == '101'">{{ $t('order.saleOrder') }}</text>
  81. <text class="info"
  82. v-if="item.vehicleType == '102'">{{ $t('order.purchaseOrder') }}</text>
  83. <!-- <span class="tag tag-ls"
  84. v-if="item.orderType == '1'">{{ $t('order.temp') }}</span>
  85. <span class="tag tag-gd"
  86. v-if="item.orderType == '2'">{{ $t('order.fixed') }}</span> -->
  87. </p>
  88. </view>
  89. <view class="row">
  90. <p class="cell">
  91. <!-- <text class="label">{{ $t('order.materialName') }}</text> -->
  92. <text class="info">{{ item.materialName || '' }}</text>
  93. </p>
  94. <p class="cell">
  95. <!-- <text class="label">{{ $t('order.orderNumber') }}</text> -->
  96. <text
  97. :style="'font-size: 9pt;font-weight: bold;'+(item.companyClientType=='109'?'color: green;':'color: red;')"
  98. class="info">{{ item.orderNumber || '' }}{{item.materialKind=='101' && item.companyClientType=='109'?$t('customer_meter.unitB') :(item.orderType ==
  99. '4' ? $t('customer_meter.unitN') : $t('customer_meter.unitT')) }}</text>
  100. </p>
  101. </view>
  102. <view class="row">
  103. <p class="cell">
  104. <!-- <text class="label">{{ $t('order.vehicle') }}</text> -->
  105. <text class="info">{{ item.vehicle || '' }}</text>
  106. </p>
  107. <p class="cell">
  108. <!-- <text class="label">{{ $t('order.driver') }}</text> -->
  109. <text class="info">{{ item.driver || '' }}-{{ item.phone || '' }}</text>
  110. </p>
  111. </view>
  112. <template v-if="item.vehicleType=='101'">
  113. <view class="row">
  114. <p class="cell">
  115. <text class="label">{{ $t('deliver.deliverUserName') }}</text>
  116. <text class="info">{{ item.loadUserName || '' }}</text>
  117. </p>
  118. </view>
  119. <view class="row">
  120. <p class="cell">
  121. <text class="label">{{ $t('deliver.deliverTime') }}</text>
  122. <text class="info">{{ item.loadTime || '' }}</text>
  123. </p>
  124. </view>
  125. </template>
  126. <template v-if="item.vehicleType=='102'">
  127. <view class="row">
  128. <p class="cell">
  129. <text class="label">{{ $t('accept.acceptUserName') }}</text>
  130. <text class="info">{{ item.checkUserName || '' }}</text>
  131. </p>
  132. </view>
  133. <view class="row">
  134. <p class="cell">
  135. <text class="label">{{ $t('accept.acceptTime') }}</text>
  136. <text class="info">{{ item.checkDate || '' }}</text>
  137. </p>
  138. </view>
  139. </template>
  140. <!--
  141. <view class="row" v-if="item.isMain == 1 || item.isMain == 2">
  142. <p class="cell">
  143. <text
  144. class="label">{{ item.isMain == 1 ? $t('order.mainOrder') : $t('order.suppOrder') }}</text>
  145. <text class="info used">{{ item.relationOrderCode || '' }}</text>
  146. </p>
  147. </view> -->
  148. <!-- <view class="qrcode-logo" @click="drawQrcode(item)">
  149. <image class="img" src="/subpages/static/czzn-img/state/qrcode.png"
  150. mode="scaleToFill" />
  151. </view> -->
  152. <!-- <view class="row" v-if="item.orderStatus != 0 && item.weighingStatus != 0">
  153. <p class="cell">
  154. <text class="label">{{ $t('order.tareWeight') }}</text>
  155. <text class="info">{{ item.tareWeight || '0' }}</text>
  156. </p>
  157. <p class="cell">
  158. <text class="label">{{ $t('order.grossWeight') }}</text>
  159. <text class="info">{{ item.grossWeight || '0' }}</text>
  160. </p>
  161. </view>
  162. <view class="row" v-if="item.orderStatus != 0 && item.weighingStatus == 2">
  163. <p class="cell">
  164. <text class="label">{{ $t('order.outTime') }}</text>
  165. <text class="info">{{ item.outTime || '' }}</text>
  166. </p>
  167. </view>
  168. <view class="row" v-if="item.orderStatus == 2">
  169. <p class="cell">
  170. <text class="label">{{ $t('order.outDate') }}</text>
  171. <text class="info">{{ item.outDoorTime || '' }}</text>
  172. </p>
  173. </view> -->
  174. </view>
  175. <view class="code">
  176. <view class="label">{{$t('order.orderCode')}}</view>
  177. <view class="info">{{ item.code || '' }}</view>
  178. <view class="label">{{$t('order.source')}}</view>
  179. <view class="info"> {{$t('order.mini')}}</view>
  180. <!-- <view class="info"> {{getLabel(item.orderSource,orderSourceList)}}</view> -->
  181. </view>
  182. <view class="order-card-bottom">
  183. <view class="btn">
  184. <button class="oper-btn" type='primary' shape="circle" color='#4680F9' size="small"
  185. @click="onOrderInfoClick(item)">
  186. {{ $t('mine.detail') }}
  187. </button>
  188. </view>
  189. </view>
  190. </view>
  191. </u-list-item>
  192. </u-list>
  193. </template>
  194. <template v-else>
  195. <u-empty mode="order" icon="https://cdn.uviewui.com/uview/empty/list.png">
  196. </u-empty>
  197. </template>
  198. </view>
  199. <u-popup :show="showSearch" :round="16" @close="showSearch = false" mode="bottom">
  200. <view class="search-dialog">
  201. <p class="dialog-title">{{ $t('base.common.condition') }}</p>
  202. <view class="condition-wrap">
  203. <view class="row">
  204. <uni-datetime-picker :end='maxDate' :clear-icon="false" :value="searchOption.range"
  205. type="daterange" @change="confirm" />
  206. </view>
  207. <!-- 输入内容 -->
  208. <view class="row">
  209. <p class="p-title">{{ $t('base.common.placeholder') }}</p>
  210. <u-search class="p-input" bgColor='#fff' :showAction='false'
  211. :placeholder="$t('base.common.inputPlaceholder')" v-model="keyword">
  212. </u-search>
  213. </view>
  214. <!-- 选择客商 -->
  215. <view @click="showPopup('popupCompany')" class="row">
  216. <p class="p-title">{{ $t('order.vehicle') }}</p>
  217. <u-search class="p-input" bgColor='#fff' :showAction='false'
  218. :placeholder="$t('base.common.inputPlaceholder')" v-model="vehicle">
  219. </u-search>
  220. </view>
  221. </view>
  222. <view class="sure-btn">
  223. <button class="btn" @click="bindOrderList">{{ $t('base.common.submit') }}</button>
  224. </view>
  225. </view>
  226. </u-popup>
  227. <u-loading-page color="#666" loading-mode="semicircle" :loading="loading">
  228. </u-loading-page>
  229. <u-toast ref="loadingToast"></u-toast>
  230. </view>
  231. </template>
  232. <script>
  233. import {
  234. mapGetters,
  235. } from "vuex";
  236. import {
  237. getOrderPage,
  238. cancelOrder,
  239. getCustomerList,
  240. getMeterList,
  241. getOption,
  242. getPlanOrderVehicleList
  243. } from "../../../api/order";
  244. import PopupSelect from '../../../components/popup-select/index'
  245. import {
  246. getTenantCacheList,
  247. getLabel
  248. } from '../../../utils/util.js'
  249. import {
  250. getDealerTenantList,
  251. } from "../../../api/tenant.js";
  252. import dayjs from 'dayjs'
  253. export default {
  254. components: {
  255. PopupSelect
  256. },
  257. data() {
  258. return {
  259. getLabel,
  260. maxDate: dayjs().format('YYYY-MM-DD'),
  261. searchOption: {
  262. range: [dayjs().add(-30, 'day').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
  263. vehicleTypeList: [{
  264. name: this.$t("mine.all"),
  265. disabled: false,
  266. value: '0',
  267. }, ],
  268. },
  269. loading: true, //页面加载状态
  270. currentOrder: {}, //订单id
  271. currentVehicleType: "",
  272. form: {
  273. type: "0",
  274. orderType: '',
  275. orderStatus: 0,
  276. tenantId: '',
  277. tenantName: '',
  278. companyId: "", //客商
  279. materialId: "", //物料
  280. companyName: "", //客商
  281. materialName: "", //物料
  282. vehicleType: "",
  283. isCheck: '0',
  284. loadFlag: '0' //是否已装车 0未装车,1已装车(发货)
  285. },
  286. currentCheckType: 0,
  287. vehicleTypeList: [{
  288. name: this.$t("order.accept"),
  289. isShow: false,
  290. value: '102',
  291. index: 0,
  292. },
  293. {
  294. name: this.$t("order.deliver"),
  295. isShow: false,
  296. value: '101',
  297. index: 1,
  298. },
  299. ],
  300. orderCheckList: [{
  301. name: this.$t("accept.noneAccept"),
  302. isShow: true,
  303. value: '0',
  304. index: 0,
  305. key: "all",
  306. },
  307. {
  308. name: this.$t("accept.accepted"),
  309. isShow: true,
  310. value: '1',
  311. index: 1,
  312. },
  313. ],
  314. orderDeliverList: [{
  315. name: this.$t("deliver.noneDeliver"),
  316. isShow: true,
  317. value: '0',
  318. index: 0,
  319. key: "all",
  320. },
  321. {
  322. name: this.$t("deliver.delivered"),
  323. isShow: true,
  324. value: '2',
  325. index: 1,
  326. },
  327. ],
  328. orderSourceList: [{
  329. name: this.$t("order.pc"), //PC端
  330. value: '1'
  331. },
  332. {
  333. name: this.$t("order.mini"), //小程序
  334. value: '2'
  335. }, {
  336. name: this.$t("order.fixed"), //固定订单生成
  337. value: '3'
  338. },
  339. {
  340. name: this.$t("order.special"), //由特殊订单生成
  341. value: '4'
  342. },
  343. {
  344. name: this.$t("order.handWeigh"), //由手工过磅生成
  345. value: '5'
  346. },
  347. {
  348. name: this.$t("order.repair"), //由补录生成
  349. value: '6'
  350. },
  351. {
  352. name: this.$t("order.bath"), //由批量订单生成
  353. value: '7'
  354. },
  355. {
  356. name: this.$t("order.third"), //第三方生成
  357. value: '8'
  358. },
  359. {
  360. name: this.$t("order.share"), //共享订单
  361. value: '12'
  362. },
  363. {
  364. name: this.$t("order.plan"), //计划订单
  365. value: '13'
  366. },
  367. ],
  368. page: {
  369. pages: 1,
  370. size: 5,
  371. },
  372. orderList: [],
  373. showSearch: false,
  374. keyword: '',
  375. vehicle: '',
  376. hasMore: false,
  377. tenantOption: [{
  378. text: this.$t('base.common.noData'),
  379. value: null
  380. }], //企业选项
  381. isDeliverUser: false,
  382. isAcceptUser: false,
  383. };
  384. },
  385. mounted() {
  386. console.log("order list mounted");
  387. },
  388. computed: {
  389. ...mapGetters({
  390. userInfo: "user/info",
  391. hasLogin: "user/hasLogin",
  392. }),
  393. },
  394. onShow() {
  395. let routes = getCurrentPages();
  396. let options = routes[routes.length - 1].options;
  397. console.log("开始onShow 当前用户信息", options, this.userInfo);
  398. this.currentCheckType = options.isCheck
  399. this.searchList();
  400. },
  401. onLoad() {
  402. this.bindTenant()
  403. this.isAcceptUser = uni.getStorageSync('isAcceptUser')
  404. this.isDeliverUser = uni.getStorageSync('isDeliverUser')
  405. for (var i = 0; i < this.vehicleTypeList.length; i++) {
  406. if (this.vehicleTypeList[i].value == "101" && this.isDeliverUser == true) {
  407. this.$set(this.vehicleTypeList[i], "isShow", true);
  408. }
  409. if (this.vehicleTypeList[i].value == "102" && this.isAcceptUser == true) {
  410. this.$set(this.vehicleTypeList[i], "isShow", true);
  411. }
  412. }
  413. var vehicleInfo = this.vehicleTypeList.filter(p => {
  414. return p.isShow == true
  415. });
  416. if (vehicleInfo) {
  417. this.form.vehicleType = vehicleInfo[0].value
  418. }
  419. },
  420. methods: {
  421. onOrderDeliverChange(item) {
  422. this.form.loadFlag = item.value
  423. this.form.isCheck = ''
  424. this.searchList()
  425. },
  426. onOrderCheckChange(item) {
  427. this.form.isCheck = item.value
  428. this.form.loadFlag = ''
  429. this.searchList()
  430. },
  431. //切换订单类型
  432. onVehicleTypeChange(item) {
  433. this.form.isCheck = '0'
  434. this.form.loadFlag = '0'
  435. this.form.vehicleType = item.value;
  436. this.searchList()
  437. },
  438. //获取企业选项
  439. bindTenant() {
  440. this.tenantOption = getTenantCacheList();
  441. if (this.tenantOption.length > 0) {
  442. this.form.tenantId = this.tenantOption[0].value
  443. this.form.tenantName = this.tenantOption[0].text
  444. } else {
  445. // uni.showModal({
  446. // title: this.$t('settings.tips'),
  447. // showCancel: false,
  448. // content: this.$t('base.common.registerTenant'),
  449. // confirmText: this.$t('base.button.regedit'),
  450. // success: res => {
  451. // if (res.confirm) {
  452. // uni.navigateTo({
  453. // url: '/subpages/tenant/list?q=add'
  454. // });
  455. // }
  456. // },
  457. // fail: () => {},
  458. // complete: () => {}
  459. // });
  460. this.loading = false;
  461. return;
  462. }
  463. },
  464. //去订单详情
  465. onOrderInfoClick(item) {
  466. uni.navigateTo({
  467. url: `/substaticpages/cargoOperator/order/orderInfo?orderId=${item.id}&tenantId=${item.tenantId}&orderStatus=${item.orderStatus}`
  468. })
  469. },
  470. //确定选择日期
  471. confirm(item) {
  472. this.searchOption.range = item
  473. },
  474. //点击右侧筛选
  475. onClickRight() {
  476. this.showSearch = true
  477. },
  478. //搜索列表
  479. searchList() {
  480. this.page.pages = 1
  481. this.hasMore = false
  482. this.bindOrderList()
  483. },
  484. //获取订单列表
  485. bindOrderList() {
  486. var that = this;
  487. if (!that.form.tenantId) {
  488. uni.showToast({
  489. title: that.$t('base.common.placeholderS') + that.$t('base.common.tenant'),
  490. icon: 'none',
  491. duration: 2000
  492. })
  493. return;
  494. }
  495. that.form.weighingStatus = ''
  496. that.form.orderStatus = ''
  497. if ((that.form.vehicleType=='102' && that.form.isCheck == 0) || (that.form.vehicleType=='101' && that.form.loadFlag == 0)) {
  498. that.form.weighingStatus = 1
  499. that.form.orderStatus = 1
  500. }
  501. that.showSearch = false
  502. let data = {
  503. appUserType: "6",
  504. current: that.page.pages,
  505. size: that.page.size,
  506. orderStatus: that.form.orderStatus,
  507. weighingStatus: that.form.weighingStatus,
  508. keywords: that.keyword || '',
  509. startDate: that.searchOption.range[0] || '',
  510. endDate: that.searchOption.range[1] || '',
  511. vehicleType: that.form.vehicleType,
  512. orderType: that.form.orderType || '',
  513. tenantId: that.form.tenantId || '',
  514. isCheck: that.form.isCheck || '',
  515. loadFlag: that.form.loadFlag || '',
  516. vehicle: that.vehicle || '',
  517. checkUser: that.userInfo.userId
  518. };
  519. getOrderPage(data).then((res) => {
  520. if (res.statusCode == 200) {
  521. // that.orderList = res.data.data.records;
  522. if (res.data.data.records.length == 0) {
  523. that.orderList = [];
  524. }
  525. if (that.hasMore) {
  526. that.orderList = [
  527. ...that.orderList,
  528. ...res.data.data.records,
  529. ];
  530. } else {
  531. that.orderList = res.data.data.records;
  532. }
  533. that.total = res.data.data.total;
  534. if (that.orderList.length >= that.total) {
  535. that.hasMore = false;
  536. } else {
  537. that.hasMore = true;
  538. }
  539. console.log("当前订单信息、", that.orderList);
  540. }
  541. that.loading = false;
  542. });
  543. },
  544. //加载更多
  545. scrolltolower() {
  546. console.log("1111111111111111");
  547. if (this.hasMore) {
  548. this.page.pages += 1;
  549. this.bindOrderList();
  550. }
  551. },
  552. //显示选择
  553. showPopup(refs) {
  554. this.$refs[refs].showPicker = true
  555. },
  556. //选择企业
  557. onTenantConfirm(value) {
  558. this.form.tenantId = ''
  559. this.form.tenantName = ''
  560. if (value.value) {
  561. this.form.tenantId = value.value
  562. this.form.tenantName = value.text
  563. }
  564. this.searchList();
  565. },
  566. },
  567. };
  568. </script>
  569. <style>
  570. /* #ifndef H5 */
  571. page {
  572. /* height: 100%; */
  573. background-color: #f2f2f2;
  574. }
  575. /* #endif */
  576. </style>
  577. <style lang="scss" scoped>
  578. @import '../../../common/css/public.scss';
  579. </style>