transOrderList.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  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--input prefixIcon="account-fill" readonly :placeholder="$t('queue.pleaseSelectTenant')"
  8. prefixIconStyle="font-size:46rpx" border="none" v-model="form.tenantName"
  9. :showAction='false'></u--input>
  10. </view>
  11. <view @click="onClickRight" class="sx-btn">
  12. <uni-icons type="settings-filled" size='24'></uni-icons>
  13. <view>{{$t('base.common.condition')}}</view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="tabs-box">
  18. <u-tabs lineWidth="40" :list="orderTypeList.filter((item)=>{return item.isShow==true})"
  19. :current="currentOrderType" @change="onChangeOrderType" lineColor="#3275F5"
  20. :itemStyle="{'height':'90rpx','padding':'0 32rpx'}">
  21. <view slot="right" style="padding-left: 160rpx;">
  22. </view>
  23. </u-tabs>
  24. <view v-if="form.orderType != '5' && form.orderType != '4'">
  25. <u-tabs lineWidth="40" :list="orderStatusList"
  26. :current="form.orderStatus" @change="changeOrderStatus" lineColor="#3275F5"
  27. :itemStyle="{'height':'90rpx','padding':'0 32rpx'}">
  28. </u-tabs>
  29. <!-- <span :class="form.orderStatus == item.value ? 'active' : ''" v-for="item in orderStatusList"
  30. @click="changeOrderStatus(item)" :key="item.name">
  31. {{ item.name }}
  32. </span> -->
  33. </view>
  34. <view v-if="form.orderType == '4'">
  35. <u-tabs lineWidth="40" :list="shareOrderStatusList"
  36. :current="form.orderStatus" @change="changeOrderStatus" lineColor="#3275F5"
  37. :itemStyle="{'height':'90rpx','padding':'0 32rpx'}">
  38. </u-tabs>
  39. <!-- <span :class="form.orderStatus == item.value ? 'active' : ''" v-for="item in shareOrderStatusList"
  40. @click="changeOrderStatus(item)" :key="item.name">
  41. {{ item.name }}
  42. </span> -->
  43. </view>
  44. </view>
  45. <PopupSelect ref="popupTenant" :hasSearch='false' :option="tenantOption" @onConfirm="onTenantConfirm"
  46. @search="bindOption" />
  47. </u-sticky>
  48. <!-- 企业选项 -->
  49. <view class="swiper-box">
  50. <template v-if="orderList.length">
  51. <u-list @scrolltolower="scrolltolower" :preLoadScreen="1.5">
  52. <u-list-item v-for="(item, index) in orderList" :key="index">
  53. <view class="order-card">
  54. <view class="order-card-title">
  55. <span class="type" v-if="item.orderType == '1'">{{ $t('order.temp') }}</span>
  56. <span class="type fixed" v-if="item.orderType == '2'">{{ $t('order.fixed') }}</span>
  57. <span class="type fixed" v-if="item.orderType == '5'">{{ $t('order.plan') }}</span>
  58. <text class="info">{{ item.tenantName || '' }}</text>
  59. <view class="out-type" v-if="item.backFlag == '1'">
  60. {{item.vehicleType=='101'?$t('order.isBackOut'):$t('order.return')}}
  61. </view>
  62. <template v-if="item.orderType != '4'">
  63. <span class="status bad-status" v-if="item.enabledMarkType == '1'">已作废</span>
  64. <span class="status" v-else-if="item.orderStatus == '0'">未进厂</span>
  65. <span class="status"
  66. v-else-if="item.orderStatus == '1' && item.weighingStatus == '0'">已进厂</span>
  67. <span class="status" v-else-if="item.orderStatus == '2'">已完成</span>
  68. <span class="status"
  69. v-else-if="item.orderStatus == '1' && item.weighingStatus != '0'">已过磅</span>
  70. </template>
  71. <template v-if="item.orderType == '4'">
  72. <span class="status" v-if="item.orderStatus == '0'">未接单</span>
  73. <span class="status" v-if="item.orderStatus == '1'">接单中</span>
  74. <span class="status" v-if="item.orderStatus == '2'">已完成</span>
  75. <span class="status bad-status"
  76. v-if="item.enabledMarkType =='1' || item.orderStatus == '4'">已作废</span>
  77. </template>
  78. </view>
  79. <view class="order-card-info">
  80. <view class="order-type">
  81. <u-tag :text="$t('order.suppOrder')" type="error" v-if="item.isMain == 1"></u-tag>
  82. <u-tag :text="$t('order.mixed')" type="success" v-if="item.isMain == 2"></u-tag>
  83. </view>
  84. <view class="row">
  85. <p class="cell">
  86. <!-- <text class="label">{{ $t('order.companyName') }}</text> -->
  87. <text class="info">{{ item.companyName || '' }}</text>
  88. </p>
  89. </view>
  90. <view class="row">
  91. <p class="cell">
  92. <!-- <text class="label">{{ $t('order.orderDate') }}</text> -->
  93. <text class="info">{{ item.setDate || '' }}</text>
  94. </p>
  95. <p class="cell">
  96. <!-- <text class="label">{{ $t('order.vehicleType') }}</text> -->
  97. <text class="info"
  98. v-if="item.vehicleType == '101'">{{ $t('order.saleOrder') }}</text>
  99. <text class="info"
  100. v-if="item.vehicleType == '102'">{{ $t('order.purchaseOrder') }}</text>
  101. <!-- <span class="tag tag-ls"
  102. v-if="item.orderType == '1'">{{ $t('order.temp') }}</span>
  103. <span class="tag tag-gd"
  104. v-if="item.orderType == '2'">{{ $t('order.fixed') }}</span> -->
  105. </p>
  106. </view>
  107. <view class="row">
  108. <p class="cell">
  109. <!-- <text class="label">{{ $t('order.materialName') }}</text> -->
  110. <text class="info">{{ item.materialName || '' }}</text>
  111. </p>
  112. <p class="cell">
  113. <!-- <text class="label">{{ $t('order.orderNumber') }}</text> -->
  114. <text
  115. class="info">{{ item.orderNumber || '' }}{{item.materialKind=='101' && item.companyClientType=='109'?$t('customer_meter.unitB') :(item.orderType ==
  116. '4' ? $t('customer_meter.unitN') : $t('customer_meter.unitT')) }}</text>
  117. </p>
  118. </view>
  119. <view class="row">
  120. <p class="cell">
  121. <!-- <text class="label">{{ $t('order.vehicle') }}</text> -->
  122. <text class="info">{{ item.vehicle || '' }}</text>
  123. </p>
  124. </view>
  125. <!-- <view class="row" v-if="item.isMain == 1 || item.isMain == 2">
  126. <p class="cell">
  127. <text
  128. class="label">{{ item.isMain == 1 ? $t('order.mainOrder') : $t('order.suppOrder') }}</text>
  129. <text class="info used">{{ item.relationOrderCode || '' }}</text>
  130. </p>
  131. </view> -->
  132. <view class="qrcode-logo" @click="drawQrcode(item)">
  133. <image class="img" src="/subpages/static/czzn-img/state/qrcode.png"
  134. mode="scaleToFill" />
  135. </view>
  136. <!-- <view class="row" v-if="item.orderStatus != 0 && item.weighingStatus != 0">
  137. <p class="cell">
  138. <text class="label">{{ $t('order.tareWeight') }}</text>
  139. <text class="info">{{ item.tareWeight || '0' }}</text>
  140. </p>
  141. <p class="cell">
  142. <text class="label">{{ $t('order.grossWeight') }}</text>
  143. <text class="info">{{ item.grossWeight || '0' }}</text>
  144. </p>
  145. </view>
  146. <view class="row">
  147. <p class="cell">
  148. <text class="label">{{ $t('order.netWeight') }}</text>
  149. <text class="info">{{ item.netWeight || '0' }}</text>
  150. </p>
  151. </view>
  152. <view class="row" v-if="item.orderStatus != 0 && item.weighingStatus == 1">
  153. <p class="cell">
  154. <text class="label">{{ $t('order.inTime') }}</text>
  155. <text class="info">{{ item.inTime || '' }}</text>
  156. </p>
  157. </view>
  158. <view class="row" v-if="item.orderStatus != 0 && item.weighingStatus == 2">
  159. <p class="cell">
  160. <text class="label">{{ $t('order.outTime') }}</text>
  161. <text class="info">{{ item.outTime || '' }}</text>
  162. </p>
  163. </view>
  164. <view class="row" v-if="item.orderStatus == 2">
  165. <p class="cell">
  166. <text class="label">{{ $t('order.outDate') }}</text>
  167. <text class="info">{{ item.outDoorTime || '' }}</text>
  168. </p>
  169. </view> -->
  170. </view>
  171. <view class="code">
  172. <view class="label">{{$t('order.orderCode')}}</view>
  173. <view class="info">{{ item.code || '' }}</view>
  174. <view class="label">{{$t('order.source')}}</view>
  175. <view class="info"> {{$t('order.mini')}}</view>
  176. </view>
  177. <view class="order-card-bottom">
  178. <view class="btn">
  179. <button class="oper-btn" type='error' shape="circle"
  180. size="small" @click="setVehicle(item)">{{ $t('order.chooseVehicle') }}
  181. </button>
  182. </view>
  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="orderTypeList" 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 class="row">
  216. <p class="p-title">{{ $t('order.vehicleType') }}</p>
  217. <u-radio-group v-model="form.vehicleType" @change="onVehicleTypeChange" placement="row"
  218. class="p-input">
  219. <u-radio :customStyle="{ marginRight: '10px' }" v-for="item in searchOption.vehicleTypeList"
  220. :key="item.value" :label="item.text" :name="item.value">
  221. </u-radio>
  222. </u-radio-group>
  223. </view> -->
  224. <!-- 选择客商 -->
  225. <view @click="showPopup('popupCompany')" class="row">
  226. <p class="p-title">{{ $t('order.transporter') }}</p>
  227. <u--input readonly class="p-input"
  228. :placeholder="`${$t('base.common.placeholderS') + $t('order.transporter')}`" border="none"
  229. v-model="form.companyName"></u--input>
  230. </view>
  231. <!-- 选择物料 -->
  232. <view @click="showPopup('popupMaterial')" class="row last-one">
  233. <p class="p-title">{{ $t('order.materialName') }}
  234. </p>
  235. <u--input readonly :placeholder="`${$t('base.common.placeholderS') + $t('order.materialName')}`"
  236. border="none" v-model="form.materialName" class="p-input"></u--input>
  237. </view>
  238. </view>
  239. <view class="sure-btn">
  240. <button class="btn" @click="bindOrderList">{{ $t('base.common.submit') }}</button>
  241. </view>
  242. </view>
  243. <!-- 选择供应商/客户 -->
  244. <PopupSelect ref="popupCompany" :hasSearch='false' :option="companyOption" @onConfirm="onCompanyConfirm" />
  245. <!-- 选择物料/产品 -->
  246. <PopupSelect ref="popupMaterial" :hasSearch='false' :option="materialOption"
  247. @onConfirm="onMaterialConfirm" />
  248. </u-popup>
  249. <u-loading-page color="#666" loading-mode="semicircle" :loading="loading">
  250. </u-loading-page>
  251. <u-popup :show="showQrcode" :round="16" @close="showQrcode = false" mode="center"
  252. :overlayStyle="{ background: '#fff' }">
  253. <view class="qrcode-wrap" @click="showQrcode = false">
  254. <uqrcode ref='ordercode' canvas-id="order-canvas" :value="currentOrder.id"
  255. :start="false" />
  256. <view class="info-line">
  257. {{ $t('mine.customer') }} : {{ currentOrder.companyName || '' }}
  258. </view>
  259. <view class="info-line">
  260. {{ $t('mine.mater') }} : {{ currentOrder.materialName || '' }}
  261. </view>
  262. <view class="info-line" v-if="currentOrder.vehicle">
  263. {{ $t('order.vehicle') }} : {{ currentOrder.vehicle || '' }}
  264. </view>
  265. <view class="info-line" v-if="currentOrder.password">
  266. {{ $t('order.password') }} : {{ currentOrder.password || '' }}
  267. </view>
  268. </view>
  269. </u-popup>
  270. <u-toast ref="loadingToast"></u-toast>
  271. </view>
  272. </template>
  273. <script>
  274. import {
  275. getOrderPage,
  276. cancelOrder,
  277. getCustomerList,
  278. getMeterList,
  279. getOption,
  280. getPlanOrderVehicleList
  281. } from "../../api/order";
  282. import PopupSelect from '../../components/popup-select/index'
  283. import {
  284. getTenantCacheList,
  285. getOrderType,
  286. isPermission,
  287. getLabel
  288. } from '../../utils/util.js'
  289. import {
  290. getDealerTenantList,
  291. } from "../../api/tenant.js";
  292. import dayjs from 'dayjs'
  293. export default {
  294. components: {
  295. PopupSelect
  296. },
  297. data() {
  298. return {
  299. getLabel,
  300. maxDate: dayjs().format('YYYY-MM-DD'),
  301. searchOption: {
  302. range: [dayjs().add(-30, 'day').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
  303. vehicleTypeList: [{
  304. name: this.$t("mine.all"),
  305. disabled: false,
  306. value: '0',
  307. }, ],
  308. },
  309. loading: true, //页面加载状态
  310. showQrcode: false, // 二维码展示
  311. currentOrder: {}, //订单id
  312. form: {
  313. type: "0",
  314. orderType: '',
  315. vehicleType: '101',
  316. orderStatus: 0,
  317. tenantId: '',
  318. tenantName: '',
  319. companyId: "", //客商
  320. materialId: "", //物料
  321. companyName: "", //客商
  322. materialName: "", //物料
  323. },
  324. currentOrderType: 0,
  325. orderTypeList: [{
  326. name: this.$t("mine.all"),
  327. isShow: true,
  328. value: '',
  329. index: 0,
  330. key: "all",
  331. },
  332. {
  333. name: this.$t("order.temp"),
  334. isShow: true,
  335. value: '1',
  336. index: 1,
  337. key: "add_temp_order",
  338. },
  339. {
  340. name: this.$t("order.fixed"),
  341. isShow: true,
  342. value: '2',
  343. index: 2,
  344. key: "add_fixed_order",
  345. },
  346. {
  347. name: this.$t("order.plan"),
  348. isShow: true,
  349. value: '5',
  350. index: 3,
  351. key: "add_plan_order",
  352. },
  353. {
  354. name: this.$t("order.share"),
  355. isShow: true,
  356. value: '4',
  357. index: 3,
  358. key: "add_share_order",
  359. },
  360. ],
  361. orderStatusList: [{
  362. name: this.$t("mine.reviewed"),
  363. value: '0'
  364. },
  365. {
  366. name: this.$t("mine.unpaid"),
  367. value: '1'
  368. },
  369. {
  370. name: this.$t("mine.ongoing"),
  371. value: '2'
  372. },
  373. {
  374. name: this.$t("mine.weigh"),
  375. value: '3'
  376. },
  377. {
  378. name: this.$t("mine.invalid"),
  379. value: '4'
  380. },
  381. ],
  382. orderSourceList: [{
  383. name: this.$t("order.pc"), //PC端
  384. value: '1'
  385. },
  386. {
  387. name: this.$t("order.mini"), //小程序
  388. value: '2'
  389. }, {
  390. name: this.$t("order.fixed"), //固定订单生成
  391. value: '3'
  392. },
  393. {
  394. name: this.$t("order.special"), //由特殊订单生成
  395. value: '4'
  396. },
  397. {
  398. name: this.$t("order.handWeigh"), //由手工过磅生成
  399. value: '5'
  400. },
  401. {
  402. name: this.$t("order.repair"), //由补录生成
  403. value: '6'
  404. },
  405. {
  406. name: this.$t("order.bath"), //由批量订单生成
  407. value: '7'
  408. },
  409. {
  410. name: this.$t("order.third"), //第三方生成
  411. value: '8'
  412. },
  413. {
  414. name: this.$t("order.share"), //共享订单
  415. value: '12'
  416. },
  417. {
  418. name: this.$t("order.plan"), //计划订单
  419. value: '13'
  420. },
  421. ],
  422. shareOrderStatusList: [{
  423. name: this.$t("order.waitOrderReceive"),
  424. value: '0'
  425. },
  426. {
  427. name: this.$t("order.orderReceiving"),
  428. value: '1'
  429. },
  430. {
  431. name: this.$t("order.orderReceiveComplete"),
  432. value: '2'
  433. },
  434. {
  435. name: this.$t("mine.invalid"),
  436. value: '4'
  437. }
  438. ],
  439. page: {
  440. pages: 1,
  441. size: 5,
  442. },
  443. orderList: [],
  444. showSearch: false,
  445. keyword: '',
  446. hasMore: false,
  447. tenantOption: [{
  448. text: this.$t('base.common.noData'),
  449. value: null
  450. }], //企业选项
  451. companyOption: [{
  452. text: this.$t('base.common.noData'),
  453. value: null
  454. }], //客户选项
  455. materialOption: [{
  456. text: this.$t('base.common.noData'),
  457. value: null
  458. }], //物料选项
  459. //业务对应的客户信息
  460. vehicleTypeCompanyList: [],
  461. //客户对应的物料信息
  462. companyMaterialList: [],
  463. //业务类型对应的物料信息
  464. appAllMaterial: [],
  465. isAuditUser: false,
  466. isDealerUser: false,
  467. isDriverUser: false,
  468. //是否启用追溯功能
  469. isRetrospect: false,
  470. language:'zh-Hans'
  471. };
  472. },
  473. mounted() {
  474. console.log("order list mounted");
  475. },
  476. onShow() {
  477. console.log("开始onShow");
  478. this.searchList();
  479. },
  480. onLoad(options) {
  481. this.language = uni.getStorageSync('CURRENT_LANG')
  482. this.isAuditUser = uni.getStorageSync('isAuditUser')
  483. this.isDealerUser = uni.getStorageSync('isDealerUser')
  484. this.isDriverUser = uni.getStorageSync('isDriverUser')
  485. this.bindTenant()
  486. this.form.orderStatus = options.orderStatus || '0';
  487. this.orderTypeList = getOrderType(this.orderTypeList);
  488. this.isRetrospect = isPermission("add_retrospect_order")
  489. console.log("允许操作的订单类型、", this.orderTypeList);
  490. },
  491. methods: {
  492. //分配车辆
  493. setVehicle(item){
  494. uni.navigateTo({
  495. url: `/subpages/order/transVehicle?orderInfo=${JSON.stringify(item)}`
  496. })
  497. },
  498. //二维码弹窗
  499. drawQrcode(item) {
  500. this.currentOrder = item
  501. this.showQrcode = true
  502. console.log(this.$refs.ordercode);
  503. setTimeout(() => {
  504. this.$refs.ordercode.make()
  505. }, 100)
  506. },
  507. //切换订单类型
  508. onChangeOrderType(item) {
  509. this.currentOrderType = item.index;
  510. var value = this.orderTypeList[item.index].value;
  511. if (this.form.orderType == value) {
  512. return
  513. } else {
  514. this.form.orderStatus = "";
  515. this.form.orderType = value
  516. this.searchList()
  517. }
  518. },
  519. //切换订单状态
  520. changeOrderStatus(item) {
  521. if (item.value == this.form.orderStatus) {
  522. this.form.orderStatus = "";
  523. } else {
  524. this.form.orderStatus = item.value
  525. }
  526. this.searchList()
  527. },
  528. //获取企业选项
  529. bindTenant() {
  530. this.tenantOption = getTenantCacheList();
  531. if (this.tenantOption.length > 0) {
  532. this.form.tenantId = this.tenantOption[0].value
  533. this.form.tenantName = this.tenantOption[0].text
  534. } else {
  535. this.loading = false;
  536. return;
  537. }
  538. this.bindOption();
  539. // this.searchList();
  540. },
  541. //选择订单类型后加载选项 //获取品种信息 101:销售,102:采购
  542. bindOption() {
  543. this.clear();
  544. console.log("订单租户信息、", this.form.tenantId);
  545. if (!this.form.tenantId) {
  546. console.log("订单业务租户信息");
  547. return;
  548. }
  549. var that = this;
  550. console.log("当前租户ID、", that.form.tenantId);
  551. if (that.form.tenantId) {
  552. let data = JSON.parse(JSON.stringify(that.form))
  553. data.appUserType = "3"
  554. this.orderList = [];
  555. getOption(data).then(res => {
  556. console.log("查询基础数据返回、", res);
  557. if (res.statusCode === 200) {
  558. console.log("用户业务类型、", res.data.data.appVehicleType)
  559. console.log("用户客户信息、", res.data.data.appCompany)
  560. console.log("用户品种信息、", res.data.data.appMaterial)
  561. that.searchOption.vehicleTypeList = res.data.data.appVehicleType;
  562. if(that.language == 'zh-Hans'){
  563. that.searchOption.vehicleTypeList = res.data.data.appVehicleType;
  564. }else{
  565. that.searchOption.vehicleTypeList = res.data.data.appVehicleType.map(item=>{
  566. return{
  567. text:item.language,
  568. value:item.value
  569. }
  570. });
  571. }
  572. uni.removeStorageSync('vehicleType-' + that.form.tenantId)
  573. uni.setStorageSync('vehicleType-' + that.form.tenantId, that.searchOption
  574. .vehicleTypeList)
  575. if (that.searchOption.vehicleTypeList && that.searchOption.vehicleTypeList.length >
  576. 0) {
  577. that.searchOption.vehicleTypeList.unshift({
  578. text: this.$t('mine.all'),
  579. value: null
  580. })
  581. that.form.vehicleType = that.searchOption.vehicleTypeList[0].value
  582. that.form.vehicleTypeName = that.searchOption.vehicleTypeList[0].text
  583. that.vehicleTypeCompanyList = res.data.data.appCompany
  584. that.companyMaterialList = res.data.data.appMaterial;
  585. that.appAllMaterial = res.data.data.appAllMaterial;
  586. that.bindCompany();
  587. that.bindMaterial();
  588. // that.bindOrderList();
  589. }
  590. }
  591. })
  592. }
  593. },
  594. bindCompany() {
  595. var vehicleType = this.form.vehicleType;
  596. if (vehicleType && this.vehicleTypeCompanyList) {
  597. this.companyOption = [{
  598. text: this.$t('order.notSelected'),
  599. value: null
  600. }] //物料选项
  601. var companyInfos = this.vehicleTypeCompanyList.filter(function(company) {
  602. return company.vehicleType == vehicleType;
  603. });
  604. if (companyInfos && companyInfos.length > 0) {
  605. companyInfos[0].companyList.forEach(item => {
  606. this.companyOption.push({
  607. text: item.companyName,
  608. value: item.companyId
  609. })
  610. })
  611. }
  612. console.log("客户信息、", this.companyOption);
  613. }
  614. },
  615. bindMaterial() {
  616. this.materialOption = [{
  617. text: this.$t('order.notSelected'),
  618. value: null
  619. }] //物料选项
  620. var companyId = this.form.companyId;
  621. if (companyId && this.companyMaterialList) {
  622. var materialInfos = this.companyMaterialList.filter(function(material) {
  623. return material.companyId == companyId;
  624. });
  625. if (materialInfos && materialInfos.length > 0) {
  626. materialInfos[0].materialList.forEach(item => {
  627. this.materialOption.push({
  628. text: item.name,
  629. value: item.id
  630. })
  631. })
  632. }
  633. } else {
  634. var vehicleType = this.form.vehicleType;
  635. var materialInfos = this.appAllMaterial.filter(function(material) {
  636. return material.vehicleType == vehicleType;
  637. });
  638. if (materialInfos && materialInfos.length > 0) {
  639. materialInfos[0].materialList.forEach(item => {
  640. this.materialOption.push({
  641. text: item.name,
  642. value: item.id
  643. })
  644. })
  645. }
  646. }
  647. console.log("品种信息、", this.materialOption);
  648. },
  649. //去订单详情
  650. onOrderInfoClick(item) {
  651. if (item.orderType == '1') {
  652. if (item.isMain == "2") {
  653. uni.navigateTo({
  654. url: `/subpages/order/mixedOrderInfo?userType=3&orderId=${item.id}&tenantId=${item.tenantId}&orderStatus=${item.orderStatus}`
  655. })
  656. } else {
  657. uni.navigateTo({
  658. url: `/subpages/order/orderInfo?orderId=${item.id}&tenantId=${item.tenantId}&orderStatus=${item.orderStatus}`
  659. })
  660. }
  661. } else if (item.orderType == '2') {
  662. uni.navigateTo({
  663. url: `/subpages/order/fixedOrderInfo?orderId=${item.id}&tenantId=${item.tenantId}&orderStatus=${item.orderStatus}`
  664. })
  665. } else if (item.orderType == '4') {
  666. uni.navigateTo({
  667. url: `/subpages/order/shareOrderInfo?orderId=${item.id}&tenantId=${item.tenantId}&orderStatus=${item.orderStatus}`
  668. })
  669. } else if (item.orderType == '5') {
  670. uni.navigateTo({
  671. url: `/subpages/order/planOrderInfo?orderId=${item.id}&tenantId=${item.tenantId}`
  672. })
  673. }
  674. },
  675. //拼车
  676. onMixedOrderClick(item) {
  677. uni.navigateTo({
  678. url: `/subpages/order/mixed?orderId=${item.id}&tenantId=${item.tenantId}`
  679. })
  680. },
  681. //确定选择日期
  682. confirm(item) {
  683. this.searchOption.range = item
  684. },
  685. //点击右侧筛选
  686. onClickRight() {
  687. this.showSearch = true
  688. },
  689. //搜索列表
  690. searchList() {
  691. this.page.pages = 1
  692. this.hasMore = false
  693. this.bindOrderList()
  694. },
  695. //获取订单列表
  696. bindOrderList() {
  697. var that = this;
  698. if (!that.form.tenantId) {
  699. uni.showToast({
  700. title: that.$t('base.common.placeholderS') + that.$t('base.common.tenant'),
  701. icon: 'none',
  702. duration: 2000
  703. })
  704. return;
  705. }
  706. that.showSearch = false
  707. let data = {
  708. appUserType: "7",
  709. current: that.page.pages,
  710. size: that.page.size,
  711. orderStatus: that.form.orderStatus,
  712. keywords: that.keyword || '',
  713. startDate: that.searchOption.range[0] || '',
  714. endDate: that.searchOption.range[1] || '',
  715. vehicleType: that.form.vehicleType,
  716. orderType: that.form.orderType || '',
  717. tenantId: that.form.tenantId || '',
  718. companyId: that.form.companyId,
  719. materialId: that.form.materialId,
  720. noOrderType:'1',//用来区分扫码获取计划单
  721. };
  722. getOrderPage(data).then((res) => {
  723. if (res.statusCode == 200) {
  724. // that.orderList = res.data.data.records;
  725. if (res.data.data.records.length == 0) {
  726. that.orderList = [];
  727. }
  728. if (that.hasMore) {
  729. that.orderList = [
  730. ...that.orderList,
  731. ...res.data.data.records,
  732. ];
  733. } else {
  734. that.orderList = res.data.data.records;
  735. }
  736. that.total = res.data.data.total;
  737. if (that.orderList.length >= that.total) {
  738. that.hasMore = false;
  739. } else {
  740. that.hasMore = true;
  741. }
  742. console.log("当前订单信息、", that.orderList);
  743. }
  744. that.loading = false;
  745. });
  746. },
  747. //加载更多
  748. scrolltolower() {
  749. console.log("1111111111111111");
  750. if (this.hasMore) {
  751. this.page.pages += 1;
  752. this.bindOrderList();
  753. }
  754. },
  755. // tab栏切换
  756. orderStatusChange(item) {
  757. this.orderStatus = item.orderStatus;
  758. this.page.pages = 1;
  759. this.hasMore = false;
  760. this.bindOrderList();
  761. },
  762. //订单作废
  763. onCancelOrder(item) {
  764. let _this = this
  765. uni.showModal({
  766. content: this.$t('order.isCancelOrder'),
  767. showCancell: true,
  768. success: function(res) {
  769. if (res.confirm) {
  770. let data = {
  771. tenantId: item.tenantId,
  772. orderId: item.id
  773. };
  774. _this.$refs.loadingToast.show({
  775. type: "loading",
  776. message: _this.$t('base.common.loading'),
  777. duration: "1000000"
  778. })
  779. cancelOrder(data).then(res => {
  780. _this.$refs.loadingToast.hide()
  781. if (res.statusCode == 200) {
  782. uni.showToast({
  783. title: _this.$t('mine.operateOk'),
  784. icon: 'none',
  785. duration: 2000
  786. })
  787. _this.page.pages = 1
  788. _this.hasMore = false
  789. _this.bindOrderList()
  790. }
  791. }).catch(res => {
  792. _this.$refs.loadingToast.hide()
  793. console.log("调用异常返回、", res);
  794. });
  795. console.log('用户点击确定');
  796. } else if (res.cancell) {
  797. console.log('用户点击取消');
  798. _this.$refs.loadingToast.hide()
  799. }
  800. }
  801. });
  802. },
  803. onRetrospectOrder(item) {
  804. uni.navigateTo({
  805. url: `/substaticpages/trace/index?orderId=${item.id}&tenantId=${item.tenantId}`
  806. })
  807. },
  808. onShareOrderClick(item) {
  809. uni.navigateTo({
  810. url: `/subpages/order/shareOrderInfo?orderId=${item.id}&tenantId=${item.tenantId}&isShare=1`
  811. })
  812. },
  813. onAdjustOrderClick(item) {
  814. let obj = {
  815. orderId: item.id,
  816. tenantId: item.tenantId
  817. }
  818. console.log("获取到调整时的订单信息、", obj);
  819. getPlanOrderVehicleList(obj).then(res => {
  820. if (res.statusCode == 200 && res.data.code == 0) {
  821. var vehicles = '';
  822. if (res.data.data) {
  823. res.data.data.forEach(item => {
  824. if (vehicles) {
  825. vehicles += ','
  826. }
  827. vehicles += item.vehicle
  828. });
  829. }
  830. uni.navigateTo({
  831. url: `/subpages/order/multipleVehicle?tenantId=${item.tenantId}&orderId=${item.id}&vehicles=${vehicles}&isAdjust=1&vehicleType=${item.vehicleType}`
  832. })
  833. }
  834. })
  835. },
  836. //显示选择
  837. showPopup(refs) {
  838. this.$refs[refs].showPicker = true
  839. },
  840. //选择企业和订单类型后
  841. onVehicleTypeChange() {
  842. this.vehicleTypeClear();
  843. if (this.form.tenantId && this.form.vehicleType) {
  844. console.log('开始根据业务类型选择数据信息,租户和业务为、', this.form.tenantId, this.form.vehicleType);
  845. this.bindCompany();
  846. this.bindMaterial();
  847. }
  848. },
  849. //选择企业
  850. onTenantConfirm(value) {
  851. this.form.tenantId = ''
  852. this.form.tenantName = ''
  853. if (value.value) {
  854. this.form.tenantId = value.value
  855. this.form.tenantName = value.text
  856. }
  857. this.bindOption();
  858. },
  859. //选择客户
  860. onCompanyConfirm(value) {
  861. this.form.companyId = ''
  862. this.form.companyName = ''
  863. if (value.value) {
  864. this.form.companyId = value.value
  865. this.form.companyName = value.text
  866. }
  867. this.bindMaterial();
  868. },
  869. //选择物料
  870. onMaterialConfirm(value) {
  871. this.form.materialId = ''
  872. this.form.materialName = ''
  873. if (value.value) {
  874. this.form.materialId = value.value
  875. this.form.materialName = value.text
  876. }
  877. },
  878. formatOption(data) {
  879. let arr = []
  880. data.forEach(item => {
  881. arr.push({
  882. text: item.name || item.label,
  883. value: item.value || item.id
  884. })
  885. })
  886. arr.unshift({
  887. text: this.$t('order.notSelected'),
  888. value: null
  889. })
  890. return arr
  891. },
  892. clear() {
  893. this.searchOption.vehicleTypeList = [{
  894. text: this.$t('base.common.noData'),
  895. value: null
  896. }]
  897. this.companyOption = [{
  898. text: this.$t('base.common.noData'),
  899. value: null
  900. }] //客户选项
  901. this.materialOption = [{
  902. text: this.$t('base.common.noData'),
  903. value: null
  904. }] //物料选项
  905. this.form.vehicleType = ''
  906. this.form.vehicleTypeName = ''
  907. this.form.companyId = ''
  908. this.form.materialId = ''
  909. this.form.companyName = ''
  910. this.form.materialName = ''
  911. },
  912. vehicleTypeClear() {
  913. this.companyOption = [{
  914. text: this.$t('base.common.noData'),
  915. value: null
  916. }] //客户选项
  917. this.materialOption = [{
  918. text: this.$t('base.common.noData'),
  919. value: null
  920. }] //物料选项
  921. this.form.companyId = ''
  922. this.form.materialId = ''
  923. this.form.companyName = ''
  924. this.form.materialName = ''
  925. },
  926. },
  927. };
  928. </script>
  929. <style>
  930. /* #ifndef H5 */
  931. page {
  932. /* height: 100%; */
  933. background-color: #f2f2f2;
  934. }
  935. /* #endif */
  936. </style>
  937. <style lang="scss" scoped>
  938. @import '../../common/css/public.scss';
  939. </style>