dealerList.vue 31 KB

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