1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270 |
- <template>
- <div class="page-wecom-approval">
- <div
- v-if="loading"
- v-loading="true"
- style="
- width: 100vw;
- height: 100vh;
- z-index: 999;
- position: fixed;
- top: 0;
- left: 0;
- "
- class=""
- element-loading-text="Loading..."
- element-loading-background="rgba(0, 0, 0, 0.3)"
- ></div>
- <div class="main-content">
- <div
- class="flex"
- style="max-width: 800px; margin: 0 auto"
- >
- <div class="logo-area">
- <img
- :src="getLogoPath()"
- alt=""
- />
- </div>
- <div class="page-title">货物运输申请</div>
- <!-- <el-button @click="redirectToCRM">test</el-button> -->
- </div>
- <el-form
- ref="mainForm"
- style="max-width: 800px; margin: 0 auto"
- :model="form"
- :rules="rules"
- label-width="150px"
- label-position="left"
- >
- <el-form-item
- label="申请人"
- prop="name"
- >
- <el-input
- v-model="form.creator_userid"
- disabled
- style="display: none"
- ></el-input>
- <div style="font-weight: bold">{{ firstName }}</div>
- </el-form-item>
- <el-form-item
- prop="so_ref"
- label="SO Reference"
- >
- <el-input
- v-model="form.so_ref"
- style="display: none"
- disabled
- ></el-input>
- <div class="">{{ form.so_ref }}</div>
- </el-form-item>
- <el-form-item
- prop="job_name"
- label="Job Name"
- >
- <el-input
- v-model="form.job_name"
- style="display: none"
- disabled
- ></el-input>
- <div class="">{{ form.job_name }}</div>
- </el-form-item>
- <el-form-item
- prop="location"
- label="Location"
- >
- <el-radio-group v-model="form.location">
- <el-radio
- v-for="item in locationList"
- :key="item.key"
- :label="item.value[0].text"
- :value="item.key"
- ></el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item
- prop="yunshu"
- label="运输方式"
- >
- <el-radio-group v-model="form.yunshu">
- <el-radio
- v-for="item in yunshuList"
- :key="item.key"
- :label="item.value[0].text"
- :value="item.key"
- ></el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item
- v-if="form.yunshu === 'option-1718767952637'"
- label="Cbm"
- prop="cbm"
- >
- <el-input
- v-model="form.cbm"
- placeholder="如选择海运,请填写方数"
- type="number"
- ></el-input>
- </el-form-item>
- <el-form-item
- prop="huoyun"
- label="货运方式"
- >
- <el-radio-group v-model="form.huoyun">
- <el-radio
- v-for="item in huoyunList"
- :key="item.key"
- :label="item.value[0].text"
- :value="item.key"
- ></el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item
- v-if="form.huoyun === 'option-1718768018003'"
- label="货代名称"
- prop="huodai"
- >
- <el-select v-model="form.huodai">
- <el-option
- v-for="item in huodaiList"
- :key="item.key"
- :label="item.value[0].text"
- :value="item.key"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- prop="trans"
- label="中转方式"
- >
- <el-radio-group v-model="form.trans">
- <el-radio
- v-for="item in transList"
- :key="item.key"
- :label="item.value[0].text"
- :value="item.key"
- ></el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item
- prop="number"
- label="箱数"
- >
- <el-input v-model="form.number"></el-input>
- </el-form-item>
- <el-form-item
- prop="weight"
- label="重量"
- >
- <el-input v-model="form.weight">
- <template #append>kg</template>
- </el-input>
- </el-form-item>
- <el-form-item label="地址">
- <div class="addr-input-group">
- <el-input
- v-model="form.ATTN"
- placeholder="ATTN"
- ></el-input>
- <el-input
- v-model="form.Phone"
- placeholder="Phone"
- ></el-input>
- <el-input
- v-model="form.Shipping_Unit_Building_Name"
- placeholder="Shipping_Unit/Building_Name"
- type="textarea"
- rows="1"
- ></el-input>
- <el-input
- v-model="form.Shipping_Street"
- placeholder="Shipping_Street"
- ></el-input>
- <el-input
- v-model="form.Shipping_City"
- placeholder="Shipping_City"
- ></el-input>
- <el-input
- v-model="form.Shipping_State"
- placeholder="Shipping_State"
- ></el-input>
- <el-input
- v-model="form.Shipping_Code"
- placeholder="Shipping_Code"
- ></el-input>
- <el-input
- v-model="form.Shipping_Country"
- placeholder="Shipping_Country"
- ></el-input>
- </div>
- </el-form-item>
- <el-form-item
- prop="comment"
- label="装箱备注"
- >
- <el-input
- v-model="form.comment"
- placeholder="任何补充,请在此处填写"
- type="textarea"
- :rows="3"
- ></el-input>
- </el-form-item>
- <el-form-item
- prop="file"
- label="附件"
- >
- <div>
- <label for="fileInput">
- <el-tooltip
- :content="'企业微信限制了传\'图片\'最大只能上传10MB, 传\'文件\'类型最大只能上传20MB, 上传数量上限为6. 企微可能随时会调整, 建议别传太大的文件.'"
- >
- <div class="el-button el-button-primary">添加附件</div>
- </el-tooltip>
- </label>
- <br />
- <div style="color: #999">
- Artwork/Agreement/合同/其他附件, 请Attach
- </div>
- <div class="">
- <div
- v-for="(file, i) in form.files"
- :key="i"
- class="flex"
- >
- <div style="color: #333; margin-right: 24px">
- {{ file.name }}
- </div>
- <el-button
- size="small"
- type="danger"
- @click="deleteFile(i)"
- >
- Delete
- </el-button>
- </div>
- </div>
- </div>
- </el-form-item>
- <el-form-item label="价格">
- <el-table :data="form.price">
- <el-table-column
- label="货代价格"
- prop=""
- >
- <template #default="scope">
- <el-input
- v-model="scope.row.pa"
- placeholder="请填写我们支付给货代总金额或者每公斤单价"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column
- width="220"
- label="发票单价(AUD/USD)"
- prop=""
- >
- <template #default="scope">
- <el-input
- v-model="scope.row.pb"
- placeholder="请填写申报发票上的单价"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column
- width="100"
- label="操作"
- >
- <template #default="scope">
- <el-button
- type="danger"
- size="small"
- @click="deletePriceRow(scope.row, scope.$index)"
- >
- Delete
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-button
- size="small"
- @click="addPriceRow"
- >
- Add row
- </el-button>
- </el-form-item>
- <br />
- <el-form-item>
- <template #label>
- <div>
- <div class="">货物</div>
- <el-button
- type="danger"
- size="small"
- @click="resetGoods"
- >
- Reset
- </el-button>
- <el-button
- style="margin: 8px 0 0 0"
- type="primary"
- size="small"
- @click="autoFillNumber"
- >
- Dispatch All
- </el-button>
- </div>
- </template>
- <el-table :data="form.goods">
- <el-table-column label="品名">
- <template #default="scope">
- <el-input
- v-model="scope.row.name"
- disabled
- ></el-input>
- <el-input
- v-model="scope.row.desc"
- type="textarea"
- row="3"
- disabled
- style="margin-top: 8px"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column
- width="120"
- label="剩余数量"
- prop="quantity"
- >
- <template #default="scope">
- <el-input
- v-model="scope.row.quantity"
- type="number"
- disabled
- min="0"
- ></el-input>
- </template>
- </el-table-column>
- <el-table-column
- width="120"
- label="发货数量"
- prop="number"
- >
- <template #default="scope">
- <el-form-item
- label=""
- label-width="0"
- :prop="'goods.' + scope.$index + '.number'"
- :rules="{
- required: true,
- message: '必填项',
- trigger: ['blur', 'change'],
- }"
- >
- <el-input
- v-model="scope.row.number"
- type="number"
- min="0"
- @change="(e) => limitNumber(e, scope.row, 'number')"
- ></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column
- label="操作"
- width="100"
- >
- <template #default="scope">
- <el-button
- type="danger"
- size="small"
- @click="deleteGoodRow(scope.row, scope.$index)"
- >
- Delete
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-form-item>
- <el-form-item>
- <div class="flex">
- <el-button
- size="large"
- type="primary"
- :disabled="submited"
- :loading="loading"
- @click="checkForm(mainForm)"
- >
- 提交
- </el-button>
- </div>
- </el-form-item>
- </el-form>
- <div class="copyright">
- Copyright of Promocollection - Version 1.0 Released on 01/07/2024
- </div>
- </div>
- <input
- id="fileInput"
- type="file"
- multiple
- style="display: none"
- @change="processFile"
- />
- </div>
- </template>
- <script lang="ts">
- export default defineComponent({
- name: 'WecomApproval',
- })
- </script>
- <script lang="ts" setup>
- import { defineComponent, ref } from 'vue'
- import { useRoute } from 'vue-router'
- import {
- ElButton,
- ElForm,
- ElFormItem,
- ElInput,
- ElRadio,
- ElRadioGroup,
- ElTable,
- ElTableColumn,
- ElSelect,
- ElOption,
- ElMessage,
- ElTooltip,
- ElNotification,
- } from 'element-plus'
- import type { FormRules, FormInstance } from 'element-plus'
- import request from '@/utils/axios'
- const loading = ref(false)
- const mainForm = ref<FormInstance>()
- const form = ref({
- creator_userid: '',
- so_ref: '',
- job_name: '',
- location: '',
- yunshu: '',
- cbm: '',
- huoyun: '',
- huodai: '',
- trans: '',
- number: '',
- weight: '',
- ATTN: '',
- Phone: '',
- Shipping_Unit_Building_Name: '',
- Shipping_Street: '',
- Shipping_City: '',
- Shipping_State: '',
- Shipping_Code: '',
- Shipping_Country: '',
- comment: '',
- archer: '',
- price: [{ pa: '', pb: '' }],
- goods: [] as any[],
- files: [] as { file_id: string; name: string }[], // 附件
- useField: '',
- })
- const rules = ref<FormRules>({
- creator_userid: [{ required: true, message: '必填项', trigger: 'blur' }],
- so_ref: [{ required: true, message: '必填项', trigger: 'blur' }],
- job_name: [{ required: true, message: '必填项', trigger: 'blur' }],
- location: [{ required: true, message: '必填项', trigger: 'blur' }],
- yunshu: [{ required: true, message: '必填项', trigger: 'blur' }],
- cbm: [{ required: true, message: '必填项', trigger: 'blur' }],
- huoyun: [{ required: true, message: '必填项', trigger: 'blur' }],
- huodai: [{ required: true, message: '必填项', trigger: 'blur' }],
- trans: [{ required: true, message: '必填项', trigger: 'blur' }],
- })
- const locationList = [
- {
- key: 'option-1718767763003',
- value: [
- {
- text: 'AU',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718767763004',
- value: [
- {
- text: 'NZ',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718767776803',
- value: [
- {
- text: 'Other(请在地址栏填写其他国家)',
- lang: 'zh_CN',
- },
- ],
- },
- ]
- const yunshuList = [
- {
- key: 'option-1718767905143',
- value: [
- {
- text: '其他空运',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718767938758',
- value: [
- {
- text: 'DHL空运',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718767944843',
- value: [
- {
- text: 'TNT空运',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718767905144',
- value: [
- {
- text: 'FedEx空运',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718767952637',
- value: [
- {
- text: '海运',
- lang: 'zh_CN',
- },
- ],
- },
- ]
- const huoyunList = [
- {
- key: 'option-1718767971282',
- value: [
- {
- text: '自送AUE',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718767971283',
- value: [
- {
- text: '自送浚捷',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718768010827',
- value: [
- {
- text: 'Logistics直发客户',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718768018003',
- value: [
- {
- text: '货代',
- lang: 'zh_CN',
- },
- ],
- },
- ]
- const huodaiList = [
- {
- key: 'option-1718768061055',
- value: [
- {
- text: '腾信',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718768061056',
- value: [
- {
- text: 'BWW',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718768085759',
- value: [
- {
- text: '天汇',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718768093097',
- value: [
- {
- text: '耀辉',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718768107857',
- value: [
- {
- text: '聂先生',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718768114817',
- value: [
- {
- text: '项先生',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718768125847',
- value: [
- {
- text: '鑫发',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718768131503',
- value: [
- {
- text: '茗佳',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1723103324115',
- value: [
- {
- text: '其他货代(请与物流部沟通)',
- lang: 'zh_CN',
- },
- ],
- },
- ]
- const transList = [
- {
- key: 'option-1718768200256',
- value: [
- {
- text: '直送NZ',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718768200257',
- value: [
- {
- text: '直送客户',
- lang: 'zh_CN',
- },
- ],
- },
- {
- key: 'option-1718768224239',
- value: [
- {
- text: 'to AUWH',
- lang: 'zh_CN',
- },
- ],
- },
- ]
- const addPriceRow = () =>
- form.value.price.push({
- pa: '',
- pb: '',
- })
- const deletePriceRow = function (row: any, index: number) {
- form.value.price.splice(index, 1)
- }
- const deleteGoodRow = function (row: any, index: number) {
- form.value.goods.splice(index, 1)
- }
- const deleteFile = function (index: number) {
- form.value.files.splice(index, 1)
- }
- const route = useRoute()
- const soData = ref(
- {} as {
- Contract_Title: string
- Reference: string
- Pkg_details: any[]
- Product_Details: any[]
- },
- )
- const resetGoods = function () {
- if (
- Array.isArray(soData.value.Pkg_details) &&
- soData.value.Pkg_details.length
- ) {
- form.value.useField = 'Pkg_details'
- form.value.goods = soData.value.Pkg_details.map((i: any) => {
- return {
- id: i.Product_Line_Id,
- name: i.Product?.name || '',
- desc: i.Description || '',
- quantity: i.Quantity || 0,
- number: '',
- }
- })
- } else if (Array.isArray(soData.value.Product_Details)) {
- form.value.useField = 'Product_Details'
- form.value.goods = soData.value.Product_Details.map((i: any) => {
- console.log('iii')
- return {
- id: i.id,
- name: i.product.name || '',
- desc: i.product_description || '',
- quantity: i.quantity || 0,
- number: '',
- }
- })
- } else {
- form.value.goods = []
- }
- }
- const autoFillNumber = function () {
- form.value.goods.forEach((i) => {
- i.number = i.quantity
- })
- }
- const firstName = ref('')
- request
- .post('/common/getSalesOrdersData', {
- id: route.params.id,
- })
- .then((res) => {
- const d = res.data.result
- if (res.status === 200 && res.data.code === 1) {
- soData.value = d
- if (d.Package_not_complate === true) {
- ElNotification({
- duration: 0,
- type: 'error',
- title: '出错啦!',
- message: 'Please confirm current package before a create a new one',
- })
- return false
- }
- firstName.value = (route.query.firstName as string) || ''
- form.value.creator_userid = (route.query.userName as string) || ''
- form.value.job_name = d.Contract_Title
- form.value.so_ref = d.Reference
- form.value.ATTN = d.ATTN || ''
- form.value.Phone = d.Phone || ''
- form.value.Shipping_Unit_Building_Name =
- d.Shipping_Unit_Building_Name || ''
- form.value.Shipping_Street = d.Shipping_Street || ''
- form.value.Shipping_City = d.Shipping_City || ''
- form.value.Shipping_State = d.Shipping_State || ''
- form.value.Shipping_Code = d.Shipping_Code || ''
- form.value.Shipping_Country = d.Shipping_Country || ''
- }
- resetGoods()
- })
- const limitNumber = function (e: any, obj: any, key: string) {
- if (e) {
- obj[key] = Math.round(Number(e))
- }
- }
- const resetFileInput = function () {
- const input = document.getElementById('fileInput') as HTMLInputElement
- if (input) {
- input.value = ''
- }
- }
- const processFile = async function (event: any) {
- if (loading.value) {
- console.log('重复 change')
- // 如果正在上传, 无视重复选择文件动作
- resetFileInput()
- return
- }
- const files = event.target.files || event.dataTransfer.files
- loading.value = true
- Promise.all(
- Array.from(files).map((file: any) => {
- const fileForm = new FormData()
- fileForm.append('file', file)
- return request
- .post('/Shipping_tracking/uploadStraightFile', fileForm, {
- headers: {
- 'Content-Type': 'multipart/form-data',
- },
- })
- .then((res) => {
- const d = res.data
- if (![1, 200].includes(d.result.code)) {
- ElMessage.error(d.result?.message?.errmsg || 'error')
- } else {
- ElMessage.success(file.name + '上传成功')
- form.value.files.push({
- file_id: d.result.message.media_id || '',
- name: file.name,
- })
- }
- })
- }),
- ).finally(() => {
- loading.value = false
- // 处理上传完文件, 重置文件输入框内容
- resetFileInput()
- })
- }
- const checkForm = function (formEl: FormInstance | undefined) {
- if (!formEl) return
- formEl.validate((valid, fields) => {
- if (valid) {
- submit()
- } else {
- ElMessage.error('请检查表单必填项')
- }
- })
- }
- const submited = ref(false)
- const submit = function () {
- // 接口
- const d: any = {
- creator_userid: form.value.creator_userid,
- template_id: '3TmmDAekrafuPCvjxB9TqYwrmk5uj6XGoxseaD1J', // 申请模版 的id
- use_template_approver: 1, // 使用此模板在管理后台设置的审批流程
- apply_data: {
- contents: [
- {
- control: 'Text',
- id: 'Text-1718767851650',
- value: {
- text: form.value.so_ref,
- },
- },
- {
- control: 'Text',
- id: 'Text-1718767876049',
- value: {
- text: form.value.job_name,
- },
- },
- {
- control: 'Selector',
- id: 'Selector-1718767763003',
- value: {
- selector: {
- type: 'single',
- options: [
- {
- key: form.value.location,
- },
- ],
- },
- },
- },
- {
- // 运输方式
- control: 'Selector',
- id: 'Selector-1718767905142',
- value: {
- selector: {
- type: 'single',
- options: [
- {
- key: form.value.yunshu,
- },
- ],
- },
- },
- },
- {
- // 货运
- control: 'Selector',
- id: 'Selector-1718767971281',
- value: {
- selector: {
- type: 'single',
- options: [
- {
- key: form.value.huoyun,
- },
- ],
- },
- },
- },
- {
- // 中转
- control: 'Selector',
- id: 'Selector-1718768200256',
- value: {
- selector: {
- type: 'single',
- options: [
- {
- key: form.value.trans,
- },
- ],
- },
- },
- },
- {
- control: 'Number',
- id: 'Number-1718768439507',
- value: {
- new_number: form.value.number,
- },
- },
- {
- control: 'Number',
- id: 'Number-1718768458174',
- value: {
- new_number: form.value.weight,
- },
- },
- {
- // 地址
- control: 'Textarea',
- id: 'Textarea-1718769752197',
- value: {
- text: (
- (form.value.ATTN ? `ATTN ${form.value.ATTN}; ` : '') +
- (form.value.Phone ? `Phone ${form.value.Phone}` : '') +
- '\n' +
- form.value.Shipping_Unit_Building_Name +
- ', ' +
- form.value.Shipping_Street +
- ', ' +
- form.value.Shipping_City +
- ', ' +
- form.value.Shipping_State +
- ', ' +
- form.value.Shipping_Code +
- ', ' +
- form.value.Shipping_Country
- )
- .trim()
- .replace('null', ''),
- },
- },
- {
- // 装箱备注
- control: 'Textarea',
- id: 'Textarea-1718769807829',
- value: {
- text: form.value.comment,
- },
- },
- ] as any[],
- },
- summary_list: [
- {
- summary_info: [
- {
- text: locationList.filter((i) => i.key === form.value.location)[0]
- .value[0].text,
- lang: 'zh_CN',
- },
- ],
- },
- {
- summary_info: [
- {
- text: form.value.so_ref,
- lang: 'zh_CN',
- },
- ],
- },
- {
- summary_info: [
- {
- text: form.value.job_name,
- lang: 'zh_CN',
- },
- ],
- },
- ],
- }
- if (form.value.yunshu === 'option-1718767952637') {
- d.apply_data.contents.push({
- control: 'Number',
- id: 'Number-1718768530132',
- value: {
- new_number: form.value.cbm,
- },
- })
- }
- if (form.value.huoyun === 'option-1718768018003') {
- d.apply_data.contents.push({
- control: 'Selector',
- id: 'Selector-1718768061055',
- value: {
- selector: {
- type: 'single',
- options: [
- {
- key: form.value.huodai,
- },
- ],
- },
- },
- })
- }
- if (form.value.price.length) {
- // 价格数据
- d.apply_data.contents.push({
- control: 'Table',
- id: 'Table-1718768730236',
- value: {
- children: form.value.price.map((p) => {
- return {
- list: [
- {
- control: 'Text',
- id: 'Text-1718769352473',
- value: {
- text: p.pa,
- },
- },
- {
- control: 'Text',
- id: 'Text-1718769658148',
- value: {
- text: p.pb,
- },
- },
- ],
- }
- }),
- },
- })
- }
- if (form.value.goods.length) {
- // 货物数据
- d.apply_data.contents.push({
- control: 'Table',
- id: 'Table-1718950612643',
- value: {
- children: form.value.goods
- .filter((g) => g.number > 0)
- .map((g) => {
- if (g.number > g.quantity) {
- setTimeout(() => {
- ElNotification({
- duration: 0,
- type: 'warning',
- title: '注意',
- message: `${g.name} 发货数量${g.number}大于可发货数量${g.quantity}`,
- })
- }, 0)
- }
- return {
- list: [
- {
- control: 'Text',
- id: 'Text-1718950641228',
- value: {
- text: g.name,
- },
- },
- {
- control: 'Textarea',
- id: 'Textarea-1718950654801',
- value: {
- text: g.desc,
- },
- },
- {
- control: 'Number',
- id: 'Number-1718950666260',
- value: {
- new_number: g.number,
- },
- },
- ],
- }
- }),
- },
- })
- }
- if (form.value.files.length) {
- // 附件
- d.apply_data.contents.push({
- control: 'File',
- id: 'File-1718769828663',
- value: {
- files: form.value.files.map((i) => {
- return { file_id: i.file_id }
- }),
- },
- })
- }
- d.sales_order_detail = soData.value
- d.origin_form = form.value
- console.log(d, 'form data')
- loading.value = true
- submited.value = true
- request
- .post('/Shipping_tracking/createShippingTracking', d)
- .then((res) => {
- const d = res.data
- console.log(d, 'create approval')
- if (d.result.code === 200 && d.code === 1) {
- ElNotification({
- duration: 0,
- type: 'success',
- title: '任务已成功处理',
- message: '本页面将自动跳转CRM',
- })
- setTimeout(() => {
- redirectToCRM()
- }, 3500)
- } else {
- ElNotification({
- duration: 0,
- type: 'error',
- title: '创建审核单出错!请联系管理员',
- message: d.result.message?.errmsg || d.msg || '',
- })
- }
- })
- .finally(() => {
- loading.value = false
- })
- }
- const redirectToCRM = () => {
- window.location.replace(import.meta.env.VITE_CRM_PATH)
- }
- const getLogoPath = function () {
- return new URL('/assets/logo@2x.png', import.meta.url).href
- }
- </script>
- <style lang="scss">
- input[type='number'] {
- -moz-appearance: textfield;
- appearance: textfield;
- &:hover {
- -moz-appearance: textfield;
- appearance: textfield;
- &::-webkit-inner-spin-button,
- &::-webkit-outer-spin-button {
- -webkit-appearance: none;
- margin: 0;
- }
- }
- &::-webkit-inner-spin-button,
- &::-webkit-outer-spin-button {
- -webkit-appearance: none;
- margin: 0;
- }
- }
- </style>
- <style lang="scss" scoped>
- .main-content {
- background-color: #fff;
- padding: 12px 40px 12px;
- width: 1000px;
- min-width: 1000px;
- min-height: 100vh;
- margin: 0 auto;
- box-shadow:
- 0 0 0 1px rgba(255, 255, 255, 0.4) inset,
- 0 0.5em 1em rgba(0, 0, 0, 0.6);
- }
- .logo-area {
- padding: 12px 0 12px;
- img {
- position: relative;
- left: -16px;
- height: 60px;
- }
- }
- .page-title {
- font-size: 24px;
- font-weight: 500;
- color: #222;
- }
- .copyright {
- position: absoloute;
- text-align: right;
- color: #ccc;
- font-size: 14px;
- line-height: 16px;
- right: 16px;
- }
- .addr-input-group {
- ::v-deep {
- input,
- textarea {
- text-align: right;
- }
- }
- .el-input,
- .el-textarea {
- margin-bottom: 10px;
- &:last-of-type {
- margin-bottom: 0;
- }
- }
- }
- </style>
|