salesPlanAdd.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291
  1. // 创建销售计划
  2. <template>
  3. <div class="container">
  4. <el-row>
  5. <el-col :span="12">
  6. <h2 class="bg-left title">创建销售计划</h2>
  7. </el-col>
  8. <el-col :span="12" class="bg-right">
  9. <el-button
  10. class="bg-bottom"
  11. type="primary"
  12. size="small"
  13. @click="returnsales()"
  14. >
  15. <img
  16. width="6"
  17. height="10"
  18. style="vertical-align: bottom; margin-right: 3px"
  19. src="../../../public/img/lujing.png"
  20. alt
  21. />返回
  22. </el-button>
  23. </el-col>
  24. </el-row>
  25. <div class="basicInformation">
  26. <el-radio-group
  27. @change="tasktypechange"
  28. v-model="dataList.taskTypeKey"
  29. ></el-radio-group>
  30. <div class="center1">
  31. <div class="small-title">
  32. <h3>基本信息</h3>
  33. </div>
  34. <el-form ref="dataList" :model="dataList" label-width="140px">
  35. <!-- 标题 -->
  36. <el-form-item label="标题" span="1" prop="title" >
  37. <el-input
  38. v-model="dataList.title"
  39. maxlength="16"
  40. placeholder="请输入标题,不超过16个字"
  41. />
  42. <span class="unchangeable">*</span>
  43. </el-form-item>
  44. <!-- 货名 -->
  45. <ws-form-item label="货名" span="1" prop="goodsName" >
  46. <ws-select
  47. v-model="dataList.goodsName"
  48. placeholder
  49. class="typeselect"
  50. @change="selectgoodsName"
  51. >
  52. <ws-option
  53. v-for="item in goodnameList"
  54. :key="item.constKey"
  55. :label="item.constValue"
  56. :value="item.constValue"
  57. />
  58. </ws-select>
  59. <span class="unchangeable">*</span>
  60. </ws-form-item>
  61. <!-- 计划销售量(吨) -->
  62. <el-form-item
  63. label="计划销售量(吨)"
  64. span="1"
  65. prop="plannedSaleVolume"
  66. >
  67. <el-input
  68. v-model="dataList.plannedSaleVolume"
  69. class="typeselect"
  70. placeholder="请输入计划销售量"
  71. />
  72. <span class="unchangeable">*</span>
  73. </el-form-item>
  74. <!-- 最小成交量 -->
  75. <el-form-item label="最小成交量(吨)" span="1" prop="minimumVolume" >
  76. <el-input
  77. v-model="dataList.minimumVolume"
  78. placeholder="请输入最小成交量"
  79. />
  80. <span class="unchangeable">*</span>
  81. </el-form-item>
  82. <!--类型-->
  83. <ws-form-item label="类型" span="1" prop="salePlanType" >
  84. <ws-select
  85. v-model="dataList.salePlanType"
  86. placeholder
  87. class="typeselect"
  88. @change="selectsalePlanType"
  89. >
  90. <ws-option
  91. v-for="item in salePlanTypeList"
  92. :key="item.constKey"
  93. :label="item.constValue"
  94. :value="item.constValue"
  95. />
  96. </ws-select>
  97. <span class="unchangeable">*</span>
  98. </ws-form-item>
  99. <!-- 价格类型 -->
  100. <ws-form-item label="价格类型" span="1" prop="priceType">
  101. <el-input v-model="dataList.priceType" disabled />
  102. </ws-form-item>
  103. <ws-form-item
  104. v-show="dataList.salePlanType=='期货'"
  105. label="基差(元/吨)"
  106. span="1"
  107. prop="basisPrice"
  108. >
  109. <el-input v-model="dataList.basisPrice" placeholder="请输入基差" />
  110. <span class="unchangeable">*</span>
  111. </ws-form-item>
  112. <ws-form-item
  113. v-show="dataList.salePlanType == '现货'"
  114. label="销售价格(元)"
  115. span="1"
  116. prop="salePrice"
  117. >
  118. <el-input
  119. v-model="dataList.salePrice"
  120. maxlength="120"
  121. size="small"
  122. placeholder="请输入销售价格"
  123. />
  124. <span class="unchangeable">*</span>
  125. </ws-form-item>
  126. <!--出货库-->
  127. <ws-form-item label="出货库" span="1" prop="sendWarehouse" >
  128. <ws-select
  129. v-model="dataList.sendWarehouse"
  130. placeholder
  131. class="typeselect"
  132. @change="sendWarehousechange"
  133. >
  134. <ws-option
  135. v-for="item in warehouseList"
  136. :key="item.warehouseName"
  137. :label="item.warehouseName"
  138. :value="item.warehouseName"
  139. />
  140. </ws-select>
  141. <span class="unchangeable">*</span>
  142. </ws-form-item>
  143. <ws-form-item label="出货库所在地区" span="1" prop="sendArea" >
  144. <el-cascader
  145. :options="options_"
  146. v-model="selectedOptions"
  147. clearable
  148. size="large"
  149. placeholder="请选择出货库所在地区"
  150. @change="handleChange"
  151. style="width: 200%"
  152. />
  153. <span class="unchangeable">*</span>
  154. </ws-form-item>
  155. <ws-form-item label="运费承担方" span="1" prop="freightPayer">
  156. <ws-select
  157. v-model="dataList.freightPayer"
  158. placeholder
  159. class="typeselect"
  160. @change="selectfreightPayer"
  161. >
  162. <ws-option
  163. v-for="item in freightPayerList"
  164. :key="item.constKey"
  165. :label="item.constValue"
  166. :value="item.constValue"
  167. />
  168. </ws-select>
  169. </ws-form-item>
  170. <ws-form-item label="包装方式" span="1" prop="packingType" >
  171. <ws-select
  172. v-model="dataList.packingType"
  173. placeholder
  174. class="typeselect"
  175. @change="selectpackingType"
  176. >
  177. <ws-option
  178. v-for="item in packingTypeList"
  179. :key="item.constKey"
  180. :label="item.constValue"
  181. :value="item.constValue"
  182. />
  183. </ws-select>
  184. <span class="unchangeable">*</span>
  185. </ws-form-item>
  186. <el-form-item
  187. v-if="dataList.packingType != '散装'"
  188. label="装袋备注"
  189. span="1"
  190. prop="baggingNotes"
  191. >
  192. <el-input
  193. maxlength="30"
  194. v-model="dataList.baggingNotes"
  195. size="small"
  196. placeholder="请输入装袋要求如:98斤,王中王彩袋"
  197. />
  198. </el-form-item>
  199. <ws-form-item label="卖方" span="1" prop="seller" >
  200. <el-input
  201. maxlength="25"
  202. v-model="dataList.seller"
  203. size="small"
  204. placeholder="请输入卖方名称"
  205. />
  206. <span class="unchangeable">*</span>
  207. </ws-form-item>
  208. <el-form-item label="卖方电话" span="1" prop="sellerPhone" >
  209. <el-input
  210. v-model="dataList.sellerPhone"
  211. filterable
  212. :filter-method="dataFilter"
  213. placeholder="请输入卖方电话"
  214. ></el-input>
  215. <span class="unchangeable">*</span>
  216. </el-form-item>
  217. <div class="small-title"></div>
  218. </el-form>
  219. </div>
  220. <div class="center1">
  221. <div class="small-title">
  222. <h3>货物要求</h3>
  223. </div>
  224. <el-form ref="dataList" :model="dataList" label-width="140px">
  225. <el-form-item label="水分(%)<=" span="1" prop="waterContent" >
  226. <el-input
  227. v-model="dataList.waterContent"
  228. class="typeselect"
  229. placeholder="请输入水分占比"
  230. />
  231. <span class="unchangeable">*</span>
  232. </el-form-item>
  233. <el-form-item label="容重(g/l)>=" span="1" prop="bulkDensity" >
  234. <el-input
  235. v-model="dataList.bulkDensity"
  236. class="typeselect"
  237. placeholder="请输入容重"
  238. />
  239. <span class="unchangeable">*</span>
  240. </el-form-item>
  241. <el-form-item label="热损伤(%)<=" span="1" prop="jiaorenli">
  242. <el-input
  243. v-model="dataList.jiaorenli"
  244. class="typeselect"
  245. placeholder="请输入热损伤占比"
  246. />
  247. </el-form-item>
  248. <el-form-item label="杂质(%)<=" span="1" prop="impurity">
  249. <el-input
  250. v-model="dataList.impurity"
  251. class="typeselect"
  252. placeholder="请输入杂质占比"
  253. />
  254. </el-form-item>
  255. <el-form-item label="霉变粒(%)<=" span="1" prop="mildewGrain">
  256. <el-input
  257. v-model="dataList.mildewGrain"
  258. placeholder="请输入霉变粒占比"
  259. />
  260. </el-form-item>
  261. <el-form-item label="不完善粒(%)<=" span="1" prop="imperfectGrain">
  262. <el-input
  263. v-model="dataList.imperfectGrain"
  264. maxlength="120"
  265. placeholder="请输入不完善粒占比"
  266. />
  267. </el-form-item>
  268. <el-form-item label="蛋白(%)>=" span="1" prop="protein">
  269. <el-input
  270. v-model="dataList.protein"
  271. class="typeselect"
  272. placeholder="请输入蛋白占比"
  273. />
  274. </el-form-item>
  275. <ws-form-item label="粒型" span="1" prop="grain">
  276. <ws-select
  277. v-model="dataList.grain"
  278. placeholder
  279. class="typeselect"
  280. @change="selectgrain"
  281. >
  282. <ws-option
  283. v-for="item in grainList"
  284. :key="item.constKey"
  285. :label="item.constValue"
  286. :value="item.constValue"
  287. />
  288. </ws-select>
  289. </ws-form-item>
  290. <ws-form-item label="品级" span="1" prop="grade">
  291. <ws-select
  292. v-model="dataList.grade"
  293. placeholder
  294. class="typeselect"
  295. @change="selectgrade"
  296. >
  297. <ws-option
  298. v-for="item in gradeList"
  299. :key="item.constKey"
  300. :label="item.constValue"
  301. :value="item.constValue"
  302. />
  303. </ws-select>
  304. </ws-form-item>
  305. <ws-form-item label="产地" span="1" prop="unitPrice">
  306. <el-cascader
  307. :options="options1_"
  308. v-model="selectedOptions1"
  309. clearable
  310. size="large"
  311. placeholder="请选择产地"
  312. @change="handleChange1"
  313. style="width: 200%"
  314. />
  315. </ws-form-item>
  316. <el-form-item label="产出年份" span="1" prop="outputYear">
  317. <el-date-picker
  318. v-model="dataList.outputYear"
  319. type="year"
  320. align="right"
  321. unlink-panels
  322. value-format='yyyy'
  323. range-separator="至"
  324. placeholder="产出年份"
  325. ></el-date-picker>
  326. </el-form-item>
  327. </el-form>
  328. </div>
  329. </div>
  330. <!-- 提交 -->
  331. <div style="text-align: right; padding: 10px" class="center">
  332. <el-button class="bg-bottom" type="primary" size="small" @click="submit()"
  333. >提交</el-button
  334. >
  335. </div>
  336. </div>
  337. </template>
  338. <script>
  339. import { saleAdd } from '@/model/salesManagement/index'
  340. import {
  341. regionData,
  342. provinceAndCityData,
  343. CodeToText,
  344. TextToCode,
  345. } from 'element-china-area-data'
  346. import { packList } from '@/model/contarct/index'
  347. import { getwarehousename } from '@/model/tasksport/index'
  348. import Pagination from '@/components/Pagination'
  349. import WsUpload from '@/components/WsUpload'
  350. // import { dayjs, fmoney, EventBus } from 'base-core-lib'
  351. import { dayjs, EventBus } from 'base-core-lib'
  352. export default {
  353. name: 'viewSpareMoney',
  354. components: {
  355. WsUpload,
  356. Pagination,
  357. },
  358. watch: {
  359. // vesselId(val) {
  360. // this.getList()
  361. // },
  362. isShow(val) {
  363. this.showType = val
  364. },
  365. },
  366. computed: {},
  367. data() {
  368. return {
  369. //弹出框
  370. dialogViewSpareMoney: false,
  371. dialogApproveFormVisible: false,
  372. // 是否显示
  373. showType: true,
  374. // 年
  375. year: '',
  376. options_: regionData,
  377. options1_: provinceAndCityData,
  378. packingTypeList: '',
  379. salePlanTypeList: '',
  380. freightPayerList: '',
  381. searchTypeText: '',
  382. selectedOptions: [],
  383. selectedOptions1: [],
  384. contractNoList: [],
  385. deptBudgetTotal: 0,
  386. readonly: true,
  387. currentPage: 1,
  388. pageSize: 10,
  389. searchType: 1,
  390. searchKeyWord: '',
  391. radio: '1',
  392. contractType: 2,
  393. startDate: null,
  394. endDate: null,
  395. goodnameList: {},
  396. grainList: [],
  397. checked: true,
  398. form: {},
  399. pcFlag: 1,
  400. staffList: [],
  401. options: [],
  402. storageType: [],
  403. storageType1: [],
  404. outContractNo: [],
  405. // 提交类型
  406. submitType: true,
  407. status: [],
  408. unitPricechange: [],
  409. warehouseNameList: [],
  410. warehouseNameList1: [],
  411. waterContentchange: [],
  412. appendixIdsAdd: '',
  413. uploadSuccess: {},
  414. warehouseList: [],
  415. warehouseInOutDetail: {},
  416. onChange: {},
  417. deptBudgetList1: [],
  418. gradeList: [],
  419. rules: {
  420. netWeight: [
  421. {
  422. required: true,
  423. type: 'number',
  424. message: '请输入活动名称',
  425. trigger: 'blur',
  426. },
  427. ],
  428. },
  429. outputYear: [],
  430. size: 10,
  431. compId: sessionStorage.getItem('ws-pf_compId'),
  432. deptCircularPage: {},
  433. packtypeList: {},
  434. date: {
  435. year: dayjs().format('YYYY'),
  436. month: dayjs().format('MM'),
  437. },
  438. contractList: [],
  439. inOutTaskNo: '',
  440. dataList: {
  441. taskTypeKey: '1',
  442. goodsName: '玉米',
  443. goodsNameKey: 1,
  444. salePlanType: '现货',
  445. salePlanTypeKey: 2,
  446. priceType: '定价销售',
  447. priceTypeKey: 2,
  448. packingType: '散装',
  449. packingTypeKey: 1,
  450. },
  451. historyList: [],
  452. pickerBeginDateBefore: {
  453. disabledDate: (time) => {
  454. return time.getTime() > Date.now()
  455. },
  456. },
  457. accessoryTFs: false,
  458. }
  459. },
  460. activated() {
  461. this.loaddata()
  462. },
  463. mounted() {},
  464. methods: {
  465. //返回按钮
  466. revert() {
  467. this.$router.go(-1)
  468. },
  469. returnsales() {
  470. this.dataList = {}
  471. // this.selectedOptions = ''
  472. this.$router.push({ path: 'salesPlanList' })
  473. },
  474. // 获取当前年月日
  475. getdate() {
  476. var date = new Date()
  477. var year = date.getFullYear() //获取完整的年份(4位)
  478. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  479. var datetime = date.getDate() //获取当前日(1-31)
  480. if (mouth < 10) {
  481. mouth = '0' + mouth
  482. }
  483. if (datetime < 10) {
  484. datetime = '0' + datetime
  485. }
  486. return year + mouth + datetime
  487. },
  488. // 随机验证码
  489. verifyinit() {
  490. var arr = []
  491. for (var i = 48; i < 123; i++) {
  492. if (i > 57 && i < 65) continue
  493. if (i > 90 && i < 97) continue
  494. arr.push(String.fromCharCode(i))
  495. }
  496. arr.sort(function () {
  497. return Math.random() - 0.5
  498. })
  499. arr.length = 4
  500. return arr.join('')
  501. },
  502. dataFilter(val) {
  503. // console.log(val,"名")
  504. this.deptBudgetList.staffList = val
  505. if (val) {
  506. //val存在
  507. this.options = this.staffList.filter((item) => {
  508. if (
  509. !!~item.staffName.indexOf(val) ||
  510. !!~item.staffName.toUpperCase().indexOf(val.toUpperCase())
  511. ) {
  512. return true
  513. }
  514. })
  515. } else {
  516. //val为空时,还原数组
  517. this.options = this.staffList
  518. }
  519. },
  520. selecttaskType(e) {
  521. for (var i = 0; i < this.taskTypeList.length; i++) {
  522. if (this.taskTypeList[i].value == e) {
  523. this.searchType = this.taskTypeList[i].type
  524. }
  525. }
  526. },
  527. selectstaff(e) {
  528. for (var i = 0; i < this.staffList.length; i++) {
  529. if (this.staffList[i].staffName == e) {
  530. this.dataList.agentKey = this.staffList[i].staffId
  531. }
  532. }
  533. },
  534. selectstaff1(e) {
  535. for (var i = 0; i < this.staffList.length; i++) {
  536. if (this.staffList[i].staffName == e) {
  537. this.dataList1.agentKey = this.staffList[i].staffId
  538. }
  539. }
  540. },
  541. selectgrain(e) {
  542. for (var i = 0; i < this.grainList.length; i++) {
  543. if (this.grainList[i].constValue == e) {
  544. this.dataList.grainKey = this.grainList[i].constKey
  545. }
  546. }
  547. },
  548. selectpackingType(e) {
  549. for (var i = 0; i < this.packingTypeList.length; i++) {
  550. if (this.packingTypeList[i].constValue == e) {
  551. this.dataList.packingTypeKey = this.packingTypeList[i].constKey
  552. }
  553. }
  554. },
  555. selectfreightPayer(e) {
  556. for (var i = 0; i < this.freightPayerList.length; i++) {
  557. if (this.freightPayerList[i].constValue == e) {
  558. this.dataList.freightPayerKey = this.freightPayerList[i].constKey
  559. }
  560. }
  561. },
  562. selectgrade(e) {
  563. for (var i = 0; i < this.gradeList.length; i++) {
  564. if (this.gradeList[i].constValue == e) {
  565. this.dataList.gradeKey = this.gradeList[i].constKey
  566. }
  567. }
  568. },
  569. selectsalePlanType(e) {
  570. if (e == '现货') {
  571. this.dataList.priceType = '定价销售'
  572. this.dataList.priceTypeKey = 2
  573. } else {
  574. this.dataList.priceType = '期货盘面价+基差'
  575. this.dataList.priceTypeKey = 1
  576. }
  577. for (var i = 0; i < this.salePlanTypeList.length; i++) {
  578. if (this.salePlanTypeList[i].constValue == e) {
  579. this.dataList.procurementPlanTypekey =
  580. this.salePlanTypeList[i].constKey
  581. }
  582. }
  583. },
  584. handleChange(value) {
  585. this.selectedOptions = value
  586. this.dataList.sendPrivate = CodeToText[value[0]]
  587. this.dataList.sendCity = CodeToText[value[1]]
  588. this.dataList.sendArea = CodeToText[value[2]]
  589. },
  590. handleChange1(value) {
  591. this.selectedOptions1 = value
  592. this.dataList.outputPrivate = CodeToText[value[0]]
  593. this.dataList.outputCity = CodeToText[value[1]]
  594. },
  595. sendWarehousechange(e) {
  596. for (let i = 0; i < this.warehouseList.length; i++) {
  597. if (this.warehouseList[i].warehouseName == e) {
  598. var tmp = []
  599. tmp[0] = TextToCode[this.warehouseList[i].warehousePrivate].code
  600. tmp[1] =
  601. TextToCode[this.warehouseList[i].warehousePrivate][
  602. this.warehouseList[i].warehouseCity
  603. ].code
  604. tmp[2] =
  605. TextToCode[this.warehouseList[i].warehousePrivate][
  606. this.warehouseList[i].warehouseCity
  607. ][this.warehouseList[i].warehouseArea].code
  608. this.selectedOptions = tmp
  609. }
  610. }
  611. },
  612. //关闭
  613. close() {
  614. this.$router.push({ path: 'procurementPlanList' })
  615. },
  616. loaddata() {
  617. getwarehousename({
  618. compId: this.compId,
  619. warehouseType: 1,
  620. })
  621. .toPromise()
  622. .then((response) => {
  623. console.log(response)
  624. this.warehouseList = response
  625. })
  626. // 货名
  627. packList({ constId: 'CON2' })
  628. .toPromise()
  629. .then((response) => {
  630. this.goodnameList = response
  631. })
  632. // 品级
  633. packList({ constId: 'CON3' })
  634. .toPromise()
  635. .then((response) => {
  636. this.gradeList = response
  637. })
  638. //粒形
  639. packList({ constId: 'PRO4' })
  640. .toPromise()
  641. .then((response) => {
  642. this.grainList = response
  643. })
  644. //类型
  645. packList({ constId: 'PRO1' })
  646. .toPromise()
  647. .then((response) => {
  648. this.salePlanTypeList = response
  649. })
  650. //包装方式
  651. packList({ constId: 'PRO2' })
  652. .toPromise()
  653. .then((response) => {
  654. this.packingTypeList = response
  655. })
  656. //运费承担方
  657. packList({ constId: 'PRO3' })
  658. .toPromise()
  659. .then((response) => {
  660. this.freightPayerList = response
  661. })
  662. },
  663. getdate() {
  664. var date = new Date()
  665. var year = date.getFullYear() //获取完整的年份(4位)
  666. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  667. var datetime = date.getDate() //获取当前日(1-31)
  668. if (mouth < 10) {
  669. mouth = '0' + mouth
  670. }
  671. if (datetime < 10) {
  672. datetime = '0' + datetime
  673. }
  674. return year + mouth + datetime
  675. },
  676. // 随机验证码
  677. verifyinit() {
  678. var arr = []
  679. for (var i = 48; i < 123; i++) {
  680. if (i > 57 && i < 65) continue
  681. if (i > 90 && i < 97) continue
  682. arr.push(String.fromCharCode(i))
  683. }
  684. arr.sort(function () {
  685. return Math.random() - 0.5
  686. })
  687. arr.length = 4
  688. return arr.join('')
  689. },
  690. submit() {
  691. if (!this.dataList.title) {
  692. this.$message({
  693. message: '标题不能为空!',
  694. type: 'warning',
  695. })
  696. return
  697. }
  698. if (this.dataList.title.length > 16) {
  699. this.$message({
  700. message: '标题输入错误!',
  701. type: 'warning',
  702. })
  703. return
  704. }
  705. if (!this.dataList.plannedSaleVolume) {
  706. this.$message({
  707. message: '计划销售量不能为空!',
  708. type: 'warning',
  709. })
  710. return
  711. }
  712. if (
  713. this.dataList.plannedSaleVolume > 10000000 ||
  714. this.dataList.plannedSaleVolume < 1
  715. ) {
  716. this.$message({
  717. message: '计划销售量输入错误!',
  718. type: 'warning',
  719. })
  720. return
  721. }
  722. if (this.dataList.plannedSaleVolume.indexOf('.') != -1) {
  723. if (this.dataList.plannedSaleVolume.split('.')[1].length > 2) {
  724. this.$message({
  725. message: '计划销售量输入错误!',
  726. type: 'warning',
  727. })
  728. return
  729. }
  730. }
  731. if (!this.dataList.minimumVolume) {
  732. this.$message({
  733. message: '最小成交量不能为空!',
  734. type: 'warning',
  735. })
  736. return
  737. }
  738. if (
  739. this.dataList.minimumVolume > 10000000 ||
  740. this.dataList.minimumVolume < 1
  741. ) {
  742. this.$message({
  743. message: '最小成交量输入错误!',
  744. type: 'warning',
  745. })
  746. return
  747. }
  748. if (
  749. this.dataList.minimumVolume.indexOf('.') != -1 &&
  750. this.dataList.minimumVolume.split('.')[1].length > 2
  751. ) {
  752. this.$message({
  753. message: '最小成交量输入错误!',
  754. type: 'warning',
  755. })
  756. return
  757. }
  758. if (
  759. this.dataList.basisPrice > 100000 ||
  760. this.dataList.basisPrice < 0 ||
  761. (String(this.dataList.basisPrice).indexOf(
  762. '.'
  763. ) != -1 &&
  764. String(this.dataList.basisPrice).length -
  765. (String(this.dataList.basisPrice).indexOf(
  766. '.'
  767. ) +
  768. 1) >
  769. 2)
  770. ) {
  771. this.$message({
  772. message: '基差输入错误',
  773. type: 'warning',
  774. })
  775. return
  776. }
  777. if (
  778. this.dataList.salePrice > 100000 ||
  779. this.dataList.salePrice < 0 ||
  780. (String(this.dataList.salePrice).indexOf(
  781. '.'
  782. ) != -1 &&
  783. String(this.dataList.salePrice).length -
  784. (String(this.dataList.salePrice).indexOf(
  785. '.'
  786. ) +
  787. 1) >
  788. 2)
  789. ) {
  790. this.$message({
  791. message: '销售价格输入错误',
  792. type: 'warning',
  793. })
  794. return
  795. }
  796. if (!this.dataList.sendWarehouse) {
  797. this.$message({
  798. message: '请选择出货库',
  799. type: 'warning',
  800. })
  801. return
  802. }
  803. if (this.selectedOptions.length == 0) {
  804. this.$message({
  805. message: '请选择出货库所在地区!',
  806. type: 'warning',
  807. })
  808. return
  809. }
  810. if (!this.dataList.seller) {
  811. this.$message({
  812. message: '卖方不能为空!',
  813. type: 'warning',
  814. })
  815. return
  816. }
  817. if (this.dataList.seller.length > 25 || this.dataList.seller.length < 1) {
  818. this.$message({
  819. message: '卖方输入错误!',
  820. type: 'warning',
  821. })
  822. return
  823. }
  824. if (!this.dataList.sellerPhone) {
  825. this.$message({
  826. message: '请输入卖方电话!',
  827. type: 'warning',
  828. })
  829. return
  830. }
  831. if (this.dataList.sellerPhone.length > 15 || this.dataList.sellerPhone.length < 6) {
  832. this.$message({
  833. message: '卖方电话输入错误!',
  834. type: 'warning',
  835. })
  836. return
  837. }
  838. if (!this.dataList.waterContent) {
  839. this.$message({
  840. message: '水分不能为空!',
  841. type: 'warning',
  842. })
  843. return
  844. }
  845. if (this.dataList.waterContent > 40 || this.dataList.waterContent < 1) {
  846. this.$message({
  847. message: '水分输入错误!',
  848. type: 'warning',
  849. })
  850. return
  851. }
  852. if (
  853. String(this.dataList.waterContent).indexOf('.') != -1 &&
  854. String(this.dataList.waterContent).length -
  855. (String(this.dataList.waterContent).indexOf('.') + 1) >
  856. 2
  857. ) {
  858. this.$message({
  859. message: '水分输入错误',
  860. type: 'warning',
  861. })
  862. return
  863. }
  864. if (!this.dataList.bulkDensity) {
  865. this.$message({
  866. message: '容重不能为空!',
  867. type: 'warning'
  868. })
  869. return
  870. }
  871. if (
  872. (this.dataList.bulkDensity &&
  873. String(this.dataList.bulkDensity).indexOf('.') != -1 &&
  874. String(this.dataList.bulkDensity).length -
  875. (String(this.dataList.bulkDensity).indexOf('.') + 1) >
  876. 2) ||
  877. this.dataList.bulkDensity > 1000 ||
  878. this.dataList.bulkDensity < 500
  879. ) {
  880. this.$message({
  881. message: '容重输入错误',
  882. type: 'warning',
  883. })
  884. return
  885. }
  886. if (
  887. this.dataList.protein&&String(this.dataList.protein).indexOf('.') != -1 &&
  888. String(this.dataList.protein).length -
  889. (String(this.dataList.protein).indexOf('.') + 1) >
  890. 2||this.dataList.protein&&this.dataList.protein>80||this.dataList.protein&&this.dataList.protein<1){
  891. this.$message({
  892. message: '蛋白占比输入错误',
  893. type: 'warning'
  894. })
  895. return
  896. }
  897. if (
  898. this.dataList.impurity&&String(this.dataList.impurity).indexOf('.') != -1 &&
  899. String(this.dataList.impurity).length -
  900. (String(this.dataList.impurity).indexOf('.') + 1) >2
  901. ||this.dataList.impurity&&this.dataList.impurity>40||this.dataList.impurity&&this.dataList.impurity<1) {
  902. this.$message({
  903. message: '杂质输入错误',
  904. type: 'warning'
  905. })
  906. return
  907. }
  908. if (
  909. this.dataList.mildewGrain&&String(this.dataList.mildewGrain).indexOf('.') != -1 &&
  910. String(this.dataList.mildewGrain).length -
  911. (String(this.dataList.mildewGrain).indexOf('.') + 1) >
  912. 2||this.dataList.mildewGrain&&this.dataList.mildewGrain>40||this.dataList.mildewGrain&&this.dataList.mildewGrain<1) {
  913. this.$message({
  914. message: '霉变粒输入错误',
  915. type: 'warning'
  916. })
  917. return
  918. }
  919. if (
  920. this.dataList.jiaorenli&&String(this.dataList.jiaorenli).indexOf('.') != -1 &&
  921. String(this.dataList.jiaorenli).length -
  922. (String(this.dataList.jiaorenli).indexOf('.') + 1) >
  923. 2||this.dataList.jiaorenli&&this.dataList.jiaorenli>40||this.dataList.jiaorenli&&this.dataList.jiaorenli<1) {
  924. this.$message({
  925. message: '热损伤输入错误',
  926. type: 'warning'
  927. })
  928. return
  929. }
  930. if (
  931. this.dataList.imperfectGrain&&String(this.dataList.imperfectGrain).indexOf('.') != -1 &&
  932. String(this.dataList.imperfectGrain).length -
  933. (String(this.dataList.imperfectGrain).indexOf('.') + 1) >
  934. 2||this.dataList.imperfectGrain&&this.dataList.imperfectGrain>40||this.dataList.imperfectGrain&&this.dataList.imperfectGrain<1) {
  935. this.$message({
  936. message: '不完善粒输入错误',
  937. type: 'warning'
  938. })
  939. return
  940. }
  941. this.dataList.id = this.$route.query.id
  942. this.$confirm(`提交后该销售信息将发布到交易平台,是否确定提交?`, {
  943. cancelButtonText: '取消',
  944. confirmButtonText: '确定',
  945. type: 'warning',
  946. })
  947. .then(() => {
  948. this.$refs.dataList.validate((valid) => {
  949. if (valid) {
  950. this.dataList.salePlanNo = 'XSJH' + this.getdate() + this.verifyinit()
  951. this.dataList.sourceProvince = CodeToText[this.selectedOptions[0]]
  952. this.dataList.sourceCity = CodeToText[this.selectedOptions[1]]
  953. this.dataList.sendPrivate = CodeToText[this.selectedOptions[0]]
  954. this.dataList.sendCity = CodeToText[this.selectedOptions[1]]
  955. this.dataList.sendArea = CodeToText[this.selectedOptions[2]]
  956. this.dataList.outputPrivate = CodeToText[this.selectedOptions1[0]]
  957. this.dataList.outputCity = CodeToText[this.selectedOptions1[1]]
  958. this.dataList.unitPrice=this.dataList.salePrice
  959. this.dataList.compId = this.compId
  960. this.dataList.pcFlag = 1
  961. this.dataList.compId = sessionStorage.getItem('ws-pf_compId')
  962. console.log(this.dataList, '查看添加对象')
  963. saleAdd(this.dataList)
  964. .toPromise()
  965. .then((response) => {
  966. this.$message.success('添加成功')
  967. ;(this.outputYear = ''),
  968. this.$router.push({ path: 'salesPlanList' })
  969. })
  970. } else {
  971. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  972. return false
  973. }
  974. })
  975. })
  976. .catch(() => {
  977. return false
  978. })
  979. },
  980. selectwarehouseName() {},
  981. tarechange(e) {
  982. if (this.dataList.grossWeight && this.dataList.tare) {
  983. this.dataList.netWeight = Number(
  984. this.dataList.grossWeight - this.dataList.tare
  985. )
  986. }
  987. },
  988. grossWeightchange(e) {
  989. if (this.dataList.grossWeight && this.dataList.tare) {
  990. this.dataList.netWeight = Number(
  991. this.dataList.grossWeight - this.dataList.tare
  992. )
  993. }
  994. },
  995. selectgoodsName(e) {
  996. for (var i = 0; i < this.goodnameList.length; i++) {
  997. if (this.goodnameList[i].constValue == e) {
  998. this.dataList.goodsNameKey = this.goodnameList[i].constKey
  999. }
  1000. }
  1001. },
  1002. selectpackingMethod(e) {
  1003. for (var i = 0; i < this.packtypeList.length; i++) {
  1004. if (this.packtypeList[i].constValue == e) {
  1005. this.dataList.packingMethodKey = this.packtypeList[i].constKey
  1006. }
  1007. }
  1008. },
  1009. selectpackingMethod1(e) {
  1010. for (var i = 0; i < this.packtypeList.length; i++) {
  1011. if (this.packtypeList[i].constValue == e) {
  1012. this.dataList1.packingMethodKey = this.packtypeList[i].constKey
  1013. }
  1014. }
  1015. },
  1016. selectstorageType(e) {
  1017. for (var i = 0; i < this.storageType.length; i++) {
  1018. if (this.storageType[i].constValue == e) {
  1019. this.dataList.inOutTypeKey = this.storageType[i].constKey
  1020. }
  1021. }
  1022. },
  1023. selectstorageType1(e) {
  1024. for (var i = 0; i < this.storageType1.length; i++) {
  1025. if (this.storageType1[i].constValue == e) {
  1026. this.dataList1.inOutTypeKey = this.storageType[i].constKey
  1027. }
  1028. }
  1029. },
  1030. handleClose() {
  1031. this.accessoryTFs = false
  1032. },
  1033. tasktypechange() {
  1034. this.tasknumber()
  1035. },
  1036. GetRandomNum(Min, Max) {
  1037. var Range = Max - Min
  1038. var Rand = Math.random()
  1039. return Min + Math.round(Rand * Range)
  1040. },
  1041. // deletecontract(){},
  1042. //删除
  1043. approve() {},
  1044. listQuery() {},
  1045. total() {},
  1046. clearfiltQuery() {},
  1047. selectCrtDuty() {},
  1048. },
  1049. }
  1050. </script>
  1051. <style lang="scss" scoped>
  1052. /deep/.basicInformation {
  1053. .el-info-table {
  1054. border: none;
  1055. position: relative;
  1056. }
  1057. .el-form-item {
  1058. width: 33.3333%;
  1059. border: none;
  1060. margin: 0;
  1061. .el-form-item__label {
  1062. text-align: left;
  1063. font-size: 14px;
  1064. font-family: PingFangSC-Regular, PingFang SC;
  1065. font-weight: 400;
  1066. color: #8890b1;
  1067. }
  1068. .el-form-item__content {
  1069. padding-left: 0px;
  1070. padding-right: 10px;
  1071. // background: #fff;
  1072. white-space: nowrap;
  1073. height: 40px;
  1074. display: flex;
  1075. -webkit-box-align: center;
  1076. align-items: center;
  1077. text-align: left;
  1078. overflow: hidden;
  1079. }
  1080. }
  1081. }
  1082. /deep/.el-radio {
  1083. color: #606266;
  1084. font-weight: 500;
  1085. line-height: 1;
  1086. cursor: pointer;
  1087. white-space: nowrap;
  1088. outline: 0;
  1089. margin-right: 30px;
  1090. margin-top: 15px;
  1091. }
  1092. /deep/.el-radio__inner {
  1093. border: 1px solid #dcdfe6;
  1094. border-radius: 100%;
  1095. width: 14px;
  1096. height: 14px;
  1097. background-color: #fff;
  1098. cursor: pointer;
  1099. -webkit-box-sizing: border-box;
  1100. box-sizing: border-box;
  1101. margin-left: 100px;
  1102. }
  1103. /deep/.el-radio__input {
  1104. white-space: nowrap;
  1105. cursor: pointer;
  1106. outline: 0;
  1107. line-height: 1;
  1108. vertical-align: middle;
  1109. margin-top: -1px;
  1110. }
  1111. .title {
  1112. position: relative;
  1113. padding-left: 10px;
  1114. }
  1115. .title::before {
  1116. content: '';
  1117. display: inline-block;
  1118. width: 5px;
  1119. height: 30px;
  1120. background: #5473e8;
  1121. position: absolute;
  1122. left: 0;
  1123. }
  1124. .el-form {
  1125. padding: 0 15%;
  1126. display: flex;
  1127. flex-wrap: wrap;
  1128. margin-left: -50px;
  1129. margin-top: 15px;
  1130. width: 110%;
  1131. }
  1132. .el-button--primary {
  1133. background-color: #5878e8;
  1134. border-color: #5878e8;
  1135. }
  1136. .el-col {
  1137. background: #f6f7fc;
  1138. }
  1139. .bg-right {
  1140. text-align: right;
  1141. padding: 16px 20px;
  1142. }
  1143. .center {
  1144. position: relative;
  1145. top: 50px;
  1146. width: 40%;
  1147. margin: 0 auto;
  1148. margin-right: 180px;
  1149. }
  1150. /deep/.el-form-item__label {
  1151. width: 160px;
  1152. }
  1153. .inspector {
  1154. width: 50%;
  1155. }
  1156. /deep/.el-form-item--small .el-form-item__label,
  1157. .el-form-item--small .el-form-item__content {
  1158. text-align: left;
  1159. }
  1160. /deep/.el-input--small {
  1161. font-size: 13px;
  1162. position: relative;
  1163. display: inline-block;
  1164. }
  1165. .center1 .small-title {
  1166. margin-left: 323px;
  1167. }
  1168. .center1 {
  1169. width: 90%;
  1170. margin: 0 auto;
  1171. margin-left: 10px;
  1172. margin-top: 25px;
  1173. }
  1174. /deep/.el-input--small .el-input__inner {
  1175. height: 32px;
  1176. line-height: 32px;
  1177. }
  1178. /deep/.el-select {
  1179. display: inline-block;
  1180. position: relative;
  1181. width: 100%;
  1182. }
  1183. .annu {
  1184. height: 81px;
  1185. background: #ffffff;
  1186. border-radius: 4px;
  1187. }
  1188. .basicInformation .el-form-item {
  1189. width: 50.3333%;
  1190. border: none;
  1191. margin: 0;
  1192. }
  1193. .el-form {
  1194. font-size: 14px;
  1195. font-family: PingFangSC-Regular, PingFang SC;
  1196. font-weight: 400;
  1197. color: #8890b1;
  1198. line-height: 16px;
  1199. margin-left: 130px;
  1200. }
  1201. .a {
  1202. margin-left: -32px;
  1203. }
  1204. .el-radio-group {
  1205. margin-left: 80px;
  1206. }
  1207. .ding {
  1208. height: 23px;
  1209. background: #e8ecf6;
  1210. box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
  1211. }
  1212. .nav2 {
  1213. height: 25px;
  1214. background: #e8ecf6;
  1215. margin-top: 15px;
  1216. }
  1217. .ziti {
  1218. width: 72px;
  1219. height: 20px;
  1220. font-size: 14px;
  1221. font-family: PingFangSC-Regular, PingFang SC;
  1222. font-weight: 400;
  1223. color: #8890b1;
  1224. line-height: 20px;
  1225. margin-left: 314px;
  1226. /* margin-top: 112px; */
  1227. }
  1228. /deep/.ziti1 {
  1229. height: 40px;
  1230. font-size: 16px;
  1231. font-family: PingFangSC-Medium, PingFang SC;
  1232. font-weight: 500;
  1233. color: #262626;
  1234. line-height: 20px;
  1235. margin-left: 381px;
  1236. margin-top: -21px;
  1237. width: 100px;
  1238. }
  1239. .winseaview-view {
  1240. padding: 0 0 20px;
  1241. }
  1242. .container {
  1243. overflow: scroll;
  1244. height: 93vh;
  1245. }
  1246. /deep/.basicInformation .el-form-item .el-form-item__content {
  1247. padding-left: 0px;
  1248. padding-right: 10px;
  1249. white-space: nowrap;
  1250. height: 40px;
  1251. display: -webkit-box;
  1252. display: -ms-flexbox;
  1253. display: flex;
  1254. -webkit-box-align: center;
  1255. -ms-flex-align: center;
  1256. align-items: center;
  1257. text-align: left;
  1258. overflow: hidden;
  1259. font-size: 12px;
  1260. font-family: PingFangSC-Regular, PingFang SC;
  1261. font-weight: 400;
  1262. color: #232323;
  1263. line-height: 14px;
  1264. }
  1265. .nav {
  1266. width: 400px;
  1267. height: 20px;
  1268. }
  1269. //*号
  1270. .unchangeable {
  1271. position: absolute;
  1272. width: 9px;
  1273. height: 22px;
  1274. font-size: 16px;
  1275. font-family: PingFangSC-Medium, PingFang SC;
  1276. font-weight: 500;
  1277. color: #ff2727;
  1278. line-height: 22px;
  1279. display: inline-block;
  1280. right: -1px;
  1281. }
  1282. /deep/.typeselect .el-input__inner {
  1283. color: #8890b1;
  1284. }
  1285. </style>