123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008 |
- <template>
- <view class="order-list">
- <u-sticky bgColor="#fff">
- <view class="search-wrap">
- <view class="input-wrap">
- <view @click="showPopup('popupTenant')" class="input">
- <u--input prefixIcon="account-fill" readonly :placeholder="$t('queue.pleaseSelectTenant')"
- prefixIconStyle="font-size:46rpx" border="none" v-model="form.tenantName"
- :showAction='false'></u--input>
- </view>
- <view @click="onClickRight" class="sx-btn">
- <uni-icons type="settings-filled" size='24'></uni-icons>
- <view>{{$t('base.common.condition')}}</view>
- </view>
- </view>
- </view>
- <view class="tabs-box">
- <u-tabs lineWidth="40" :list="orderTypeList.filter((item)=>{return item.isShow==true})"
- :current="currentOrderType" @change="onChangeOrderType" lineColor="#3275F5"
- :itemStyle="{'height':'90rpx','padding':'0 32rpx'}">
- <view slot="right" style="padding-left: 160rpx;">
- </view>
- </u-tabs>
-
- <view v-if="form.orderType != '5' && form.orderType != '4'">
- <u-tabs lineWidth="40" :list="orderStatusList"
- :current="form.orderStatus" @change="changeOrderStatus" lineColor="#3275F5"
- :itemStyle="{'height':'90rpx','padding':'0 32rpx'}">
- </u-tabs>
- <!-- <span :class="form.orderStatus == item.value ? 'active' : ''" v-for="item in orderStatusList"
- @click="changeOrderStatus(item)" :key="item.name">
- {{ item.name }}
- </span> -->
- </view>
- <view v-if="form.orderType == '4'">
- <u-tabs lineWidth="40" :list="shareOrderStatusList"
- :current="form.orderStatus" @change="changeOrderStatus" lineColor="#3275F5"
- :itemStyle="{'height':'90rpx','padding':'0 32rpx'}">
- </u-tabs>
- <!-- <span :class="form.orderStatus == item.value ? 'active' : ''" v-for="item in shareOrderStatusList"
- @click="changeOrderStatus(item)" :key="item.name">
- {{ item.name }}
- </span> -->
- </view>
- </view>
- <PopupSelect ref="popupTenant" :hasSearch='false' :option="tenantOption" @onConfirm="onTenantConfirm"
- @search="bindOption" />
- </u-sticky>
- <!-- 企业选项 -->
- <view class="swiper-box">
- <template v-if="orderList.length">
- <u-list @scrolltolower="scrolltolower" :preLoadScreen="1.5">
- <u-list-item v-for="(item, index) in orderList" :key="index">
- <view class="order-card">
- <view class="order-card-title">
- <span class="type" v-if="item.orderType == '1'">{{ $t('order.temp') }}</span>
- <span class="type fixed" v-if="item.orderType == '2'">{{ $t('order.fixed') }}</span>
- <span class="type fixed" v-if="item.orderType == '5'">{{ $t('order.plan') }}</span>
- <text class="info">{{ item.tenantName || '' }}</text>
- <view class="out-type" v-if="item.backFlag == '1'">
- {{item.vehicleType=='101'?$t('order.isBackOut'):$t('order.return')}}
- </view>
- <template v-if="item.orderType != '4'">
- <span class="status bad-status" v-if="item.enabledMarkType == '1'">已作废</span>
- <span class="status" v-else-if="item.orderStatus == '0'">未进厂</span>
- <span class="status"
- v-else-if="item.orderStatus == '1' && item.weighingStatus == '0'">已进厂</span>
- <span class="status" v-else-if="item.orderStatus == '2'">已完成</span>
- <span class="status"
- v-else-if="item.orderStatus == '1' && item.weighingStatus != '0'">已过磅</span>
- </template>
- <template v-if="item.orderType == '4'">
- <span class="status" v-if="item.orderStatus == '0'">未接单</span>
- <span class="status" v-if="item.orderStatus == '1'">接单中</span>
- <span class="status" v-if="item.orderStatus == '2'">已完成</span>
- <span class="status bad-status"
- v-if="item.enabledMarkType =='1' || item.orderStatus == '4'">已作废</span>
- </template>
- </view>
- <view class="order-card-info">
- <view class="order-type">
- <u-tag :text="$t('order.suppOrder')" type="error" v-if="item.isMain == 1"></u-tag>
- <u-tag :text="$t('order.mixed')" type="success" v-if="item.isMain == 2"></u-tag>
- </view>
- <view class="row">
- <p class="cell">
- <!-- <text class="label">{{ $t('order.companyName') }}</text> -->
- <text class="info">{{ item.companyName || '' }}</text>
- </p>
- </view>
- <view class="row">
- <p class="cell">
- <!-- <text class="label">{{ $t('order.orderDate') }}</text> -->
- <text class="info">{{ item.setDate || '' }}</text>
- </p>
- <p class="cell">
- <!-- <text class="label">{{ $t('order.vehicleType') }}</text> -->
- <text class="info"
- v-if="item.vehicleType == '101'">{{ $t('order.saleOrder') }}</text>
- <text class="info"
- v-if="item.vehicleType == '102'">{{ $t('order.purchaseOrder') }}</text>
- <!-- <span class="tag tag-ls"
- v-if="item.orderType == '1'">{{ $t('order.temp') }}</span>
- <span class="tag tag-gd"
- v-if="item.orderType == '2'">{{ $t('order.fixed') }}</span> -->
- </p>
- </view>
- <view class="row">
- <p class="cell">
- <!-- <text class="label">{{ $t('order.materialName') }}</text> -->
- <text class="info">{{ item.materialName || '' }}</text>
- </p>
- <p class="cell">
- <!-- <text class="label">{{ $t('order.orderNumber') }}</text> -->
- <text
- :style="'font-size: 9pt;font-weight: bold;'+(item.companyClientType=='109'?'color: green;':'color: red;')"
- class="info">{{ item.orderNumber || '' }}{{item.materialKind=='101' && item.companyClientType=='109'?$t('customer_meter.unitB') :(item.orderType ==
- '4' ? $t('customer_meter.unitN') : $t('customer_meter.unitT')) }}</text>
- </p>
- </view>
- <view class="row">
- <p class="cell">
- <!-- <text class="label">{{ $t('order.vehicle') }}</text> -->
- <text class="info">{{ item.vehicle || '' }}</text>
- </p>
- <p class="cell">
- <!-- <text class="label">{{ $t('order.driver') }}</text> -->
- <text class="info">{{ item.driver || '' }}-{{ item.phone || '' }}</text>
- </p>
- </view>
- <!-- <view class="row" v-if="item.isMain == 1 || item.isMain == 2">
- <p class="cell">
- <text
- class="label">{{ item.isMain == 1 ? $t('order.mainOrder') : $t('order.suppOrder') }}</text>
- <text class="info used">{{ item.relationOrderCode || '' }}</text>
- </p>
- </view> -->
- <view class="qrcode-logo" @click="drawQrcode(item)">
- <image class="img" src="/subpages/static/czzn-img/state/qrcode.png"
- mode="scaleToFill" />
- </view>
- <!-- <view class="row" v-if="item.orderStatus != 0 && item.weighingStatus != 0">
- <p class="cell">
- <text class="label">{{ $t('order.tareWeight') }}</text>
- <text class="info">{{ item.tareWeight || '0' }}</text>
- </p>
- <p class="cell">
- <text class="label">{{ $t('order.grossWeight') }}</text>
- <text class="info">{{ item.grossWeight || '0' }}</text>
- </p>
- </view>
- <view class="row">
- <p class="cell">
- <text class="label">{{ $t('order.netWeight') }}</text>
- <text class="info">{{ item.netWeight || '0' }}</text>
- </p>
- </view>
- <view class="row" v-if="item.orderStatus != 0 && item.weighingStatus == 1">
- <p class="cell">
- <text class="label">{{ $t('order.inTime') }}</text>
- <text class="info">{{ item.inTime || '' }}</text>
- </p>
- </view>
- <view class="row" v-if="item.orderStatus != 0 && item.weighingStatus == 2">
- <p class="cell">
- <text class="label">{{ $t('order.outTime') }}</text>
- <text class="info">{{ item.outTime || '' }}</text>
- </p>
- </view>
- <view class="row" v-if="item.orderStatus == 2">
- <p class="cell">
- <text class="label">{{ $t('order.outDate') }}</text>
- <text class="info">{{ item.outDoorTime || '' }}</text>
- </p>
- </view> -->
- </view>
- <view class="code">
- <view class="label">{{$t('order.orderCode')}}</view>
- <view class="info">{{ item.code || '' }}</view>
- <view class="label">{{$t('order.source')}}</view>
- <view class="info"> {{$t('order.mini')}}</view>
- </view>
- <view class="order-card-bottom">
- <view class="btn" v-if="isRetrospect==true && item.vehicleType=='101' && item.orderStatus==2 && item.backFlag != 1">
- <button class="oper-btn" type='error' shape="circle" v-if="item.orderStatus != 4"
- size="small" @click="onRetrospectOrder(item)">{{ $t('retrospect.name') }}
- </button>
- </view>
- <view class="btn">
- <button class="oper-btn" type='error' shape="circle" v-if="item.enabledMarkType != '1'"
- size="small" @click="onCancelOrder(item)">{{ $t('order.invalid') }}
- </button>
- </view>
- <view class="btn" v-if="item.orderType == 5 && item.orderStatus!=4">
- <button class="oper-btn" type='success' shape="circle" size="small"
- @click="onAdjustOrderClick(item)">
- {{ $t('base.button.adjust') }}
- </button>
- </view>
- <view class="btn" v-if="item.orderStatus!=4">
- <button class="oper-btn" type='primary' shape="circle" color='#4680F9' size="small"
- @click="onOrderInfoClick(item)">
- {{ $t('mine.detail') }}
- </button>
- </view>
- <view class="btn" v-if="item.orderType == 4 && item.orderStatus != 4">
- <button class="oper-btn" type='success' shape="circle" size="small"
- @click="onShareOrderClick(item)">
- {{ $t('base.common.share') }}
- </button>
- </view>
- <!-- <view class="btn"
- v-if="item.orderType==1 && item.orderStatus!=2 && item.vehicleType == 101 && item.materialKind == 101 && item.loadFlag==0">
- <u-button type='warning' shape="circle" size="small"
- @click="onMixedOrderClick(item)">
- {{$t('order.mixed')}}
- </u-button>
- </view> -->
- </view>
- </view>
- </u-list-item>
- </u-list>
- </template>
- <template v-else>
- <u-empty mode="orderTypeList" icon="https://cdn.uviewui.com/uview/empty/list.png">
- </u-empty>
- </template>
- </view>
- <u-popup :show="showSearch" :round="16" @close="showSearch = false" mode="bottom">
- <view class="search-dialog">
- <p class="dialog-title">{{ $t('base.common.condition') }}</p>
- <view class="condition-wrap">
- <view class="row">
- <uni-datetime-picker :end='maxDate' :clear-icon="false" :value="searchOption.range"
- type="daterange" @change="confirm" />
- </view>
- <!-- 输入内容 -->
- <view class="row">
- <p class="p-title">{{ $t('base.common.placeholder') }}</p>
- <u-search class="p-input" bgColor='#fff' :showAction='false'
- :placeholder="$t('base.common.inputPlaceholder')" v-model="keyword">
- </u-search>
- </view>
- <view class="row">
- <!-- 选择业务类型 -->
- <p class="p-title">{{ $t('order.vehicleType') }}</p>
- <u-radio-group v-model="form.vehicleType" @change="onVehicleTypeChange" placement="row"
- class="p-input">
- <u-radio :customStyle="{ marginRight: '10px' }" v-for="item in searchOption.vehicleTypeList"
- :key="item.value" :label="item.text" :name="item.value">
- </u-radio>
- </u-radio-group>
- </view>
- <!-- 选择客商 -->
- <view @click="showPopup('popupCompany')" class="row">
- <p class="p-title">{{ $t('order.companyName') }}</p>
- <u--input readonly class="p-input"
- :placeholder="`${$t('base.common.placeholderS') + $t('order.companyName')}`" border="none"
- v-model="form.companyName"></u--input>
- </view>
- <!-- 选择物料 -->
- <view @click="showPopup('popupMaterial')" class="row last-one">
- <p class="p-title">{{ $t('order.materialName') }}
- </p>
- <u--input readonly :placeholder="`${$t('base.common.placeholderS') + $t('order.materialName')}`"
- border="none" v-model="form.materialName" class="p-input"></u--input>
- </view>
- </view>
- <view class="sure-btn">
- <button class="btn" @click="bindOrderList">{{ $t('base.common.submit') }}</button>
- </view>
- </view>
- <!-- 选择供应商/客户 -->
- <PopupSelect ref="popupCompany" :hasSearch='false' :option="companyOption" @onConfirm="onCompanyConfirm" />
- <!-- 选择物料/产品 -->
- <PopupSelect ref="popupMaterial" :hasSearch='false' :option="materialOption"
- @onConfirm="onMaterialConfirm" />
- </u-popup>
- <u-loading-page color="#666" loading-mode="semicircle" :loading="loading">
- </u-loading-page>
- <u-popup :show="showQrcode" :round="16" @close="showQrcode = false" mode="center"
- :overlayStyle="{ background: '#fff' }">
- <view class="qrcode-wrap" @click="showQrcode = false">
- <uqrcode ref='ordercode' canvas-id="order-canvas" :value="currentOrder.id"
- :start="false" />
- <view class="info-line">
- {{ $t('mine.customer') }} : {{ currentOrder.companyName || '' }}
- </view>
- <view class="info-line">
- {{ $t('mine.mater') }} : {{ currentOrder.materialName || '' }}
- </view>
- <view class="info-line" v-if="currentOrder.vehicle">
- {{ $t('order.vehicle') }} : {{ currentOrder.vehicle || '' }}
- </view>
- <view class="info-line" v-if="currentOrder.password">
- {{ $t('order.password') }} : {{ currentOrder.password || '' }}
- </view>
- </view>
- </u-popup>
- <u-toast ref="loadingToast"></u-toast>
- </view>
- </template>
- <script>
- import {
- getOrderPage,
- cancelOrder,
- getCustomerList,
- getMeterList,
- getOption,
- getPlanOrderVehicleList
- } from "../../api/order";
- import PopupSelect from '../../components/popup-select/index'
- import {
- getTenantCacheList,
- getOrderType,
- isPermission,
- getLabel
- } from '../../utils/util.js'
- import {
- getDealerTenantList,
- } from "../../api/tenant.js";
- import dayjs from 'dayjs'
- export default {
- components: {
- PopupSelect
- },
- data() {
- return {
- getLabel,
- maxDate: dayjs().format('YYYY-MM-DD'),
- searchOption: {
- range: [dayjs().add(-30, 'day').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')],
- vehicleTypeList: [{
- name: this.$t("mine.all"),
- disabled: false,
- value: '0',
- }, ],
- },
- loading: true, //页面加载状态
- showQrcode: false, // 二维码展示
- currentOrder: {}, //订单id
- form: {
- type: "0",
- orderType: '',
- vehicleType: '101',
- orderStatus: 0,
- tenantId: '',
- tenantName: '',
- companyId: "", //客商
- materialId: "", //物料
- companyName: "", //客商
- materialName: "", //物料
- },
- currentOrderType: 0,
- orderTypeList: [{
- name: this.$t("mine.all"),
- isShow: true,
- value: '',
- index: 0,
- key: "all",
- },
- {
- name: this.$t("order.temp"),
- isShow: true,
- value: '1',
- index: 1,
- key: "add_temp_order",
- },
- {
- name: this.$t("order.fixed"),
- isShow: true,
- value: '2',
- index: 2,
- key: "add_fixed_order",
- },
- {
- name: this.$t("order.plan"),
- isShow: true,
- value: '5',
- index: 3,
- key: "add_plan_order",
- },
- {
- name: this.$t("order.share"),
- isShow: true,
- value: '4',
- index: 3,
- key: "add_share_order",
- },
- ],
- orderStatusList: [{
- name: this.$t("mine.reviewed"),
- value: '0'
- },
- {
- name: this.$t("mine.unpaid"),
- value: '1'
- },
- {
- name: this.$t("mine.ongoing"),
- value: '2'
- },
- {
- name: this.$t("mine.weigh"),
- value: '3'
- },
- {
- name: this.$t("mine.invalid"),
- value: '4'
- },
- ],
- orderSourceList: [{
- name: this.$t("order.pc"), //PC端
- value: '1'
- },
- {
- name: this.$t("order.mini"), //小程序
- value: '2'
- }, {
- name: this.$t("order.fixed"), //固定订单生成
- value: '3'
- },
- {
- name: this.$t("order.special"), //由特殊订单生成
- value: '4'
- },
- {
- name: this.$t("order.handWeigh"), //由手工过磅生成
- value: '5'
- },
- {
- name: this.$t("order.repair"), //由补录生成
- value: '6'
- },
- {
- name: this.$t("order.bath"), //由批量订单生成
- value: '7'
- },
- {
- name: this.$t("order.third"), //第三方生成
- value: '8'
- },
- {
- name: this.$t("order.share"), //共享订单
- value: '12'
- },
- {
- name: this.$t("order.plan"), //计划订单
- value: '13'
- },
- ],
- shareOrderStatusList: [{
- name: this.$t("order.waitOrderReceive"),
- value: '0'
- },
- {
- name: this.$t("order.orderReceiving"),
- value: '1'
- },
- {
- name: this.$t("order.orderReceiveComplete"),
- value: '2'
- },
- {
- name: this.$t("mine.invalid"),
- value: '4'
- }
- ],
- page: {
- pages: 1,
- size: 5,
- },
- orderList: [],
- showSearch: false,
- keyword: '',
- hasMore: false,
- tenantOption: [{
- text: this.$t('base.common.noData'),
- value: null
- }], //企业选项
- companyOption: [{
- text: this.$t('base.common.noData'),
- value: null
- }], //客户选项
- materialOption: [{
- text: this.$t('base.common.noData'),
- value: null
- }], //物料选项
- //业务对应的客户信息
- vehicleTypeCompanyList: [],
- //客户对应的物料信息
- companyMaterialList: [],
- //业务类型对应的物料信息
- appAllMaterial: [],
- isAuditUser: false,
- isDealerUser: false,
- isDriverUser: false,
- //是否启用追溯功能
- isRetrospect: false,
- language:'zh-Hans'
- };
- },
- mounted() {
- console.log("order list mounted");
- },
- onShow() {
- console.log("开始onShow");
- this.searchList();
- },
- onLoad(options) {
- this.language = uni.getStorageSync('CURRENT_LANG')
- this.isAuditUser = uni.getStorageSync('isAuditUser')
- this.isDealerUser = uni.getStorageSync('isDealerUser')
- this.isDriverUser = uni.getStorageSync('isDriverUser')
- this.bindTenant()
- this.form.orderStatus = options.orderStatus || '0';
- this.orderTypeList = getOrderType(this.orderTypeList);
- this.isRetrospect = isPermission("add_retrospect_order")
- console.log("允许操作的订单类型、", this.orderTypeList);
- },
- methods: {
- //二维码弹窗
- drawQrcode(item) {
- this.currentOrder = item
- this.showQrcode = true
- console.log(this.$refs.ordercode);
- setTimeout(() => {
- this.$refs.ordercode.make()
- }, 100)
- },
- //切换订单类型
- onChangeOrderType(item) {
- this.currentOrderType = item.index;
- var value = this.orderTypeList[item.index].value;
- if (this.form.orderType == value) {
- return
- } else {
- this.form.orderStatus = "";
- this.form.orderType = value
- this.searchList()
- }
- },
- //切换订单状态
- changeOrderStatus(item) {
- if (item.value == this.form.orderStatus) {
- this.form.orderStatus = "";
- } else {
- this.form.orderStatus = item.value
- }
- this.searchList()
- },
- //获取企业选项
- bindTenant() {
- this.tenantOption = getTenantCacheList();
- if (this.tenantOption.length > 0) {
- this.form.tenantId = this.tenantOption[0].value
- this.form.tenantName = this.tenantOption[0].text
- } else {
- // uni.showModal({
- // title: this.$t('settings.tips'),
- // showCancel: false,
- // content: this.$t('base.common.registerTenant'),
- // confirmText: this.$t('base.button.regedit'),
- // success: res => {
- // if (res.confirm) {
- // uni.navigateTo({
- // url: '/subpages/tenant/list?q=add'
- // });
- // }
- // },
- // fail: () => {},
- // complete: () => {}
- // });
- this.loading = false;
- return;
- }
- this.bindOption();
- this.searchList();
- },
- //选择订单类型后加载选项 //获取品种信息 101:销售,102:采购
- bindOption() {
- this.clear();
- console.log("订单租户信息、", this.form.tenantId);
- if (!this.form.tenantId) {
- console.log("订单业务租户信息");
- return;
- }
- var that = this;
- console.log("当前租户ID、", that.form.tenantId);
- if (that.form.tenantId) {
- let data = JSON.parse(JSON.stringify(that.form))
- data.appUserType = "3"
- this.orderList = [];
- getOption(data).then(res => {
- console.log("查询基础数据返回、", res);
- if (res.statusCode === 200) {
- console.log("用户业务类型、", res.data.data.appVehicleType)
- console.log("用户客户信息、", res.data.data.appCompany)
- console.log("用户品种信息、", res.data.data.appMaterial)
- that.searchOption.vehicleTypeList = res.data.data.appVehicleType;
- if(that.language == 'zh-Hans'){
- that.searchOption.vehicleTypeList = res.data.data.appVehicleType;
- }else{
- that.searchOption.vehicleTypeList = res.data.data.appVehicleType.map(item=>{
- return{
- text:item.language,
- value:item.value
- }
- });
- }
- uni.removeStorageSync('vehicleType-' + that.form.tenantId)
- uni.setStorageSync('vehicleType-' + that.form.tenantId, that.searchOption
- .vehicleTypeList)
- if (that.searchOption.vehicleTypeList && that.searchOption.vehicleTypeList.length >
- 0) {
- that.searchOption.vehicleTypeList.unshift({
- text: this.$t('mine.all'),
- value: null
- })
- that.form.vehicleType = that.searchOption.vehicleTypeList[0].value
- that.form.vehicleTypeName = that.searchOption.vehicleTypeList[0].text
- that.vehicleTypeCompanyList = res.data.data.appCompany
- that.companyMaterialList = res.data.data.appMaterial;
- that.appAllMaterial = res.data.data.appAllMaterial;
- that.bindCompany();
- that.bindMaterial();
- that.bindOrderList();
- }
- }
- })
- }
- },
- bindCompany() {
- var vehicleType = this.form.vehicleType;
- if (vehicleType && this.vehicleTypeCompanyList) {
- this.companyOption = [{
- text: this.$t('order.notSelected'),
- value: null
- }] //物料选项
- var companyInfos = this.vehicleTypeCompanyList.filter(function(company) {
- return company.vehicleType == vehicleType;
- });
- if (companyInfos && companyInfos.length > 0) {
- companyInfos[0].companyList.forEach(item => {
- this.companyOption.push({
- text: item.companyName,
- value: item.companyId
- })
- })
- }
- console.log("客户信息、", this.companyOption);
- }
- },
- bindMaterial() {
- this.materialOption = [{
- text: this.$t('order.notSelected'),
- value: null
- }] //物料选项
- var companyId = this.form.companyId;
- if (companyId && this.companyMaterialList) {
- var materialInfos = this.companyMaterialList.filter(function(material) {
- return material.companyId == companyId;
- });
- if (materialInfos && materialInfos.length > 0) {
- materialInfos[0].materialList.forEach(item => {
- this.materialOption.push({
- text: item.name,
- value: item.id
- })
- })
- }
- } else {
- var vehicleType = this.form.vehicleType;
- var materialInfos = this.appAllMaterial.filter(function(material) {
- return material.vehicleType == vehicleType;
- });
- if (materialInfos && materialInfos.length > 0) {
- materialInfos[0].materialList.forEach(item => {
- this.materialOption.push({
- text: item.name,
- value: item.id
- })
- })
- }
- }
- console.log("品种信息、", this.materialOption);
- },
- //去订单详情
- onOrderInfoClick(item) {
- if (item.orderType == '1') {
- if (item.isMain == "2") {
- uni.navigateTo({
- url: `/subpages/order/mixedOrderInfo?userType=3&orderId=${item.id}&tenantId=${item.tenantId}&orderStatus=${item.orderStatus}`
- })
- } else {
- uni.navigateTo({
- url: `/subpages/order/orderInfo?orderId=${item.id}&tenantId=${item.tenantId}&orderStatus=${item.orderStatus}`
- })
- }
- } else if (item.orderType == '2') {
- uni.navigateTo({
- url: `/subpages/order/fixedOrderInfo?orderId=${item.id}&tenantId=${item.tenantId}&orderStatus=${item.orderStatus}`
- })
- } else if (item.orderType == '4') {
- uni.navigateTo({
- url: `/subpages/order/shareOrderInfo?orderId=${item.id}&tenantId=${item.tenantId}&orderStatus=${item.orderStatus}`
- })
- } else if (item.orderType == '5') {
- uni.navigateTo({
- url: `/subpages/order/planOrderInfo?orderId=${item.id}&tenantId=${item.tenantId}`
- })
- }
- },
-
- //拼车
- onMixedOrderClick(item) {
- uni.navigateTo({
- url: `/subpages/order/mixed?orderId=${item.id}&tenantId=${item.tenantId}`
- })
- },
- //确定选择日期
- confirm(item) {
- this.searchOption.range = item
- },
- //点击右侧筛选
- onClickRight() {
- this.showSearch = true
- },
- //搜索列表
- searchList() {
- this.page.pages = 1
- this.hasMore = false
- this.bindOrderList()
- },
- //获取订单列表
- bindOrderList() {
- var that = this;
- if (!that.form.tenantId) {
- uni.showToast({
- title: that.$t('base.common.placeholderS') + that.$t('base.common.tenant'),
- icon: 'none',
- duration: 2000
- })
- return;
- }
- that.showSearch = false
- let data = {
- appUserType: "3",
- current: that.page.pages,
- size: that.page.size,
- orderStatus: that.form.orderStatus,
- keywords: that.keyword || '',
- startDate: that.searchOption.range[0] || '',
- endDate: that.searchOption.range[1] || '',
- vehicleType: that.form.vehicleType,
- orderType: that.form.orderType || '',
- tenantId: that.form.tenantId || '',
- companyId: that.form.companyId,
- materialId: that.form.materialId,
- noOrderType:'1',//用来区分扫码获取计划单
- };
- getOrderPage(data).then((res) => {
- if (res.statusCode == 200) {
- // that.orderList = res.data.data.records;
- if (res.data.data.records.length == 0) {
- that.orderList = [];
- }
- if (that.hasMore) {
- that.orderList = [
- ...that.orderList,
- ...res.data.data.records,
- ];
- } else {
- that.orderList = res.data.data.records;
- }
- that.total = res.data.data.total;
- if (that.orderList.length >= that.total) {
- that.hasMore = false;
- } else {
- that.hasMore = true;
- }
- console.log("当前订单信息、", that.orderList);
- }
- that.loading = false;
- });
- },
- //加载更多
- scrolltolower() {
- console.log("1111111111111111");
- if (this.hasMore) {
- this.page.pages += 1;
- this.bindOrderList();
- }
- },
- // tab栏切换
- orderStatusChange(item) {
- this.orderStatus = item.orderStatus;
- this.page.pages = 1;
- this.hasMore = false;
- this.bindOrderList();
- },
- //订单作废
- onCancelOrder(item) {
- let _this = this
- uni.showModal({
- content: this.$t('order.isCancelOrder'),
- showCancell: true,
- success: function(res) {
- if (res.confirm) {
- let data = {
- tenantId: item.tenantId,
- orderId: item.id
- };
- _this.$refs.loadingToast.show({
- type: "loading",
- message: _this.$t('base.common.loading'),
- duration: "1000000"
- })
- cancelOrder(data).then(res => {
- _this.$refs.loadingToast.hide()
- if (res.statusCode == 200) {
- uni.showToast({
- title: _this.$t('mine.operateOk'),
- icon: 'none',
- duration: 2000
- })
- _this.page.pages = 1
- _this.hasMore = false
- _this.bindOrderList()
- }
- }).catch(res => {
- _this.$refs.loadingToast.hide()
- console.log("调用异常返回、", res);
- });
- console.log('用户点击确定');
- } else if (res.cancell) {
- console.log('用户点击取消');
- _this.$refs.loadingToast.hide()
- }
- }
- });
- },
- onRetrospectOrder(item) {
- uni.navigateTo({
- url: `/substaticpages/trace/index?orderId=${item.id}&tenantId=${item.tenantId}`
- })
- },
- onShareOrderClick(item) {
- uni.navigateTo({
- url: `/subpages/order/shareOrderInfo?orderId=${item.id}&tenantId=${item.tenantId}&isShare=1`
- })
- },
- onAdjustOrderClick(item) {
- let obj = {
- orderId: item.id,
- tenantId: item.tenantId
- }
- console.log("获取到调整时的订单信息、", obj);
- getPlanOrderVehicleList(obj).then(res => {
- if (res.statusCode == 200 && res.data.code == 0) {
- var vehicles = '';
- if (res.data.data) {
- res.data.data.forEach(item => {
- if (vehicles) {
- vehicles += ','
- }
- vehicles += item.vehicle
- });
- }
- uni.navigateTo({
- url: `/subpages/order/multipleVehicle?tenantId=${item.tenantId}&orderId=${item.id}&vehicles=${vehicles}&isAdjust=1&vehicleType=${item.vehicleType}`
- })
- }
- })
- },
- //显示选择
- showPopup(refs) {
- this.$refs[refs].showPicker = true
- },
- //选择企业和订单类型后
- onVehicleTypeChange() {
- this.vehicleTypeClear();
- if (this.form.tenantId && this.form.vehicleType) {
- console.log('开始根据业务类型选择数据信息,租户和业务为、', this.form.tenantId, this.form.vehicleType);
- this.bindCompany();
- this.bindMaterial();
- }
- },
- //选择企业
- onTenantConfirm(value) {
- this.form.tenantId = ''
- this.form.tenantName = ''
- if (value.value) {
- this.form.tenantId = value.value
- this.form.tenantName = value.text
- }
- this.bindOption();
- },
- //选择客户
- onCompanyConfirm(value) {
- this.form.companyId = ''
- this.form.companyName = ''
- if (value.value) {
- this.form.companyId = value.value
- this.form.companyName = value.text
- }
- this.bindMaterial();
- },
- //选择物料
- onMaterialConfirm(value) {
- this.form.materialId = ''
- this.form.materialName = ''
- if (value.value) {
- this.form.materialId = value.value
- this.form.materialName = value.text
- }
- },
- formatOption(data) {
- let arr = []
- data.forEach(item => {
- arr.push({
- text: item.name || item.label,
- value: item.value || item.id
- })
- })
- arr.unshift({
- text: this.$t('order.notSelected'),
- value: null
- })
- return arr
- },
- clear() {
- this.searchOption.vehicleTypeList = [{
- text: this.$t('base.common.noData'),
- value: null
- }]
- this.companyOption = [{
- text: this.$t('base.common.noData'),
- value: null
- }] //客户选项
- this.materialOption = [{
- text: this.$t('base.common.noData'),
- value: null
- }] //物料选项
- this.form.vehicleType = ''
- this.form.vehicleTypeName = ''
- this.form.companyId = ''
- this.form.materialId = ''
- this.form.companyName = ''
- this.form.materialName = ''
- },
- vehicleTypeClear() {
- this.companyOption = [{
- text: this.$t('base.common.noData'),
- value: null
- }] //客户选项
- this.materialOption = [{
- text: this.$t('base.common.noData'),
- value: null
- }] //物料选项
- this.form.companyId = ''
- this.form.materialId = ''
- this.form.companyName = ''
- this.form.materialName = ''
- },
- },
- };
- </script>
- <style>
- /* #ifndef H5 */
- page {
- /* height: 100%; */
- background-color: #f2f2f2;
- }
- /* #endif */
- </style>
- <style lang="scss" scoped>
- @import '../../common/css/public.scss';
- </style>
|