orderDeliverList.vue 18 KB

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