1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057 |
- <template>
- <view class="order">
- <view class="example">
- <u-form labelPosition="left" :model="orderForm" :rules="rules" ref="form1" labelWidth='120'>
- <!-- 下单日期 -->
- <u-form-item :label="$t('order.orderDate')" borderBottom prop="setDate">
- <!-- <u-input readonly v-model="orderForm.setDate" border="none"
- :placeholder="$t('base.common.placeholderS')+$t('order.orderDate')" /> -->
- <span>{{orderForm.setDate}}</span>
- </u-form-item>
- <!-- 有效日期 -->
- <u-form-item v-if="orderForm.orderType !== '1'" :label="$t('order.endDate')" borderBottom prop="orderValidDate"
- @click="showEndDateCalendar = true">
- <!-- <u-input readonly v-model="orderForm.orderValidDate" border="none"
- :placeholder="$t('base.common.placeholderS')+$t('order.endDate')" /> -->
- <span>{{orderForm.orderValidDate}}</span>
- </u-form-item>
- <!-- 选择企业 -->
- <u-form-item :label="$t('order.enterprise')" borderBottom prop="tenantId"
- @click="showPopup('popupTenantId')">
- <!-- <u-input readonly v-model="orderForm.tenantName" border="none"
- :placeholder="$t('base.common.placeholderS')+$t('order.enterprise')" /> -->
- <span>{{orderForm.tenantName}}</span>
- </u-form-item>
- <!-- 临时/固定 -->
- <u-form-item :label="$t('order.orderType')" borderBottom prop="orderType"
- @click="showPopup('popupOrderType')">
- <!-- <u-input readonly v-model="orderForm.orderTypeName" border="none"
- :placeholder="$t('base.common.placeholderS')+$t('order.orderType')" /> -->
- <span>{{orderForm.orderTypeName}}</span>
- </u-form-item>
- <!-- 业务类型 -->
- <!-- <u-form-item :label="$t('order.vehicleType')" borderBottom prop="vehicleType"
- @click="showPopup('popupVehicleType')">
- <u-input readonly v-model="orderForm.vehicleTypeName" border="none"
- :placeholder="$t('base.common.placeholderS')+$t('order.vehicleType')" />
- </u-form-item> -->
- <u-form-item :label="$t('order.vehicleType')" borderBottom prop="vehicleType">
- <!-- <u-radio-group v-model="orderForm.vehicleType" @change="onVehicleTypeConfirm" placement="row"
- class="p-input">
- <u-radio :customStyle="{marginRight: '10px'}" v-for="item in vehicleTypeOption"
- :key="item.value" :label="item.text" :name="item.value">
- </u-radio>
- </u-radio-group> -->
- <view class="uni-list">
- <radio-group v-model="orderForm.vehicleType" @change="onVehicleTypeConfirm" placement="row">
- <label class="uni-list-cell uni-list-cell-pd" v-for="item in vehicleTypeOption" :key="item.value" >
- <view>
- <radio style="transform:scale(0.8)" :value="item.value" :checked="item.value === orderForm.vehicleType"/>{{item.text}}
- </view>
- </label>
- </radio-group>
- </view>
- </u-form-item>
- <template>
- <u-form-item :label="$t('order.companyName')" borderBottom prop="companyId"
- @click="showPopup('popupCompanyId')">
- <span>{{orderForm.companyName}}</span>
- <view v-if="paymentOption && paymentOption.isShow=='1'"
- style="color: darkgreen;font-size: 9pt;">
- {{paymentOption.usableTotal}}
- </view>
- <!-- <u-input readonly v-model="orderForm.companyName" border="none"
- :placeholder="$t('base.common.placeholderS')+$t('order.companyName')">
- <template slot="suffix">
- <view v-if="paymentOption && paymentOption=='1'"
- style="color: darkgreen;font-size: 9pt;">
- {{paymentOption.usableTotal}}
- </view>
- </template>
- </u-input> -->
- </u-form-item>
- <!-- <view v-if="paymentOption && paymentOption.isShow=='1'"
- style="display: flex;flex-direction: row;justify-content:flex-end;">
- <view style="color: red;font-size: 9pt;">{{$t('order.allTotal')}}:{{paymentOption.total}}
- {{$t('order.waitTotal')}}:{{paymentOption.waitTotal}}
- </view>
-
-
- </view> -->
- <view v-if="paymentOption && paymentOption.isShow=='1'"
- style="display: flex;flex-direction:justify-content:flex-end;flex-direction: column;
- text-align: end;">
- <view style="color: red;font-size: 9pt;">
- {{$t('order.allTotal')}}:{{paymentOption.total}}
- </view>
- <view style="color: red;font-size: 9pt;">
- {{$t('order.waitTotal')}}:{{paymentOption.waitTotal}}
- </view>
- <view style="color: red;font-size: 9pt;">
- {{$t('order.source')}}:{{paymentOption.companyName}}
- </view>
- </view>
- <!-- <u-form-item :label="$t('order.materialName')" borderBottom prop="materialId"
- @click="showPopup('popupmaterialId')"> -->
- <u-form-item :label="$t('order.materialName')" borderBottom prop="materialId" @click="selectMater">
- <u-input v-model="orderForm.materialName" border="none"
- :placeholder="$t('base.common.placeholderS')+' '+$t('order.materialName')" />
- </u-form-item>
- </template>
- <!-- 件数 -->
- <u-form-item v-if="orderForm.measureUnit=='104'" :label="$t('order.pieceNumber')" borderBottom
- prop="pieceNumber">
- <!-- <u-input v-model="orderForm.pieceNumber" border="none" type='digit'
- :placeholder="$t('base.common.placeholderI')+$t('order.pieceNumber')">
- </u-input> -->
- <span>{{orderForm.pieceNumber}}</span>
- </u-form-item>
- <!-- 订单数量 -->
- <u-form-item v-if="orderForm.vehicleType != '102'" :label="$t('order.orderNumber')" borderBottom prop="orderNumber">
- <u-input v-model="orderForm.orderNumber" border="none" type='digit'
- :placeholder="$t('base.common.placeholderI')+$t('order.orderNumber')" @focus="onOrderNumberFocus">
- <template slot="suffix">
- <view v-if="paymentOption"
- :style="'font-size: 9pt;font-weight: bold;'+(paymentOption.companyClientType=='109'?'color: green;':'color: red;')">
- {{paymentOption.companyClientType=='109' && orderForm.kind=='101'?$t('customer_meter.unitB'):$t('customer_meter.unitT')}}
- </view>
- </template>
- </u-input>
- </u-form-item>
- <u-form-item v-if="orderForm.orderType != '4'" :label="$t('order.vehicle')" borderBottom
- prop="vehicle" @click="toSelectVehicle">
- <u-input v-model="orderForm.vehicle" border="none" disabled disabledColor="#ffffff"
- :placeholder="$t('base.common.placeholderS')+' '+$t('order.vehicle')"></u-input>
- <u-icon slot="right" name="arrow-right"></u-icon>
- </u-form-item>
-
- <u-form-item v-if="orderForm.orderType != '4'" :label="$t('order.idcard')" borderBottom
- prop="vehicle" @click="toSelectVehicle">
- <u-input v-model="orderForm.idcard" border="none" disabled disabledColor="#ffffff"
- :placeholder="$t('base.common.placeholderS')+' '+$t('order.idcard')"></u-input>
- <u-icon slot="right" name="arrow-right"></u-icon>
- </u-form-item>
- <u-form-item v-if="orderForm.vehicleType != '102'" :label="$t('order.salePoint')" borderBottom prop="salePoint">
- <span>{{orderForm.saleBlockName}}</span>
- </u-form-item>
- <u-form-item v-if="paymentOption && paymentOption.isFlag=='1'" :label="$t('order.orderRelease')" borderBottom prop="releaseUponPayment">
- <view class="uni-list">
- <radio-group v-model="orderForm.releaseUponPayment" @change="onReleaseUponPaymentConfirm" placement="row">
- <label class="uni-list-cell uni-list-cell-pd" v-for="item in releaseUponPaymentOption" :key="item.value" >
- <radio style="transform:scale(0.8)" :value="item.value" :checked="item.value === orderForm.releaseUponPayment"/>{{item.text}}
- </label>
- </radio-group>
- </view>
- </u-form-item>
- <u-form-item v-if="paymentOption && paymentOption.isFlag=='1'" :label="$t('order.isIntima')" borderBottom prop="isIntima">
- <view class="uni-list">
- <radio-group v-model="orderForm.isIntima" @change="onisIntimaConfirm" placement="row">
- <label class="uni-list-cell uni-list-cell-pd" v-for="item in isIntimaOption" :key="item.value" >
- <radio style="transform:scale(0.8)" :value="item.value" :checked="item.value === orderForm.isIntima"/>{{item.text}}
- </label>
- </radio-group>
- </view>
- </u-form-item>
- <u-form-item :label="$t('order.phone')" borderBottom prop="phone">
- <u--input v-model="orderForm.phone" border="none" type="number"
- :placeholder="$t('base.common.placeholderI')+$t('order.phone')">
- </u--input>
- </u-form-item>
- <!-- <u-form-item :label="$t('order.axle')" borderBottom prop="axle">
- <u--input v-model="orderForm.axle" border="none"
- :placeholder="$t('base.common.placeholderI')+$t('order.axle')">
- </u--input>
- </u-form-item> -->
- <u-form-item v-if="orderForm.orderType == '1' "
- :label="$t('order.transportType')" borderBottom prop="transporterType"
- @click="showPopup('popupTransporterTypeId')">
- <span>{{orderForm.transporterTypeName}}</span>
- <!-- <u-input readonly v-model="orderForm.transporterTypeName" border="none"
- :placeholder="$t('base.common.placeholderS')+$t('order.transportType')" /> -->
- </u-form-item>
- <u-form-item v-if="orderForm.orderType == '1' "
- :label="$t('order.transporter')" borderBottom prop="transporterId"
- @click="showPopup('popupTransporterId')">
- <!-- <u-input readonly v-model="orderForm.transporterName" border="none"
- :placeholder="$t('base.common.placeholderS')+$t('order.transporter')" /> -->
- <span>{{orderForm.transporterName}}</span>
- </u-form-item>
- <u-form-item :label="$t('order.bisectorNumber')" borderBottom prop="bisectorNumber">
- <u-input v-model="orderForm.bisectorNumber" border="none"
- :placeholder="$t('base.common.placeholderI')+$t('order.bisectorNumber')" />
- </u-form-item>
- <u-form-item v-if="orderForm.vehicleType == '101'" :label="$t('order.projectName')" borderBottom prop="popupProjectId"
- @click="showPopup('popupProjectId')">
- <span>{{ orderForm.projectName }}</span>
- </u-form-item>
- <u-form-item :label="$t('order.remarks')" borderBottom prop="remarks">
- <u-input v-model="orderForm.remark" border="none"
- :placeholder="$t('base.common.placeholderI')+$t('order.remarks')" />
- </u-form-item>
-
- </u-form>
- <view style="margin: 16px 0;">
- <button class="bind-btn" @click="submit('form1')">{{$t('base.common.submit')}}
- </button>
- </view>
- </view>
- <u-toast ref="loadingToast"></u-toast>
- <CarKeyboard :show.sync="carKeyboardShow" :vehicleNo="orderForm.vehicle" @confirm="onKeyBoardConfirm"
- vehicleType="car"></CarKeyboard>
- <!-- 下单日期 -->
- <u-calendar color="#4680F9" round='25' :show="showSetDateCalendar" @confirm="onSetDateConfirm"
- @close="showSetDateCalendar=false"></u-calendar>
- <!-- 有效日期 -->
- <u-datetime-picker :show="showEndDateCalendar" v-model="defaultEndDate" :defaultDate="defaultEndDate"
- mode="datetime" @confirm="onEndDateConfirm" @close="showEndDateCalendar=false" />
- <!-- <u-calendar color="#4680F9" :defaultDate="defaultEndDate" :show="showEndDateCalendar"
- @confirm="onEndDateConfirm" @close="showEndDateCalendar=false" /> -->
- <!-- 临时或固定 -->
- <PopupSelect ref="popupOrderType" :option="orderTypeOption.filter((item)=>{return item.isShow==true})" @onConfirm="onOrderTypeConfirm" />
- <!-- 业务类型 -->
- <!-- <PopupSelect ref="popupVehicleType" :option="vehicleTypeOption" @onConfirm="onVehicleTypeConfirm" /> -->
- <!-- 客户 -->
- <PopupSelect ref="popupCompanyId" :hasSearch='false' :option="companyOption" @onConfirm="onCompanyConfirm" />
- <PopupSelect ref="popupTransporterId" :hasSearch='false' :option="transporterOption"
- @onConfirm="onTransporterConfirm" />
- <!--项目-->
- <PopupSelect ref="popupProjectId" kind="m" :hasSearch='false' :option="projectTypeOption"
- @onConfirm="onProjectTypeConfirm" />
- <!-- 原料 -->
- <PopupSelect ref="popupmaterialId" kind="m" :hasSearch='false' :option="materialOption"
- @onConfirm="onProductConfirm" />
- <PopupSelect ref="popupTransporterTypeId" kind="m" :hasSearch='false' :option="transporterTypeOption"
- @onConfirm="onTransporterTypeConfirm" />
- <!-- 企业选项 -->
- <PopupSelect ref="popupTenantId" :hasSearch='false' :option="tenantOption" @onConfirm="onTenantConfirm" />
- <!-- 销售点 -->
- <!-- <PopupSelect ref="salePoint" :hasSearch='false' :option="salePointOption" @onConfirm="onSalePointConfirm" /> -->
- </view>
- </template>
- <script>
- import PopupSelect from '../../components/popup-select/index'
- import dayjs from 'dayjs'
- import CarKeyboard from '../../components/carKeyboard/carKeyboard'
- import {
- getTenantCacheList,
- getOrderType,
- } from '../../utils/util.js'
- import {
- saveOrder,
- getOption,
- getMaterialsByCompany,
- getSalesMaterByCompany,
- getSalePointByCompany
- } from '../../api/order'
- import value from '../../uni_modules/uview-ui/components/u-text/value'
- export default {
- components: {
- CarKeyboard,
- PopupSelect
- },
- data() {
- return {
- carKeyboardShow: false,
- start: dayjs().format('YYYY-MM-DD'),
- orderForm: {
- kind: "",
- setDate: dayjs().format('YYYY-MM-DD'), //订单日期
- orderValidDate: dayjs().add(30, 'day').format('YYYY-MM-DD HH:mm:ss'), //有效日期
- tenantId: '', //企业
- orderType: '1', //订单类型
- companyId: '', //客商
- materialId: "", //物料
- orderNumber: "0", //数量
- vehicle: '', //车号
- driverId: '', //司机id\
- vehicleType: '1',
- xfFlag: '',
- phone: '',
- axle:'',
- idcard: "",
- driver: '',
- orderPiece: '', //件数
- tenantName: '',
- vehicleTypeName: '', //业务类型
- companyName: "", //客商
- materialName: "", //物料id
- orderTypeName: '临时订单',
- sourceId: "", //第三方大订单ID
- remark: "",
- bisectorNumber:"",
- measureUnit: '', //单位
- transporterType: "",
- transporterTypeName: "",
- transporterId: "", //运输单位
- transporterName: "",
- appUserType:"3",
- releaseUponPayment:"0",
- isIntima:"0",
- saleBlockId:"",
- saleBlockName:"",
- projectName:"",
- projectId:'',
- },
- rules: {
- orderType: [{
- required: true,
- message: this.$t('base.common.placeholderS') +' '+ this.$t('order.orderType')
- }],
- vehicleType: [{
- required: true,
- message: this.$t('base.common.placeholderS') +' '+ this.$t('order.vehicleType')
- }],
- tenantId: [{
- required: true,
- message: this.$t('base.common.placeholderS') +' '+ this.$t('order.enterprise')
- }],
- companyId: [{
- required: true,
- message: this.$t('base.common.placeholderS') +' '+ this.$t('order.companyName')
- }],
- materialId: [{
- required: true,
- message: this.$t('base.common.placeholderS') +' '+ this.$t('order.materialName')
- }],
- orderNumber: [{
- required: true,
- message: this.$t('base.common.placeholderI') +' '+ this.$t('order.orderNumber')
- }]
- },
- vehicleTypeOption: [{
- text: this.$t('base.common.noData'),
- value: null
- }, ],
- releaseUponPaymentOption:[{
- text: this.$t('driver.yes'),
- value: '1'
- },{
- text: this.$t('driver.no'),
- value: '0'
- },],
- isIntimaOption:[{
- text: this.$t('driver.have'),
- value: '1'
- },{
- text: this.$t('driver.notHave'),
- value: '0'
- },],
- orderTypeOption: [{
- text: this.$t("order.tempOrder"),
- isShow: true,
- value: '1',
- index: 1,
- key: "add_temp_order",
- },
- {
- text: this.$t("order.fixedOrder"),
- isShow: false,
- value: '2',
- index: 2,
- key: "add_fixed_order",
- },
- {
- text: this.$t("order.shareOrder"),
- isShow: false,
- value: '4',
- index: 3,
- key: "add_share_order",
- },
- ],
- paymentOption: {},
- //产品选项
- materialOption: [{
- text: this.$t('base.common.noData'),
- value: null,
- }], //物料选项
- //产品选项
- transporterTypeOption: [{
- text: this.$t('base.common.noData'),
- value: null,
- }], //物料选项
- //客户选项
- companyOption: [{
- text: this.$t('base.common.noData'),
- compvalueanyId: null
- }], //供应商选项
- //客户选项
- transporterOption: [{
- text: this.$t('base.common.noData'),
- compvalueanyId: null
- }], //供应商选项
- // vehicleOption:[{vehicle:this.$t('base.common.noData'),value:null}], //司机选项
- tenantOption: [{
- text: this.$t('base.common.noData'),
- value: null
- }], //企业选项
- salePointOption: [{
- text: this.$t('base.common.noData'),
- value: null
- }], //销售点
- projectTypeOption: [{
- text: this.$t('base.common.noData'),
- value: null
- }], //项目
-
-
- showSetDateCalendar: false,
- showEndDateCalendar: false,
- defaultEndDate: dayjs().add(30, 'day').format('YYYY-MM-DD HH:mm:ss'), //默认有效日期
- //业务对应的客户信息
- vehicleTypeCompanyList: [],
- //参数
- appParameters: {},
- //客户对应的物料信息
- companyMaterialList: [],
- language:'zh-Hans'
- }
- },
- onLoad(options) {
- this.bindTenant()
- console.log("允许操作的订单类型、", this.orderTypeOption);
- this.language = uni.getStorageSync('CURRENT_LANG')
- if(this.orderTypeOption && this.orderTypeOption.length>0){
- this.orderForm.orderType = this.orderTypeOption[0].value
- this.orderForm.orderTypeName = this.orderTypeOption[0].text
- }
- },
- methods: {
- onOrderNumberFocus() {
- if (this.orderForm.orderNumber == 0) {
- this.orderForm.orderNumber = null
- }
- },
- //选择品种
- selectMater() {
- uni.navigateTo({
- url: `/subpages/order/materSelect?option=${JSON.stringify(this.materialOption)}`
- })
- },
- //去选择司机
- toSelectVehicle() {
- uni.navigateTo({
- url: '/subpages/order/vehicle'
- })
- },
- //车号键盘输出
- onKeyBoardConfirm(id) {
- this.orderForm.vehicle = id
- },
- //显示车牌键盘
- carKeyboardOut() {
- this.carKeyboardShow = true
- },
- //选择订单类型后加载选项 //获取品种信息 101:销售,102:采购
- bindOption() {
- this.clear(true);
- console.log("订单租户信息、", this.orderForm.tenantId);
- if (!this.orderForm.tenantId) {
- console.log("订单业务租户信息");
- return;
- }
- var that = this;
- console.log("当前租户ID、", that.orderForm.tenantId);
- if (that.orderForm.tenantId) {
- let data = JSON.parse(JSON.stringify(that.orderForm))
- 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)
- if(that.language == 'zh-Hans'){
- that.vehicleTypeOption = res.data.data.appVehicleType;
- }else{
- that.vehicleTypeOption = res.data.data.appVehicleType.map(item=>{
- return{
- text:item.language,
- value:item.value
- }
- });
- }
- if (that.vehicleTypeOption && that.vehicleTypeOption.length > 0) {
- that.orderForm.vehicleType = that.vehicleTypeOption[0].value
- that.onVehicleTypeConfirm({detail:{value:that.orderForm.vehicleType}})
- that.appParameters = res.data.data.appParameters
- that.vehicleTypeCompanyList = res.data.data.appCompany
- that.bindCompany();
- if(that.language == 'zh-Hans'){
- that.transporterTypeOption = res.data.data.appTransportTypeList
- that.transporterOption=res.data.data.appTransportList
- }else{
- that.transporterTypeOption = res.data.data.appTransportTypeList.map(item=>{
- return{
- text:item.language,
- value:item.value
- }
- });
- that.transporterOption = res.data.data.appTransportList.map(item=>{
- return{
- text:item.language,
- value:item.value
- }
- });
-
- }
- if (that.transporterTypeOption && that.transporterTypeOption.length > 0) {
- that.orderForm.transporterType = that.transporterTypeOption[0].value
- that.orderForm.transporterTypeName = that.transporterTypeOption[0].text
- }
-
- }
- }
- })
- }
- },
- //获取销售区域
- bindProject(){
- this.orderForm.saleBlockId = ''
- this.orderForm.saleBlockName = ''
- if (this.orderForm.vehicleType != '102'){
- getSalePointByCompany(this.orderForm.companyId).then(res=>{
- if (res.statusCode === 200) {
- this.orderForm.saleBlockId = res.data.data.id
- this.orderForm.saleBlockName = res.data.data.name
- }
- })
- }
- },
-
- bindCompany() {
- var vehicleType = this.orderForm.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
- })
- })
- this.orderForm.companyId = this.companyOption[1].value
- this.orderForm.companyName = this.companyOption[1].text
- this.bindMaterial();
- this.bindProject()
- }
- console.log("客户信息、", this.companyOption);
- }
- },
- bindMaterial() {
- var companyId = this.orderForm.companyId;
- this.materialOption = []
- this.orderForm.materialId = ''
- this.orderForm.materialName = ''
- this.paymentOption = {}
- if (companyId) {
- if(this.orderForm.vehicleType == '101'){
- getSalesMaterByCompany(this.orderForm).then(res => {
- if (res.data.code == 0) {
- this.paymentOption = res.data.hardInfo
- if (res.data.companyProductList) {
- res.data.companyProductList.forEach(item => {
- this.projectTypeOption.push({
- text: item.productName,
- value: item.id
- })
- })
- }
-
- if (res.data.companyList) {
- res.data.companyList.forEach(item => {
- this.transporterOption.push({
- text: item.name,
- value: item.id
- })
- })
- }
- // this.materialOption = [{
- // text: this.$t('order.notSelected'),
- // value: null
- // }] //物料选项
- var materialInfos = res.data.data;
- console.log("1111213213", materialInfos);
- if (materialInfos && materialInfos.length > 0) {
- materialInfos.forEach(item => {
- this.materialOption.push({
- text: item.name,
- value: item.id,
- type: item.materTypeName ? item.materTypeName : '暂无分类',
- kind: item.kind,
- measureUnit: item.measureUnit
- })
- })
-
- // if (this.materialOption[1] && this.materialOption.length == 2) {
- // this.orderForm.materialId = this.materialOption[1].value
- // this.orderForm.materialName = this.materialOption[1].text
- // this.orderForm.kind = this.materialOption[1].kind
- // this.orderForm.measureUnit = this.materialOption[1].measureUnit
-
-
- // }
- }
- console.log("品种信息、", this.materialOption);
- }
- })
- }else{
- getMaterialsByCompany(this.orderForm).then(res => {
- if (res.data.code == 0) {
- this.paymentOption = res.data.hardInfo
- if (res.data.companyList) {
- res.data.companyList.forEach(item => {
- this.transporterOption.push({
- text: item.name,
- value: item.id
- })
- })
- }
- // this.materialOption = [{
- // text: this.$t('order.notSelected'),
- // value: null
- // }] //物料选项
- var materialInfos = res.data.data;
- console.log("1111213213", materialInfos);
- if (materialInfos && materialInfos.length > 0) {
- materialInfos.forEach(item => {
- this.materialOption.push({
- text: item.name,
- value: item.id,
- type: item.materTypeName ? item.materTypeName : '暂无分类',
- kind: item.kind,
- measureUnit: item.measureUnit
- })
- })
-
- // if (this.materialOption[1] && this.materialOption.length == 2) {
- // this.orderForm.materialId = this.materialOption[1].value
- // this.orderForm.materialName = this.materialOption[1].text
- // this.orderForm.kind = this.materialOption[1].kind
- // this.orderForm.measureUnit = this.materialOption[1].measureUnit
-
-
- // }
- }
- console.log("品种信息、", this.materialOption);
- }
- })
- }
- }
- },
- //
- bindTenant() {
- this.tenantOption = getTenantCacheList();
- if (this.tenantOption.length > 0) {
- this.orderForm.tenantId = this.tenantOption[0].value
- this.orderForm.tenantName = this.tenantOption[0].text
- }
- this.bindOption();
- },
- //提交订单
- submit(ref) {
- let _this = this
- console.log("提交的订单信息、", this.orderForm);
- var isCheckVehicle = true
- if (this.orderForm.vehicleType == "101" &&
- this.appParameters &&
- this.orderForm.transporterType &&
- this.appParameters.VEHICLE_ALLOW_EMPTY_TRANSPORTER_TYPE &&
- this.appParameters.VEHICLE_ALLOW_EMPTY_TRANSPORTER_TYPE.indexOf(this.orderForm.transporterType) > -1) {
- isCheckVehicle = false
- }
- if (this.orderForm.orderType != "4" && !this.orderForm.vehicle && isCheckVehicle == true) {
- uni.showToast({
- title: this.$t('base.common.placeholderI') + this.$t('order.vehicle'),
- icon: 'none',
- duration: 2000
- })
- return;
- }
- if (this.orderForm.vehicleType !='102' && (!this.orderForm.orderNumber || this.orderForm.orderNumber == '0')) {
- uni.showToast({
- title: this.$t('base.common.placeholderI') + this.$t('order.orderNumber'),
- icon: 'none',
- duration: 2000
- })
- return;
- }
- this.$refs[ref].validate().then(() => {
- let data = JSON.parse(JSON.stringify(_this.orderForm))
- console.log("保存订单信息、", data);
- this.$refs.loadingToast.show({
- type: "loading",
- message: this.$t('base.common.loading'),
- duration: "1000000"
- })
- saveOrder(data).then(res => {
- this.$refs.loadingToast.hide()
- if (res.statusCode === 200) {
- uni.showModal({
- // title: '提示',
- content: this.$t("order.isContinueAddOrder"),
- showCancel: true,
- cancelText: this.$t("base.button.goBack"),
- confirmText: this.$t("base.button.continue"),
- success: function(res) {
- if (res.confirm) {
- _this.orderForm = {
- kind: "",
- setDate: dayjs().format('YYYY-MM-DD'), //订单日期
- orderValidDate: dayjs().add(30, 'day').format('YYYY-MM-DD HH:mm:ss'), //有效日期
- tenantId: '', //企业
- orderType: '1', //订单类型
- companyId: '', //客商
- materialId: "", //物料
- orderNumber: "0", //数量
- vehicle: '', //车号
- driverId: '', //司机id\
- vehicleType: '1',
- xfFlag: '',
- phone: '',
- axle:'',
- idcard: "",
- driver: '',
- orderPiece: '', //件数
- tenantName: '',
- vehicleTypeName: '', //业务类型
- companyName: "", //客商
- materialName: "", //物料id
- orderTypeName: '临时订单',
- sourceId: "", //第三方大订单ID
- remark: "",
- bisectorNumber:"",
- measureUnit: '', //单位
- transporterType: "",
- transporterTypeName: "",
- transporterId: "", //运输单位
- transporterName: "",
- appUserType:"3",
- releaseUponPayment:"0",
- isIntima:"0",
- saleBlockId:"",
- projectName:'',
- saleBlockName:"",
- },
- _this.bindTenant()
- console.log("允许操作的订单类型、", _this.orderTypeOption);
-
- if(_this.orderTypeOption && _this.orderTypeOption.length>0){
- _this.orderForm.orderType = _this.orderTypeOption[0].value
- _this.orderForm.orderTypeName = _this.orderTypeOption[0].text
- }
- console.log('用户点击确定');
- } else if (res.cancel) {
- console.log('用户点击取消');
- uni.redirectTo({
- url: '/subpages/order/dealerList?index=0'
- })
- }
- }
- })
- }
- })
- }).catch(err => {
- console.log('err', err);
- this.$refs.loadingToast.hide()
- })
- },
- formatOption(data) {
- let arr = []
- data.forEach(item => {
- arr.push({
- text: item.name || item.label,
- value: item.value || item.id
- })
- })
- if (arr.length) {
- arr.unshift({
- text: this.$t('order.notSelected'),
- value: null
- })
- } else {
- arr.unshift({
- text: this.$t('base.common.noData'),
- value: null
- })
- }
- return arr
- },
- //显示选择
- showPopup(refs) {
- this.$refs[refs].showPicker = true
- },
- //选择下单日期
- onSetDateConfirm(date) {
- this.orderForm.setDate = dayjs(date).format('YYYY-MM-DD');
- this.showSetDateCalendar = false;
- },
- //选择下单日期
- onEndDateConfirm(date) {
- this.orderForm.orderValidDate = dayjs(date.value).format('YYYY-MM-DD HH:mm:ss');
- this.showEndDateCalendar = false;
- },
- //选择订单类型
- onOrderTypeConfirm(value) {
- this.orderForm.orderType = ''
- this.orderForm.orderTypeName = ''
- if (value.value) {
- this.orderForm.orderType = value.value
- this.orderForm.orderTypeName = value.text
- }
- },
- //选择订单类型
- onVehicleTypeConfirm(value) {
- console.log('value',value);
- this.orderForm.vehicleType = value.detail.value
- if(this.orderForm.vehicleType == '101'){
- this.orderTypeOption[1].isShow = false
- this.orderForm.orderType = this.orderTypeOption[0].value
- this.orderForm.orderTypeName = this.orderTypeOption[0].text
- }else{
- this.orderTypeOption = getOrderType(this.orderTypeOption);
- }
- this.clear(false)
- this.bindCompany();
- // this.bindMaterial();
- },
- onReleaseUponPaymentConfirm(value){
- this.orderForm.releaseUponPayment = value.detail.value
- },
- onisIntimaConfirm(value){
- this.orderForm.isIntima = value.detail.value
- },
-
- //选择客户
- onCompanyConfirm(value) {
- this.orderForm.companyId = ''
- this.orderForm.companyName = ''
- if (value.value) {
- this.orderForm.companyId = value.value
- this.orderForm.companyName = value.text
- }
- this.bindMaterial();
- this.bindProject()
- // this.bindCompany();
- },
- onTransporterConfirm(value) {
- this.orderForm.transporterId = ''
- this.orderForm.transporterName = ''
- if (value.value) {
- this.orderForm.transporterId = value.value
- this.orderForm.transporterName = value.text
- }
- },
- onProjectTypeConfirm(value) {
- this.orderForm.projectName = ''
- this.orderForm.projectId = ''
- if (value.value) {
- this.orderForm.projectId = value.value
- this.orderForm.projectName = value.text
- }
- },
-
- //选择原料
- onProductConfirm(value) {
- console.log("选择的物料信息、", value);
- this.orderForm.materialId = ''
- this.orderForm.materialName = ''
- if (value.value) {
- this.orderForm.materialId = value.value
- this.orderForm.materialName = value.text
- }
- },
- //选择运输类型
- onTransporterTypeConfirm(value) {
- console.log("选择的运输类型信息、", value);
- this.orderForm.transporterType = ''
- this.orderForm.transporterTypeName = ''
- if (value.value) {
- this.orderForm.transporterType = value.value
- this.orderForm.transporterTypeName = value.text
- }
- },
- //选择销售点类型
- onSalePointConfirm(value) {
- console.log("选择的销售点信息、", value);
- this.orderForm.salePoint = ''
- this.orderForm.saleBlockName = ''
- if (value.value) {
- this.orderForm.salePoint = value.value
- this.orderForm.saleBlockName = value.text
- }
- },
-
- //选择企业
- onTenantConfirm(value) {
- this.orderForm.tenantId = ''
- this.orderForm.tenantName = ''
- if (value.value) {
- this.orderForm.tenantId = value.value
- this.orderForm.tenantName = value.text
- }
- this.bindOption();
- },
- clear(isVehicleType) {
- if (isVehicleType == true) {
- this.vehicleTypeOption = [{
- text: this.$t('base.common.noData'),
- value: null
- }]
- this.orderForm.vehicleType = ''
- }
- this.companyOption = [{
- text: this.$t('base.common.noData'),
- value: null
- }] //客户选项
- this.materialOption = [{
- text: this.$t('base.common.noData'),
- value: null
- }] //物料选项
- this.orderForm.companyId = ''
- this.orderForm.materialId = ''
- this.orderForm.companyName = ''
- this.orderForm.materialName = ''
- this.orderForm.orderNumber = '0';
- this.orderForm.driver = '';
- this.orderForm.driverId = '';
- this.orderForm.vehicle = '';
- },
- }
- }
- </script>
- <style lang="less" scoped>
- .order {
- padding: 32rpx;
- .picker-title {
- display: flex;
- padding: 0 32rpx;
- line-height: 84rpx;
- justify-content: space-between;
- .confirm {
- color: #4680F9;
- }
- }
- .picker-wrap {
- height: 440rpx;
- .picker-view {
- height: 100%;
- .item {
- display: flex;
- justify-content: space-between;
- height: 88rpx;
- line-height: 88rpx;
- padding: 0 32rpx;
- .text {
- width: 33%;
- }
- .text1 {
- width: 33%;
- text-align: center;
- }
- .text2 {
- width: 33%;
- text-align: right;
- }
- }
- .btn-item {
- display: flex;
- justify-content: center;
- height: 88rpx;
- line-height: 88rpx;
- padding: 0 32rpx;
- align-items: center;
- .add-vehicle {
- line-height: 64rpx;
- height: 64rpx;
- background: #4680F9;
- width: 25%;
- font-size: 28rpx;
- }
- }
- }
- }
- .form-wrap {
- height: 444rpx;
- padding: 0 32rpx;
- }
- }
- // button {
- // // background:linear-gradient(to right,#4680F9 0%,#00e2fa 80%,#00e2fa 100%);
- // background: #4680F9;
- // line-height: 100rpx;
- // color: #fff;
- // border: none;
- // }
- uni-button:after {
- border: none;
- }
- uni-input {
- height: 72rpx;
- padding: 0 10rpx 0 20rpx;
- }
- .uni-forms-item__inner {
- padding: 20rpx 0;
- }
- // /deep/ .u-button--primary {
- // background-color: #4680F9;
- // border-color: #4680F9;
- // }
- </style>
|