salesContractAdd.vue 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861
  1. <template>
  2. <div class="container">
  3. <el-row>
  4. <el-col :span="12">
  5. <h2 class="bg-left title">创建销售合同</h2>
  6. </el-col>
  7. <el-col :span="12" class="bg-right">
  8. <el-button class="bg-bottom" type="primary" size="small" @click="returnsales()"><img width="6" height="10"
  9. style="vertion-align: bottom; margin-right: 3px" src="../../../public/img/lujing.png" alt="" />返回
  10. </el-button>
  11. </el-col>
  12. </el-row>
  13. <div class="center">
  14. <ws-form ref="deptBudgetList" :model="deptBudgetList">
  15. <div class="remark">
  16. <h3>基本信息</h3>
  17. <p style="color: #8890b1">
  18. &nbsp;&nbsp;注:基本信息和货物信息均为必填项,“<span style="color:red">*</span>”
  19. 标记的条目提交后不可修改。
  20. </p>
  21. </div>
  22. <!--基本信息-->
  23. <ws-info-table>
  24. <!--合同类型-->
  25. <ws-form-item label="合同类型" span="1" class="readonly">
  26. <el-radio v-model="deptBudgetList.agreementType" label="销售合同">销售合同</el-radio>
  27. <el-radio v-model="deptBudgetList.agreementType" label="补充协议">补充协议</el-radio>
  28. </ws-form-item>
  29. <!--合同编号-->
  30. <!-- v-if="deptBudgetList.agreementType == '销售合同'" -->
  31. <ws-form-item label="合同编号" span="1" prop="contractNo" class="readonly" v-if="deptBudgetList.agreementType == '销售合同'">
  32. <ws-input v-model="deptBudgetList.contractNo" placeholder="请输入合同编号" maxlength="50" size="small"
  33. :rules="ruleDeptBudget" />
  34. </ws-form-item>
  35. <!--关联合同-->
  36. <ws-form-item prop="agreementNo" label="关联合同" span="1" v-if="deptBudgetList.agreementType == '补充协议'">
  37. <ws-select v-model="deptBudgetList.agreementNo" placeholder="请选择编号" @change="selectRelation">
  38. <ws-option v-for="item in contractNoList" :key="item.constKey" :label="item.agreementNo"
  39. :value="item.contractNo"></ws-option>
  40. </ws-select>
  41. </ws-form-item>
  42. <!--补充协议编号-->
  43. <ws-form-item label="补充协议编号" span="1" prop="contractNo" class="readonly"
  44. v-if="deptBudgetList.agreementType == '补充协议'">
  45. <ws-input v-model="deptBudgetList.contractNo" placeholder="请输入补充协议编号" maxlength="50" size="small"
  46. :rules="ruleDeptBudget" />
  47. </ws-form-item>
  48. <!--买方-->
  49. <ws-form-item label="买方" span="1" prop="buyer" class="readonly">
  50. <!-- <ws-input v-model="deptBudgetList.buyer" placeholder="请输入买方名称" maxlength="100" size="small" /> -->
  51. <el-autocomplete class="inline-input" v-model="deptBudgetList.buyer" :fetch-suggestions="querySearch1"
  52. placeholder="请输入买方名称" @select="handleSelect"></el-autocomplete>
  53. </ws-form-item>
  54. <!--运输方式-->
  55. <ws-form-item label="运输方式" span="1" prop="shippingType">
  56. <ws-input v-model="deptBudgetList.shippingType" placeholder="请输入运输方式" maxlength="20" size="small" />
  57. </ws-form-item>
  58. <!--卖方-->
  59. <ws-form-item label="卖方" span="1" prop="seller" class="readonly">
  60. <!-- <ws-input v-model="deptBudgetList.seller" placeholder="请输入卖方名称" maxlength="100" size="small" /> -->
  61. <el-autocomplete class="inline-input" v-model="deptBudgetList.seller" :fetch-suggestions="querySearch2"
  62. placeholder="请输入卖方名称" @select="handleSelect"></el-autocomplete>
  63. </ws-form-item>
  64. <!--结算方式-->
  65. <ws-form-item label="结算方式" span="1" prop="settlementMethod">
  66. <ws-input v-model="deptBudgetList.settlementMethod" placeholder="请输入结算方式" maxlength="120" size="small" />
  67. </ws-form-item>
  68. <!--买方电话-->
  69. <ws-form-item label="买方电话" span="1" prop="contractNo">
  70. <!-- <ws-input v-model.number="deptBudgetList.buyerPhone" placeholder="请输入买方电话" maxlength="100" size="small" /> -->
  71. <el-autocomplete class="inline-input" v-model="deptBudgetList.buyerPhone" :fetch-suggestions="querySearch3"
  72. placeholder="请输入买方电话" @select="handleSelect"></el-autocomplete>
  73. </ws-form-item>
  74. <ws-form-item label="交货方式" span="1" prop="seller" class="readonly">
  75. <el-radio v-model="deptBudgetList.deliverType" v-if="deptBudgetList.priceType == '随行就市'" disabled label="1">
  76. 我方送货</el-radio>
  77. <el-radio v-model="deptBudgetList.deliverType" v-else label="1">我方送货</el-radio>
  78. <el-radio v-model="deptBudgetList.deliverType" v-if="deptBudgetList.priceType == '随行就市'" disabled label="2">
  79. 对方自提</el-radio>
  80. <el-radio v-model="deptBudgetList.deliverType" v-else label="2">对方自提</el-radio>
  81. </ws-form-item>
  82. <!--卖方电话-->
  83. <ws-form-item label="卖方电话" span="1" prop="sellerPhone">
  84. <!-- <ws-input v-model="deptBudgetList.sellerPhone" placeholder="请输入卖方电话" maxlength="100" size="small" /> -->
  85. <el-autocomplete class="inline-input" v-model="deptBudgetList.sellerPhone" :fetch-suggestions="querySearch4"
  86. placeholder="请输入卖方电话" @select="handleSelect"></el-autocomplete>
  87. </ws-form-item>
  88. <!--包装方式-->
  89. <ws-form-item label="包装方式" span="1" prop="packingMethod">
  90. <ws-select v-model="deptBudgetList.packingMethod" placeholder="" class="typeselect"
  91. @change="selectpackingMethod">
  92. <ws-option v-for="item in packtypeList" :key="item.constKey" :label="item.constValue"
  93. :value="item.constValue" />
  94. </ws-select>
  95. </ws-form-item>
  96. <!--重量(吨)-->
  97. <ws-form-item label="重量(吨)" span="1" prop="weight">
  98. <ws-input @input="weightchange" v-model="deptBudgetList.weight" placeholder="请输入重量(吨)" maxlength="100"
  99. size="small" />
  100. </ws-form-item>
  101. <!--验收方式-->
  102. <ws-form-item label="验收方式" span="1" prop="acceptanceMethod">
  103. <el-select v-model="deptBudgetList.acceptanceMethod" placeholder="请选择验收方式" style="width: 100%" clearable
  104. filterable @change="selectunitList">
  105. <el-option v-for="(item, index) in unitList" :key="item.constValue" :label="item.constValue"
  106. :value="item.constValue">
  107. <span class="unit-left" style="float: left">
  108. <span v-if="item.flag == 'delete'">
  109. {{ item.constValue }}</span>
  110. <!-- 新增文本框 -->
  111. <div style="width: 160px" v-if="item.flag !== 'delete'" @click.stop>
  112. <ws-input v-model="item.constValue" clearable maxlength="10" style="width: 100%"></ws-input>
  113. </div>
  114. </span>
  115. <span style="float: right; color: #8492a6; font-size: 13px">
  116. <!-- 对号 -->
  117. <i class="el-icon-check" style="line-height: 29px; margin-left: 10px" v-if="item.flag !== 'delete'"
  118. @click.stop="saveClick(item, index)"></i>
  119. <!-- 编辑 -->
  120. <i class="el-icon-edit" style="line-height: 29px; margin-left: 10px" v-if="item.flag == 'delete'"
  121. @click.stop="editClick(item, index)"></i>
  122. <!-- 删除 -->
  123. <i class="el-icon-delete" style="line-height: 29px" @click.stop="deleteClick(item, index)"></i>
  124. </span>
  125. </el-option>
  126. <!-- 新增按钮 -->
  127. <el-option value="" label="">
  128. <div style="
  129. text-align: right;
  130. border-top: 1px solid #dcdfe6;
  131. padding: 5px;
  132. ">
  133. <ws-button type="primary" @click.stop="addClick">{{
  134. $t('button.add')
  135. }}</ws-button>
  136. </div>
  137. </el-option>
  138. </el-select>
  139. </ws-form-item>
  140. <!--交货日期(起)-->
  141. <ws-form-item label="交货日期(起)" span="1" prop="deliveryDateStart">
  142. <ws-date-picker v-model="deptBudgetList.deliveryDateStart" type="date" placeholder="请选择交货日期(起)"
  143. value-format="yyyy-MM-dd" />
  144. </ws-form-item>
  145. <!--溢短装(%)-->
  146. <ws-form-item label="溢短装(%)" span="1" prop="overShort">
  147. <ws-input v-model="deptBudgetList.overShort" placeholder="请输入溢短装比例(%)" maxlength="100" size="small" />
  148. </ws-form-item>
  149. <!--交货日期(止)-->
  150. <ws-form-item label="交货日期(止)" span="1" prop="deliveryDateEnd">
  151. <ws-date-picker v-model="deptBudgetList.deliveryDateEnd" type="date" placeholder="请选择交货日期(止)"
  152. value-format="yyyy-MM-dd" />
  153. </ws-form-item>
  154. <!--价格类型-->
  155. <ws-form-item label="价格类型" span="1" prop="priceType">
  156. <ws-select v-model="deptBudgetList.priceType" placeholder="请选择价格类型" @change="selectpriceType">
  157. <ws-option v-for="item in priceTypeList" :key="item" :label="item" :value="item" />
  158. </ws-select>
  159. </ws-form-item>
  160. <!--合同单价(元/吨)-->
  161. <ws-form-item class="readonly" label="合同单价(元/吨)" span="1" prop="unitContractPrice"
  162. v-if="deptBudgetList.priceType == '定价销售'">
  163. <ws-input @input="pricechange" v-model="deptBudgetList.unitContractPrice" placeholder="请输入合同单价"
  164. maxlength="100" size="small" />
  165. </ws-form-item>
  166. <!--合同总价-->
  167. <ws-form-item label="合同总价" span="1" prop="totalContractPrice" v-if="deptBudgetList.priceType == '定价销售'">
  168. <ws-input v-model="deptBudgetList.totalContractPrice" placeholder="请输入合同总价" maxlength="100" size="small" />
  169. </ws-form-item>
  170. <!--签订日期-->
  171. <ws-form-item label="签订日期" span="1" prop="signingDate" v-if="deptBudgetList.agreementType == '补充协议'">
  172. <ws-date-picker v-model="deptBudgetList.signingDate" type="date" placeholder="请选择合同签订日期"
  173. value-format="yyyy-MM-dd" />
  174. </ws-form-item>
  175. <ws-form-item label="货源所在地区" span="1" prop="sourceGoods">
  176. <!-- <el-cascader
  177. :options="options_"
  178. v-model="selectedOptions"
  179. clearable
  180. size="large"
  181. placeholder="请选择货源所在地区"
  182. style="width: 200%"
  183. @change="handleChange"
  184. /> -->
  185. <el-button @click="mapInputClick('source')" class="address-btn">
  186. {{ newSelectedOptions }}
  187. </el-button>
  188. </ws-form-item>
  189. <ws-form-item label="货源详细地址" span="1" prop="sourceGoods">
  190. <ws-input v-model="deptBudgetList.sourceGoods" placeholder="请输入货源详细地址" maxlength="20" size="small" />
  191. </ws-form-item>
  192. <ws-form-item label="交货所在地区" span="1" prop="placeDelivery">
  193. <!-- <el-cascader
  194. :options="options_"
  195. v-model="selectedOptions1"
  196. clearable
  197. size="large"
  198. placeholder="请选择交货所在地区"
  199. style="width: 200%"
  200. @change="handleChange1"
  201. /> -->
  202. <el-button @click="mapInputClick('deliveryProv')" class="address-btn">
  203. {{ newSelectedOptions1 }}
  204. </el-button>
  205. </ws-form-item>
  206. <ws-form-item label="交货详细地址" span="1" prop="placeDelivery">
  207. <ws-input v-model="deptBudgetList.placeDelivery" placeholder="请输入交货详细地址" maxlength="20" size="small" />
  208. </ws-form-item>
  209. <!--签订日期-->
  210. <ws-form-item label="签订日期" span="1" prop="signingDate" v-if="deptBudgetList.agreementType == '销售合同'">
  211. <ws-date-picker v-model="deptBudgetList.signingDate" type="date" placeholder="请选择合同签订日期"
  212. value-format="yyyy-MM-dd" />
  213. </ws-form-item>
  214. <ws-form-item label="最终实际成交量(吨)" span="1" prop="finalTradingVolume">
  215. <ws-input v-model="deptBudgetList.finalTradingVolume" placeholder="请输入最终实际成交量" maxlength="100"
  216. size="small" />
  217. </ws-form-item>
  218. </ws-info-table>
  219. </ws-form>
  220. </div>
  221. <div class="wenzi">
  222. <h3>货物信息</h3>
  223. </div>
  224. <div class="center">
  225. <ws-form ref="deptBudgetList" :rules="ruleDeptBudget" :model="deptBudgetList">
  226. <!--货物信息-->
  227. <ws-info-table>
  228. <!--货名-->
  229. <ws-form-item label="货名" span="1" prop="goodsName" class="readonly">
  230. <ws-select v-model="deptBudgetList.contractGoodsInfo.goodsName" placeholder="" class="typeselect"
  231. @change="selectgoodsName">
  232. <ws-option v-for="item in goodnameList" :key="item.constKey" :label="item.constValue"
  233. :value="item.constValue" />
  234. </ws-select>
  235. </ws-form-item>
  236. <!--水分(%)<=-->
  237. <ws-form-item label="水分(%)<=" span="1" prop="waterContent">
  238. <ws-input v-model="deptBudgetList.contractGoodsInfo.waterContent" placeholder="请输入水分占比" maxlength="100"
  239. size="small" />
  240. </ws-form-item>
  241. <!--品级-->
  242. <ws-form-item label="品级" span="1" prop="grade" class="readonly">
  243. <ws-select v-model="deptBudgetList.contractGoodsInfo.grade" placeholder="" class="typeselect"
  244. @change="selectgrade">
  245. <ws-option v-for="item in gradeList" :key="item.constKey" :label="item.constValue"
  246. :value="item.constValue" />
  247. </ws-select>
  248. </ws-form-item>
  249. <!--杂质(%)<=-->
  250. <ws-form-item label="杂质(%)<=" span="1" prop="impurity">
  251. <ws-input v-model="deptBudgetList.contractGoodsInfo.impurity" placeholder="请输入杂质占比(%)" maxlength="40"
  252. size="small" />
  253. </ws-form-item>
  254. <!--容重(克/升)>=-->
  255. <ws-form-item label="容重(克/升)>=" span="1" prop="bulkDensity">
  256. <ws-input v-model="deptBudgetList.contractGoodsInfo.bulkDensity" placeholder="请输入容重" maxlength="40"
  257. size="small" />
  258. </ws-form-item>
  259. <!--霉变粒(%)<=-->
  260. <ws-form-item label="霉变粒(%)<=" span="1" prop="mildewGrain">
  261. <ws-input v-model="deptBudgetList.contractGoodsInfo.mildewGrain" placeholder="请输入霉变粒占比(%)" maxlength="40"
  262. size="small" />
  263. </ws-form-item>
  264. <!--热损伤(%)<=-->
  265. <ws-form-item label="热损伤(%)<=" span="1" prop="jiaorenli">
  266. <ws-input v-model="deptBudgetList.contractGoodsInfo.jiaorenli" placeholder="请输入输入热损伤占比(%)" maxlength="40"
  267. size="small" />
  268. </ws-form-item>
  269. <!--不完善粒(%)<=-->
  270. <ws-form-item label="不完善粒(%)<=" span="1" prop="imperfectGrain">
  271. <ws-input v-model="deptBudgetList.contractGoodsInfo.imperfectGrain" placeholder="请输入不完善粒占比(%)"
  272. maxlength="40" size="small" />
  273. </ws-form-item>
  274. </ws-info-table>
  275. </ws-form>
  276. </div>
  277. <div class="wenzi">
  278. <h3>流程信息</h3>
  279. </div>
  280. <div class="center">
  281. <ws-form ref="deptBudgetList" :rules="ruleDeptBudget" :model="deptBudgetList">
  282. <!--流程信息-->
  283. <ws-info-table>
  284. <!--合同收入(元)-->
  285. <ws-form-item label="合同收入(元)" span="1" prop="goodsNameKey">
  286. <ws-input v-model="deptBudgetList.contractProcessInfo.goodsNameKey" placeholder="请输入合同收入(元)" maxlength="100"
  287. size="small" />
  288. </ws-form-item>
  289. <!--已开发票(元)-->
  290. <ws-form-item label="已开发票(元)" span="1" prop="goodsName">
  291. <ws-input v-model="deptBudgetList.contractProcessInfo.goodsName" placeholder="请输入已开发票(元)" maxlength="100"
  292. size="small" />
  293. </ws-form-item>
  294. <!--费用支出(元)-->
  295. <ws-form-item label="费用支出(元)" span="1" prop="waterContent">
  296. <ws-input v-model="deptBudgetList.contractProcessInfo.waterContent" placeholder="请输入费用支出(元)" maxlength="100"
  297. size="small" />
  298. </ws-form-item>
  299. <!--未开发票(元)-->
  300. <ws-form-item label="未开发票(元)" span="1" prop="impurity">
  301. <ws-input v-model="deptBudgetList.contractProcessInfo.impurity" placeholder="请输入未开发票(元)" maxlength="100"
  302. size="small" />
  303. </ws-form-item>
  304. <!--未回款(元)-->
  305. <ws-form-item label="未回款(元)" span="1" prop="mildewGrain">
  306. <ws-input v-model="deptBudgetList.contractProcessInfo.mildewGrain" placeholder="请输入未回款(元)" maxlength="100"
  307. size="small" />
  308. </ws-form-item>
  309. <!--双章原件回收情况-->
  310. <ws-form-item label="双章原件回收情况" span="1" prop="grade">
  311. <ws-select v-model="deptBudgetList.contractProcessInfo.grade" placeholder="" class="typeselect"
  312. @change="selectpackingMethod">
  313. <ws-option v-for="item in ChapterTwoList" :key="item.constKey" :label="item.constValue"
  314. :value="item.constValue" />
  315. </ws-select>
  316. </ws-form-item>
  317. </ws-info-table>
  318. </ws-form>
  319. </div>
  320. <div class="wenzi">
  321. <h3>备注信息</h3>
  322. </div>
  323. <div class="ce">
  324. <ws-form ref="deptBudgetList" :rules="ruleDeptBudget" :model="deptBudgetList">
  325. <!--备注信息-->
  326. <ws-input v-model="deptBudgetList.remarks" type="textarea" row="3" placeholder="请输入备注信息,不超过200字"
  327. maxlength="3000" />
  328. <ws-upload ref="upload" :comp-id="compId" :appendix-ids="deptBudgetList.addressUrl" :size-limit="size"
  329. @onChange="onChange" accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar"
  330. v-hasPermission="`contractManagement.salesContract.salesContractInfo.appl`" />
  331. </ws-form>
  332. <div v-if="dialogVisible" class="map">
  333. <map-drag @marker="marker" :isShowaddress="true" v-on:addressListen="getAddress" :type="type">
  334. </map-drag>
  335. </div>
  336. </div>
  337. <div style="text-align: right; padding: 10px" class="center">
  338. <el-button class="bg-bottom" type="primary" size="small" @click="submit(deptBudgetList)">提交</el-button>
  339. </div>
  340. </div>
  341. </template>
  342. <script>
  343. import {
  344. packList,
  345. addList,
  346. xiala,
  347. addxiala,
  348. editxiala,
  349. delxiala,
  350. getRelationContractNo,
  351. } from '@/model/contarct/index'
  352. import WsUpload from '@/components/WsUpload'
  353. import {
  354. regionData,
  355. CodeToText,
  356. TextToCode
  357. } from 'element-china-area-data'
  358. import thirdPartyInspectionReportAddVue from '../system/shipInspection/thirdPartyInspectionReportAdd.vue'
  359. import mapDrag from '@/components/mapdrag/mapdrag'
  360. export default {
  361. name: 'viewSpareMoney',
  362. components: {
  363. WsUpload,
  364. mapDrag,
  365. },
  366. watch: {
  367. vesselId(val) {
  368. this.getVesselData()
  369. },
  370. isShow(val) {
  371. this.showType = val
  372. },
  373. },
  374. data() {
  375. return {
  376. restaurants1: [],
  377. restaurants2: [],
  378. restaurants3: [],
  379. restaurants4: [],
  380. //弹出框
  381. dialogViewSpareMoney: false,
  382. dialogApproveFormVisible: false,
  383. // 船舶类型
  384. monetaryKey: null,
  385. // 表格显示数据
  386. tableDate: [],
  387. // 是否显示
  388. showType: true,
  389. // 年
  390. year: '',
  391. type: '',
  392. dialogVisible: false,
  393. options_: regionData,
  394. selectedOptions: [],
  395. newSelectedOptions: '请选择货源所在地',
  396. selectedOptions1: [],
  397. newSelectedOptions1: '请选择交货所在地区',
  398. // 提交类型
  399. submitType: true,
  400. tableData: [{
  401. date: 1111,
  402. name: 'qqqq',
  403. address: 'errrtt',
  404. }, ],
  405. trainingMethods: {},
  406. packtypeList: [],
  407. compId: sessionStorage.getItem('ws-pf_compId'),
  408. mainReportAdd: {},
  409. appendixIdsAdd: '',
  410. size: 10,
  411. unitList: [],
  412. goodnameList: [],
  413. gradeList: [],
  414. ChapterTwoList: [],
  415. deptBudgetList: {
  416. deliverType: '1',
  417. agreementType: '销售合同',
  418. finalTradingVolume: 0,
  419. totalContractPrice: 0,
  420. contractGoodsInfo: {
  421. goodsName: '',
  422. },
  423. contractProcessInfo: {},
  424. addressUrl: '',
  425. sourceGoods: '',
  426. placeDelivery: '',
  427. },
  428. pickerBeginDateBefore: {
  429. disabledDate: (time) => {
  430. return time.getTime() > Date.now()
  431. },
  432. },
  433. ruleDeptBudget: {
  434. contractNo: [{
  435. required: true,
  436. message: '请输入活动名称',
  437. trigger: 'blur',
  438. },
  439. {
  440. min: 6,
  441. max: 50,
  442. message: '长度在 6 到 50 个字符',
  443. trigger: 'blur',
  444. },
  445. ],
  446. },
  447. selectIntendedShip: {},
  448. interviewTypeList: {},
  449. fileList: [],
  450. priceTypeList: ['定价销售', '随行就市'],
  451. contractNoList: [],
  452. }
  453. },
  454. activated() {
  455. //cg.viewBudget
  456. //cg.viewSpareMoney
  457. // this.getVesselData();
  458. this.newSelectedOptions = '请选择货源所在地'
  459. this.newSelectedOptions1 = '请选择交货所在地'
  460. this.deptBudgetList.packingMethod = '散装'
  461. this.deptBudgetList.packingMethodKey = 1
  462. this.deptBudgetList.contractGoodsInfo.goodsName = '玉米'
  463. this.deptBudgetList.contractGoodsInfo.goodsNameKey = 1
  464. this.deptBudgetList.contractProcessInfo.grade = '未回收'
  465. this.deptBudgetList.contractProcessInfo.gradeKey = 1
  466. this.deptBudgetList.contractGoodsInfo.grade = '一等品'
  467. this.deptBudgetList.contractGoodsInfo.gradeKey = 1
  468. this.loaddata()
  469. this.showType = this.isShow
  470. },
  471. mounted() {
  472. this.restaurants1 = JSON.parse(localStorage.getItem('deptBudgetList_data1'));
  473. this.restaurants2 = JSON.parse(localStorage.getItem('deptBudgetList_data2'));
  474. this.restaurants3 = JSON.parse(localStorage.getItem('deptBudgetList_data3'));
  475. this.restaurants4 = JSON.parse(localStorage.getItem('deptBudgetList_data4'));
  476. if (!this.restaurants1) this.restaurants1 = [];
  477. if (!this.restaurants2) this.restaurants2 = [];
  478. if (!this.restaurants3) this.restaurants3 = [];
  479. if (!this.restaurants4) this.restaurants4 = [];
  480. },
  481. methods: {
  482. querySearch1(queryString, cb) {
  483. var restaurants1 = this.restaurants1;
  484. var results = queryString ? restaurants1.filter(this.createFilter(queryString)) : restaurants1;
  485. // 调用 callback 返回建议列表的数据
  486. cb(results);
  487. },
  488. querySearch2(queryString, cb) {
  489. var restaurants2 = this.restaurants2;
  490. var results = queryString ? restaurants2.filter(this.createFilter(queryString)) : restaurants2;
  491. // 调用 callback 返回建议列表的数据
  492. cb(results);
  493. },
  494. querySearch3(queryString, cb) {
  495. var restaurants3 = this.restaurants3;
  496. var results = queryString ? restaurants3.filter(this.createFilter(queryString)) : restaurants3;
  497. // 调用 callback 返回建议列表的数据
  498. cb(results);
  499. },
  500. querySearch4(queryString, cb) {
  501. var restaurants4 = this.restaurants4;
  502. var results = queryString ? restaurants4.filter(this.createFilter(queryString)) : restaurants4;
  503. // 调用 callback 返回建议列表的数据
  504. cb(results);
  505. },
  506. createFilter(queryString) {
  507. return (restaurant) => {
  508. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  509. };
  510. },
  511. handleSelect(item) {
  512. console.log(item);
  513. },
  514. marker: function(item) {
  515. this.deptBudgetList.warehousePositioning =
  516. item.lnglat.lat + ',' + item.lnglat.lng
  517. },
  518. getAddress(data) {
  519. console.log('getAddress', data)
  520. if (data[4] == 'source') {
  521. this.newSelectedOptions = data[0] + '/' + data[1] + '/' + data[2]
  522. this.deptBudgetList.sourceProvince = data[0]
  523. this.deptBudgetList.sourceCity = data[1]
  524. this.deptBudgetList.sourceArea = data[2]
  525. this.deptBudgetList.sourceGoods = data[3]
  526. } else {
  527. this.newSelectedOptions1 = data[0] + '/' + data[1] + '/' + data[2]
  528. this.deptBudgetList.deliveryProvince = data[0]
  529. this.deptBudgetList.deliveryCity = data[1]
  530. this.deptBudgetList.deliveryArea = data[2]
  531. this.deptBudgetList.placeDelivery = data[3]
  532. }
  533. },
  534. mapInputClick(type) {
  535. this.dialogVisible = true
  536. this.type = type
  537. },
  538. blurMap() {
  539. this.dialogVisible = false
  540. },
  541. focusMap() {
  542. this.dialogVisible = true
  543. },
  544. // 关闭 dialog时 处理文件url 初始化upload组件
  545. handleClose() {
  546. this.dialogViewSpareMoney = false
  547. },
  548. handleChange(value) {
  549. this.selectedOptions = value
  550. },
  551. handleChange1(value) {
  552. this.selectedOptions1 = value
  553. },
  554. returnsales() {
  555. this.$router.push({
  556. path: 'salesContract',
  557. })
  558. },
  559. loaddata() {
  560. // 包装方式
  561. packList({
  562. constId: 'CON1',
  563. })
  564. .toPromise()
  565. .then((response) => {
  566. this.packtypeList = response
  567. })
  568. // 验收方式
  569. this.getUnitList()
  570. // 货名
  571. packList({
  572. constId: 'CON2',
  573. })
  574. .toPromise()
  575. .then((response) => {
  576. this.goodnameList = response
  577. })
  578. // 品级
  579. packList({
  580. constId: 'CON3',
  581. })
  582. .toPromise()
  583. .then((response) => {
  584. this.gradeList = response
  585. })
  586. // 双章
  587. packList({
  588. constId: 'CON4',
  589. })
  590. .toPromise()
  591. .then((response) => {
  592. this.ChapterTwoList = response
  593. })
  594. //关联合同
  595. getRelationContractNo({
  596. agreementType: '销售合同',
  597. goodsType: 1,
  598. })
  599. .toPromise()
  600. .then((response) => {
  601. this.contractNoList = response
  602. })
  603. },
  604. selectRelation(e) {
  605. for (var i = 0; i < this.contractNoList.length; i++) {
  606. if (this.contractNoList[i].contractNo == e) {
  607. this.deptBudgetList = this.contractNoList[i]
  608. this.deptBudgetList.agreementNo = this.contractNoList[i].contractNo
  609. this.deptBudgetList.contractNo = this.contractNoList[i].contractNo
  610. this.deptBudgetList.agreementType = '补充协议'
  611. this.newSelectedOptions = this.contractNoList[i].sourceProvince + this.contractNoList[i].sourceCity + this
  612. .contractNoList[i].sourceArea
  613. this.deptBudgetList.sourceGoods = this.contractNoList[i].sourceGoods
  614. this.newSelectedOptions1 = this.contractNoList[i].deliveryProvince + this.contractNoList[i].deliveryCity +
  615. this.contractNoList[i].deliveryArea
  616. this.deptBudgetList.placeDelivery = this.contractNoList[i].placeDelivery
  617. }
  618. }
  619. },
  620. onChange() {
  621. this.$refs.upload
  622. .handleSaveBill()
  623. .then(async (response) => {
  624. this.deptBudgetList.addressUrl = response
  625. })
  626. .catch((res) => {
  627. EventBus.$emit('error', (JSON.parse(res) || {}).message)
  628. this.$refs.upload.clearFiles()
  629. })
  630. },
  631. getUnitList() {
  632. xiala({
  633. compId: sessionStorage.getItem('ws-pf_compId'),
  634. constCode: 'TYPEYAN',
  635. })
  636. .toPromise()
  637. .then((response) => {
  638. this.unitList = response
  639. let currItem
  640. this.unitList.forEach((item, index, arr) => {
  641. item.flag = 'delete'
  642. if (this.vModel == item.constKey) {
  643. currItem = item
  644. }
  645. })
  646. //
  647. if (currItem) {
  648. this.selectContract(currItem.constValue)
  649. }
  650. })
  651. },
  652. submit() {
  653. if (!this.deptBudgetList.contractNo) {
  654. this.$message({
  655. message: '合同编号不能为空',
  656. type: 'warning',
  657. })
  658. return
  659. }
  660. if (
  661. this.deptBudgetList.contractNo.length < 6 ||
  662. this.deptBudgetList.contractNo.length > 50
  663. ) {
  664. this.$message({
  665. message: '合同编号长度不符合要求,请输入6到50个字符之内!',
  666. type: 'warning',
  667. })
  668. return
  669. }
  670. if (!this.deptBudgetList.shippingType) {
  671. this.$message({
  672. message: '运输方式不能为空',
  673. type: 'warning',
  674. })
  675. return
  676. }
  677. if (
  678. this.deptBudgetList.shippingType.length < 1 ||
  679. this.deptBudgetList.shippingType.length > 20
  680. ) {
  681. this.$message({
  682. message: '运输方式长度不符合要求,请输入1到20个字符之内!',
  683. type: 'warning',
  684. })
  685. return
  686. }
  687. if (!this.deptBudgetList.buyer) {
  688. this.$message({
  689. message: '买方名称不能为空',
  690. type: 'warning',
  691. })
  692. return
  693. }
  694. if (this.deptBudgetList.buyer.length > 30) {
  695. this.$message({
  696. message: '买方名称长度不符合要求,请输入30个字符之内!',
  697. type: 'warning',
  698. })
  699. return
  700. }
  701. if (!this.deptBudgetList.settlementMethod) {
  702. this.$message({
  703. message: '结算方式不能为空',
  704. type: 'warning',
  705. })
  706. return
  707. }
  708. if (
  709. this.deptBudgetList.settlementMethod.length < 1 ||
  710. this.deptBudgetList.settlementMethod.length > 20
  711. ) {
  712. this.$message({
  713. message: '结算方式长度不符合要求,请输入1到20个字符之内!',
  714. type: 'warning',
  715. })
  716. return
  717. }
  718. if (!this.deptBudgetList.seller) {
  719. this.$message({
  720. message: '请输入卖方名称!',
  721. type: 'warning',
  722. })
  723. return
  724. }
  725. if (this.deptBudgetList.seller.length > 30) {
  726. this.$message({
  727. message: '卖方名称长度不符合要求,请输入30个字符之内!',
  728. type: 'warning',
  729. })
  730. return
  731. }
  732. if (!this.deptBudgetList.buyerPhone) {
  733. this.$message({
  734. message: '请输入买方电话!',
  735. type: 'warning',
  736. })
  737. return
  738. }
  739. if (isNaN(this.deptBudgetList.buyerPhone)) {
  740. this.$message({
  741. message: '输入买方电话有误!',
  742. type: 'warning',
  743. })
  744. return
  745. }
  746. if (
  747. this.deptBudgetList.buyerPhone.length < 7 ||
  748. this.deptBudgetList.buyerPhone.length > 20
  749. ) {
  750. this.$message({
  751. message: '买方电话长度不符合要求,请输入7到20个字符之内!',
  752. type: 'warning',
  753. })
  754. return
  755. }
  756. if (!this.deptBudgetList.sellerPhone) {
  757. this.$message({
  758. message: '请输入卖方电话!',
  759. type: 'warning',
  760. })
  761. return
  762. }
  763. if (isNaN(this.deptBudgetList.sellerPhone)) {
  764. this.$message({
  765. message: '输入卖方电话有误!',
  766. type: 'warning',
  767. })
  768. return
  769. }
  770. if (
  771. this.deptBudgetList.sellerPhone.length < 7 ||
  772. this.deptBudgetList.sellerPhone.length > 20
  773. ) {
  774. this.$message({
  775. message: '卖方电话长度不符合要求,请输入7到20个字符之内!',
  776. type: 'warning',
  777. })
  778. return
  779. }
  780. if (!this.deptBudgetList.acceptanceMethod) {
  781. this.$message({
  782. message: '请选择验收方式',
  783. type: 'warning',
  784. })
  785. return
  786. }
  787. if (!this.deptBudgetList.weight) {
  788. this.$message({
  789. message: '请输入重量!',
  790. type: 'warning',
  791. })
  792. return
  793. }
  794. if (
  795. isNaN(this.deptBudgetList.weight) ||
  796. (String(this.deptBudgetList.weight).indexOf('.') != -1 &&
  797. String(this.deptBudgetList.weight).length -
  798. (String(this.deptBudgetList.weight).indexOf('.') + 1) >
  799. 3) ||
  800. this.deptBudgetList.weight < 0 ||
  801. this.deptBudgetList.weight > 200000
  802. ) {
  803. this.$message({
  804. message: '输入重量有误!',
  805. type: 'warning',
  806. })
  807. return
  808. }
  809. if (!this.deptBudgetList.deliveryDateStart) {
  810. this.$message({
  811. message: '请选择交货日期(起)',
  812. type: 'warning',
  813. })
  814. return
  815. }
  816. if (!this.deptBudgetList.overShort) {
  817. this.$message({
  818. message: '请输入溢短装!',
  819. type: 'warning',
  820. })
  821. return
  822. }
  823. if (
  824. isNaN(this.deptBudgetList.overShort) ||
  825. (String(this.deptBudgetList.overShort).indexOf('.') != -1 &&
  826. String(this.deptBudgetList.overShort).length -
  827. (String(this.deptBudgetList.overShort).indexOf('.') + 1) >
  828. 2) ||
  829. this.deptBudgetList.overShort < 0 ||
  830. this.deptBudgetList.overShort > 50
  831. ) {
  832. this.$message({
  833. message: '溢短装输入有误!',
  834. type: 'warning',
  835. })
  836. return
  837. }
  838. if (!this.deptBudgetList.deliveryDateEnd) {
  839. this.$message({
  840. message: '请选择交货日期(止)',
  841. type: 'warning',
  842. })
  843. return
  844. }
  845. //时间
  846. if (
  847. new Date(this.deptBudgetList.deliveryDateStart).getTime() >
  848. new Date(this.deptBudgetList.deliveryDateEnd).getTime()
  849. ) {
  850. this.$message({
  851. message: '交货日期(止)选择错误',
  852. type: 'warning',
  853. })
  854. return
  855. }
  856. if (!this.deptBudgetList.priceType) {
  857. this.$message({
  858. message: '请选择价格类型',
  859. type: 'warning',
  860. })
  861. return
  862. }
  863. if (this.deptBudgetList.priceType == '定价销售') {
  864. if (!this.deptBudgetList.unitContractPrice) {
  865. this.$message({
  866. message: '请输入合同单价!',
  867. type: 'warning',
  868. })
  869. return
  870. }
  871. if (
  872. isNaN(this.deptBudgetList.unitContractPrice) ||
  873. (String(this.deptBudgetList.unitContractPrice).indexOf('.') != -1 &&
  874. String(this.deptBudgetList.unitContractPrice).length -
  875. (String(this.deptBudgetList.unitContractPrice).indexOf('.') + 1) >
  876. 2) ||
  877. this.deptBudgetList.unitContractPrice <= 0 ||
  878. this.deptBudgetList.unitContractPrice > 10000
  879. ) {
  880. this.$message({
  881. message: '合同单价输入有误!',
  882. type: 'warning',
  883. })
  884. return
  885. }
  886. if (!this.deptBudgetList.totalContractPrice) {
  887. this.$message({
  888. message: '请输入合同总价!',
  889. type: 'warning',
  890. })
  891. return
  892. }
  893. if (
  894. isNaN(this.deptBudgetList.totalContractPrice) ||
  895. (String(this.deptBudgetList.totalContractPrice).indexOf('.') != -1 &&
  896. String(this.deptBudgetList.totalContractPrice).length -
  897. (String(this.deptBudgetList.totalContractPrice).indexOf('.') +
  898. 1) >
  899. 2) ||
  900. this.deptBudgetList.totalContractPrice <= 0 ||
  901. this.deptBudgetList.totalContractPrice > 1000000000
  902. ) {
  903. this.$message({
  904. message: '合同总价输入有误!',
  905. type: 'warning',
  906. })
  907. return
  908. }
  909. }
  910. if (!this.newSelectedOptions) {
  911. this.$message({
  912. message: '请选择货源所在地区!',
  913. type: 'warning',
  914. })
  915. return
  916. }
  917. if (!this.deptBudgetList.sourceGoods) {
  918. this.$message({
  919. message: '请输入货源详细地址!',
  920. type: 'warning',
  921. })
  922. return
  923. }
  924. if (!this.newSelectedOptions1) {
  925. this.$message({
  926. message: '请选择交货所在地区!',
  927. type: 'warning',
  928. })
  929. return
  930. }
  931. if (!this.deptBudgetList.placeDelivery) {
  932. this.$message({
  933. message: '请输入交货详细地址!',
  934. type: 'warning',
  935. })
  936. return
  937. }
  938. if (!this.deptBudgetList.signingDate) {
  939. this.$message({
  940. message: '请选择签订日期',
  941. type: 'warning',
  942. })
  943. return
  944. }
  945. if (
  946. isNaN(this.deptBudgetList.finalTradingVolume) ||
  947. (String(this.deptBudgetList.finalTradingVolume).indexOf('.') != -1 &&
  948. String(this.deptBudgetList.finalTradingVolume).length -
  949. (String(this.deptBudgetList.finalTradingVolume).indexOf('.') + 1) >
  950. 3) ||
  951. this.deptBudgetList.finalTradingVolume < 0 ||
  952. this.deptBudgetList.finalTradingVolume > 200000
  953. ) {
  954. this.$message({
  955. message: '最终实际成交量有误!',
  956. type: 'warning',
  957. })
  958. return
  959. }
  960. //货物信息
  961. if (!this.deptBudgetList.contractGoodsInfo.goodsName) {
  962. this.$message({
  963. message: '请选择货名',
  964. type: 'warning',
  965. })
  966. return
  967. }
  968. if (!this.deptBudgetList.contractGoodsInfo.waterContent) {
  969. this.$message({
  970. message: '请输入水分',
  971. type: 'warning',
  972. })
  973. return
  974. }
  975. if (
  976. (this.deptBudgetList.contractGoodsInfo.waterContent &&
  977. String(this.deptBudgetList.contractGoodsInfo.waterContent).indexOf(
  978. '.'
  979. ) != -1 &&
  980. String(this.deptBudgetList.contractGoodsInfo.waterContent).length -
  981. (String(this.deptBudgetList.contractGoodsInfo.waterContent).indexOf(
  982. '.'
  983. ) +
  984. 1) >
  985. 2) ||
  986. this.deptBudgetList.contractGoodsInfo.waterContent > 40 ||
  987. this.deptBudgetList.contractGoodsInfo.waterContent < 0
  988. ) {
  989. this.$message({
  990. message: '水分输入错误',
  991. type: 'warning',
  992. })
  993. return
  994. }
  995. if (!this.deptBudgetList.contractGoodsInfo.grade) {
  996. this.$message({
  997. message: '请选择品级',
  998. type: 'warning',
  999. })
  1000. return
  1001. }
  1002. if (!this.deptBudgetList.contractGoodsInfo.impurity) {
  1003. this.$message({
  1004. message: '请输入杂质',
  1005. type: 'warning',
  1006. })
  1007. return
  1008. }
  1009. if (
  1010. (this.deptBudgetList.contractGoodsInfo.impurity &&
  1011. String(this.deptBudgetList.contractGoodsInfo.impurity).indexOf('.') !=
  1012. -1 &&
  1013. String(this.deptBudgetList.contractGoodsInfo.impurity).length -
  1014. (String(this.deptBudgetList.contractGoodsInfo.impurity).indexOf(
  1015. '.'
  1016. ) +
  1017. 1) >
  1018. 2) ||
  1019. this.deptBudgetList.contractGoodsInfo.impurity > 40 ||
  1020. this.deptBudgetList.contractGoodsInfo.impurity < 0
  1021. ) {
  1022. this.$message({
  1023. message: '杂质输入错误',
  1024. type: 'warning',
  1025. })
  1026. return
  1027. }
  1028. if (!this.deptBudgetList.contractGoodsInfo.bulkDensity) {
  1029. this.$message({
  1030. message: '请输入容重',
  1031. type: 'warning',
  1032. })
  1033. return
  1034. }
  1035. if (
  1036. (this.deptBudgetList.contractGoodsInfo.bulkDensity &&
  1037. String(this.deptBudgetList.contractGoodsInfo.bulkDensity).indexOf(
  1038. '.'
  1039. ) != -1 &&
  1040. String(this.deptBudgetList.contractGoodsInfo.bulkDensity).length -
  1041. (String(this.deptBudgetList.contractGoodsInfo.bulkDensity).indexOf(
  1042. '.'
  1043. ) +
  1044. 1) >
  1045. 2) ||
  1046. this.deptBudgetList.contractGoodsInfo.bulkDensity > 1000 ||
  1047. this.deptBudgetList.contractGoodsInfo.bulkDensity < 0
  1048. ) {
  1049. this.$message({
  1050. message: '容重输入错误',
  1051. type: 'warning',
  1052. })
  1053. return
  1054. }
  1055. if (!this.deptBudgetList.contractGoodsInfo.mildewGrain) {
  1056. this.$message({
  1057. message: '请输入霉变粒',
  1058. type: 'warning',
  1059. })
  1060. return
  1061. }
  1062. if (
  1063. !this.deptBudgetList.contractGoodsInfo.mildewGrain ||
  1064. (String(this.deptBudgetList.contractGoodsInfo.mildewGrain).indexOf(
  1065. '.'
  1066. ) != -1 &&
  1067. String(this.deptBudgetList.contractGoodsInfo.mildewGrain).length -
  1068. (String(this.deptBudgetList.contractGoodsInfo.mildewGrain).indexOf(
  1069. '.'
  1070. ) +
  1071. 1) >
  1072. 2) ||
  1073. this.deptBudgetList.contractGoodsInfo.mildewGrain > 40 ||
  1074. this.deptBudgetList.contractGoodsInfo.mildewGrain < 0
  1075. ) {
  1076. this.$message({
  1077. message: '霉变粒输入错误',
  1078. type: 'warning',
  1079. })
  1080. return
  1081. }
  1082. if (!this.deptBudgetList.contractGoodsInfo.jiaorenli) {
  1083. this.$message({
  1084. message: '请输入热损伤',
  1085. type: 'warning',
  1086. })
  1087. return
  1088. }
  1089. if (
  1090. !this.deptBudgetList.contractGoodsInfo.jiaorenli ||
  1091. (String(this.deptBudgetList.contractGoodsInfo.jiaorenli).indexOf('.') !=
  1092. -1 &&
  1093. String(this.deptBudgetList.contractGoodsInfo.jiaorenli).length -
  1094. (String(this.deptBudgetList.contractGoodsInfo.jiaorenli).indexOf(
  1095. '.'
  1096. ) +
  1097. 1) >
  1098. 2) ||
  1099. this.deptBudgetList.contractGoodsInfo.jiaorenli > 40 ||
  1100. this.deptBudgetList.contractGoodsInfo.jiaorenli < 0
  1101. ) {
  1102. this.$message({
  1103. message: '热损伤输入错误',
  1104. type: 'warning',
  1105. })
  1106. return
  1107. }
  1108. if (!this.deptBudgetList.contractGoodsInfo.imperfectGrain) {
  1109. this.$message({
  1110. message: '请输入不完善粒',
  1111. type: 'warning',
  1112. })
  1113. return
  1114. }
  1115. if (
  1116. !this.deptBudgetList.contractGoodsInfo.imperfectGrain ||
  1117. (String(this.deptBudgetList.contractGoodsInfo.imperfectGrain).indexOf(
  1118. '.'
  1119. ) != -1 &&
  1120. String(this.deptBudgetList.contractGoodsInfo.imperfectGrain).length -
  1121. (String(
  1122. this.deptBudgetList.contractGoodsInfo.imperfectGrain
  1123. ).indexOf('.') +
  1124. 1) >
  1125. 2) ||
  1126. this.deptBudgetList.contractGoodsInfo.imperfectGrain > 40 ||
  1127. this.deptBudgetList.contractGoodsInfo.imperfectGrain < 0
  1128. ) {
  1129. this.$message({
  1130. message: '不完善粒输入错误',
  1131. type: 'warning',
  1132. })
  1133. return
  1134. }
  1135. if(this.deptBudgetList.contractProcessInfo.goodsNameKey ){
  1136. if (
  1137. !this.deptBudgetList.contractProcessInfo.goodsNameKey > 1000000000 ||
  1138. this.deptBudgetList.contractProcessInfo.goodsNameKey < 100 ||
  1139. (String(this.deptBudgetList.contractProcessInfo.goodsNameKey).indexOf(
  1140. '.'
  1141. ) != -1 &&
  1142. String(this.deptBudgetList.contractProcessInfo.goodsNameKey).length -
  1143. (String(
  1144. this.deptBudgetList.contractProcessInfo.goodsNameKey
  1145. ).indexOf('.') +
  1146. 1) >
  1147. 2)
  1148. ) {
  1149. this.$message({
  1150. message: '合同收入金额输入错误',
  1151. type: 'warning',
  1152. })
  1153. return
  1154. }
  1155. }
  1156. if (
  1157. this.deptBudgetList.contractProcessInfo.waterContent > 10000000 ||
  1158. this.deptBudgetList.contractProcessInfo.waterContent < 0 ||
  1159. (String(this.deptBudgetList.contractProcessInfo.waterContent).indexOf(
  1160. '.'
  1161. ) != -1 &&
  1162. String(this.deptBudgetList.contractProcessInfo.waterContent).length -
  1163. (String(
  1164. this.deptBudgetList.contractProcessInfo.waterContent
  1165. ).indexOf('.') +
  1166. 1) >
  1167. 2)
  1168. ) {
  1169. this.$message({
  1170. message: '费用支出输入错误',
  1171. type: 'warning',
  1172. })
  1173. return
  1174. }
  1175. if (
  1176. (this.deptBudgetList.contractProcessInfo.goodsName > 1000000000) |
  1177. (this.deptBudgetList.contractProcessInfo.goodsName < 0) ||
  1178. (String(this.deptBudgetList.contractProcessInfo.goodsName).indexOf(
  1179. '.'
  1180. ) != -1 &&
  1181. String(this.deptBudgetList.contractProcessInfo.goodsName).length -
  1182. (String(this.deptBudgetList.contractProcessInfo.goodsName).indexOf(
  1183. '.'
  1184. ) +
  1185. 1) >
  1186. 2)
  1187. ) {
  1188. this.$message({
  1189. message: '已开发票金额输入错误',
  1190. type: 'warning',
  1191. })
  1192. return
  1193. }
  1194. if (
  1195. (this.deptBudgetList.contractProcessInfo.impurity > 1000000000) |
  1196. (this.deptBudgetList.contractProcessInfo.impurity < 0) ||
  1197. (String(this.deptBudgetList.contractProcessInfo.impurity).indexOf(
  1198. '.'
  1199. ) != -1 &&
  1200. String(this.deptBudgetList.contractProcessInfo.impurity).length -
  1201. (String(this.deptBudgetList.contractProcessInfo.impurity).indexOf(
  1202. '.'
  1203. ) +
  1204. 1) >
  1205. 2)
  1206. ) {
  1207. this.$message({
  1208. message: '未开发票金额输入错误',
  1209. type: 'warning',
  1210. })
  1211. return
  1212. }
  1213. if (
  1214. (!this.deptBudgetList.contractProcessInfo.mildewGrain > 1000000000) |
  1215. (this.deptBudgetList.contractProcessInfo.mildewGrain < 0) ||
  1216. (String(this.deptBudgetList.contractProcessInfo.mildewGrain).indexOf(
  1217. '.'
  1218. ) != -1 &&
  1219. String(this.deptBudgetList.contractProcessInfo.mildewGrain).length -
  1220. (String(
  1221. this.deptBudgetList.contractProcessInfo.mildewGrain
  1222. ).indexOf('.') +
  1223. 1) >
  1224. 2)
  1225. ) {
  1226. this.$message({
  1227. message: '未回款金额输入错误',
  1228. type: 'warning',
  1229. })
  1230. return
  1231. }
  1232. this.$refs.deptBudgetList.validate((valid) => {
  1233. if (valid) {
  1234. this.deptBudgetList.compId = this.compId
  1235. this.deptBudgetList.contractType = 1
  1236. this.deptBudgetList.goodsType = 1
  1237. addList(this.deptBudgetList)
  1238. .toPromise()
  1239. .then((response) => {
  1240. // 存储买方、卖方、买方电话、卖方电话
  1241. let _data = {
  1242. byer: this.deptBudgetList.buyer,
  1243. seller: this.deptBudgetList.seller,
  1244. buyerPhone: this.deptBudgetList.buyerPhone,
  1245. sellerPhone: this.deptBudgetList.sellerPhone
  1246. }
  1247. if (this.restaurants1.length <= 20) {
  1248. this.restaurants1 = this.restaurants1.filter(function(val) {
  1249. if (val.value != _data.byer) {
  1250. return val
  1251. }
  1252. })
  1253. this.restaurants1.unshift({
  1254. value: _data.byer
  1255. })
  1256. } else {
  1257. this.restaurants1.unshift({
  1258. value: _data.byer
  1259. }).pop({
  1260. value: _data.byer
  1261. })
  1262. }
  1263. localStorage.setItem('deptBudgetList_data1', JSON.stringify(this.restaurants1));
  1264. if (this.restaurants2.length <= 20) {
  1265. this.restaurants2 = this.restaurants2.filter(function(val) {
  1266. if (val.value != _data.seller) {
  1267. return val
  1268. }
  1269. })
  1270. this.restaurants2.unshift({
  1271. value: _data.seller
  1272. })
  1273. } else {
  1274. this.restaurants2.unshift({
  1275. value: _data.seller
  1276. }).pop({
  1277. value: _data.seller
  1278. })
  1279. }
  1280. localStorage.setItem('deptBudgetList_data2', JSON.stringify(this.restaurants2));
  1281. if (this.restaurants2.length <= 20) {
  1282. this.restaurants3 = this.restaurants3.filter(function(val) {
  1283. if (val.value != _data.buyerPhone) {
  1284. return val
  1285. }
  1286. })
  1287. this.restaurants3.unshift({
  1288. value: _data.buyerPhone
  1289. })
  1290. } else {
  1291. this.restaurants3.unshift({
  1292. value: _data.buyerPhone
  1293. }).pop({
  1294. value: _data.buyerPhone
  1295. })
  1296. }
  1297. localStorage.setItem('deptBudgetList_data3', JSON.stringify(this.restaurants3));
  1298. if (this.restaurants4.length <= 20) {
  1299. this.restaurants4 = this.restaurants3.filter(function(val) {
  1300. if (val.value != _data.sellerPhone) {
  1301. return val
  1302. }
  1303. })
  1304. this.restaurants4.unshift({
  1305. value: _data.sellerPhone
  1306. })
  1307. } else {
  1308. this.restaurants4.unshift({
  1309. value: _data.sellerPhone
  1310. }).pop({
  1311. value: _data.sellerPhone
  1312. })
  1313. }
  1314. localStorage.setItem('deptBudgetList_data4', JSON.stringify(this.restaurants4));
  1315. this.$message.success('添加成功')
  1316. this.deptBudgetList = {
  1317. deliverType: '1',
  1318. agreementType: '销售合同',
  1319. finalTradingVolume: 0,
  1320. totalContractPrice: 0,
  1321. contractGoodsInfo: {
  1322. goodsName: '',
  1323. },
  1324. contractProcessInfo: {},
  1325. }
  1326. this.$router.push({
  1327. path: 'salesContract',
  1328. })
  1329. })
  1330. } else {
  1331. EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
  1332. return false
  1333. }
  1334. })
  1335. },
  1336. resetForm(deptBudgetList) {
  1337. this.$refs[deptBudgetList].resetFields()
  1338. },
  1339. saveClick(item, index) {
  1340. console.log(item)
  1341. if (Object.is(item.id, 1)) {
  1342. return
  1343. }
  1344. if (Object.is(this.unitList[index].flag, 'delete')) {
  1345. this.$set(this.unitList, index, {
  1346. flag: 'check',
  1347. })
  1348. } else {
  1349. this.$set(this.unitList, index, {
  1350. flag: 'delete',
  1351. })
  1352. }
  1353. if (!item.constValue) {
  1354. this.unitList.splice(index, 1)
  1355. return
  1356. }
  1357. if (item.flag == 'add') {
  1358. item.constKey = Math.random() * 20
  1359. this.trainingMethods.compId = sessionStorage.getItem('ws-pf_compId')
  1360. this.trainingMethods.constKey = item.constKey
  1361. this.trainingMethods.constCode = 'TYPEYAN'
  1362. this.trainingMethods.constValue = item.constValue
  1363. this.trainingMethods.id = item.id
  1364. addxiala(this.trainingMethods)
  1365. .toPromise()
  1366. .then((response) => {
  1367. this.getUnitList()
  1368. })
  1369. } else if (item.flag == 'check') {
  1370. this.trainingMethods.compId = sessionStorage.getItem('ws-pf_compId')
  1371. this.trainingMethods.constKey = item.constKey
  1372. this.trainingMethods.constCode = 'TYPEYAN'
  1373. this.trainingMethods.constValue = item.constValue
  1374. this.trainingMethods.id = item.id
  1375. editxiala(this.trainingMethods)
  1376. .toPromise()
  1377. .then((response) => {
  1378. this.getUnitList()
  1379. })
  1380. }
  1381. },
  1382. handleExamine() {},
  1383. approve() {},
  1384. addClick() {
  1385. this.unitList.push({
  1386. flag: 'add',
  1387. constValue: '',
  1388. constKey: '',
  1389. })
  1390. },
  1391. selectChapterTwo(e) {
  1392. for (var i = 0; i < this.ChapterTwoList.length; i++) {
  1393. if (this.ChapterTwoList[i].constValue == e) {
  1394. this.deptBudgetList.gradeKey = this.ChapterTwoList[i].constKey
  1395. }
  1396. }
  1397. },
  1398. selectunitList(e) {
  1399. for (var i = 0; i < this.unitList.length; i++) {
  1400. if (this.unitList[i].constValue == e) {
  1401. this.deptBudgetList.packingMethodKey = this.unitList[i].constKey
  1402. }
  1403. }
  1404. },
  1405. selectgrade(e) {
  1406. for (var i = 0; i < this.gradeList.length; i++) {
  1407. if (this.gradeList[i].constValue == e) {
  1408. this.deptBudgetList.gradeKey = this.gradeList[i].constKey
  1409. this.deptBudgetList.contractGoodsInfo.gradeKey =
  1410. this.gradeList[i].constKey
  1411. }
  1412. }
  1413. },
  1414. selectgoodsName(e) {
  1415. for (var i = 0; i < this.goodnameList.length; i++) {
  1416. if (this.goodnameList[i].constValue == e) {
  1417. this.deptBudgetList.goodsNameKey = this.goodnameList[i].constKey
  1418. this.deptBudgetList.contractGoodsInfo.goodsNameKey =
  1419. this.goodnameList[i].constKey
  1420. }
  1421. }
  1422. },
  1423. selectpackingMethod(e) {
  1424. for (var i = 0; i < this.packtypeList.length; i++) {
  1425. if (this.packtypeList[i].constValue == e) {
  1426. this.deptBudgetList.acceptanceMethodKey =
  1427. this.packtypeList[i].constKey
  1428. }
  1429. }
  1430. },
  1431. selectpriceType(e) {
  1432. if (e == '随行就市') {
  1433. this.deptBudgetList.deliverType = '1'
  1434. }
  1435. },
  1436. weightchange(e) {
  1437. this.deptBudgetList.finalTradingVolume = e
  1438. },
  1439. pricechange(e) {
  1440. this.deptBudgetList.totalContractPrice = e * this.deptBudgetList.weight
  1441. },
  1442. // 编辑
  1443. editClick(item, index) {
  1444. const map = JSON.parse(JSON.stringify(item))
  1445. if (Object.is(item.id, 1)) {
  1446. return
  1447. }
  1448. if (Object.is(this.unitList[index].flag, 'delete')) {
  1449. map.flag = 'check'
  1450. this.$set(this.unitList, index, map)
  1451. } else {
  1452. map.flag = 'delete'
  1453. this.$set(this.unitList, index, map)
  1454. }
  1455. },
  1456. // 删除
  1457. deleteClick(item, index) {
  1458. if (Object.is(item.constKey, 1)) {
  1459. return
  1460. }
  1461. if (!item.constValue) {
  1462. this.unitList.splice(index, 1)
  1463. return
  1464. }
  1465. delxiala({
  1466. id: this.unitList[index].id,
  1467. })
  1468. .toPromise()
  1469. .then((response) => {
  1470. this.getUnitList()
  1471. this.pleaseChoose = ''
  1472. })
  1473. },
  1474. },
  1475. }
  1476. </script>
  1477. <style lang="scss" scoped>
  1478. /deep/.ws-info-table .el-form-item .el-form-item__content {
  1479. padding: 0 25px;
  1480. }
  1481. /deep/.ws-info-table .el-form-item {
  1482. border-right: 1px solid #cdd2dc;
  1483. border-bottom: 1px solid #cdd2dc;
  1484. }
  1485. .title {
  1486. position: relative;
  1487. }
  1488. .title::before {
  1489. content: '';
  1490. display: inline-block;
  1491. width: 5px;
  1492. height: 30px;
  1493. background: #5473e8;
  1494. position: absolute;
  1495. left: 0;
  1496. }
  1497. .el-button--primary {
  1498. background-color: #5878e8;
  1499. border-color: #5878e8;
  1500. }
  1501. .upload-demo {
  1502. margin-top: 10px;
  1503. }
  1504. .el-col {
  1505. background: #f6f7fc;
  1506. }
  1507. .readonly {
  1508. position: relative;
  1509. }
  1510. .readonly:after {
  1511. content: '*';
  1512. color: #ff2727;
  1513. position: absolute;
  1514. right: 8px;
  1515. z-index: 10;
  1516. top: 21%;
  1517. font-size: 20px;
  1518. }
  1519. /deep/.ws-info-table .el-form-item .el-form-item__content {
  1520. padding: 0 25px;
  1521. border-left: 1px solid #cdd2dc;
  1522. background: #fafbfc;
  1523. }
  1524. /deep/.ws-info-table .el-form-item .el-form-item__label {
  1525. width: 140px;
  1526. text-align: center;
  1527. background: #f0f2f6;
  1528. // border: 1px solid #cdd2dc;
  1529. }
  1530. .button-container {
  1531. display: flex;
  1532. flex-wrap: nowrap;
  1533. justify-content: space-between;
  1534. align-items: center;
  1535. background-color: #fff;
  1536. width: 100%;
  1537. height: 50px;
  1538. padding: 0 10px;
  1539. &>div {
  1540. margin-left: 10px;
  1541. display: flex;
  1542. flex-wrap: nowrap;
  1543. flex-direction: row;
  1544. &>span {
  1545. line-height: 50px;
  1546. }
  1547. }
  1548. /deep/.auditFlow-box {
  1549. position: unset;
  1550. margin-left: 10px;
  1551. &/deep/.auditFlow-icon {
  1552. width: auto;
  1553. padding-right: 30px;
  1554. }
  1555. &/deep/.auditFlow-main {
  1556. position: absolute;
  1557. }
  1558. }
  1559. }
  1560. .box-app {
  1561. display: inline-block;
  1562. float: left;
  1563. margin-left: 30px;
  1564. line-height: 50px;
  1565. }
  1566. /deep/.el-dialog {
  1567. .el-form-item {
  1568. margin-bottom: 0 !important;
  1569. .el-input--medium {
  1570. textarea {
  1571. min-height: 100px !important;
  1572. }
  1573. }
  1574. }
  1575. }
  1576. .collapse-bottom {
  1577. margin-bottom: 20px;
  1578. }
  1579. .input-main .textarea .el-textarea__inner {
  1580. width: 100%;
  1581. z-index: 1;
  1582. }
  1583. .bg-left {
  1584. padding-left: 30px;
  1585. }
  1586. .bg-right {
  1587. padding-right: 10px;
  1588. text-align: right;
  1589. }
  1590. .bg-bottom {
  1591. margin: 16px 0px;
  1592. }
  1593. .wenzi {
  1594. width: 70%;
  1595. margin: 0 auto;
  1596. }
  1597. .wenzi h3 {
  1598. display: inline-block;
  1599. left: 10px;
  1600. }
  1601. .wenzi p {
  1602. display: inline-block;
  1603. }
  1604. .center {
  1605. width: 70%;
  1606. margin: 0 auto;
  1607. }
  1608. .el-form-item {
  1609. width: 50%;
  1610. }
  1611. .el-form-item__label {
  1612. text-align: center;
  1613. }
  1614. .ce {
  1615. width: 70%;
  1616. margin: 0 auto;
  1617. }
  1618. /*.crt-main .textarea /deep/ .el-form-item__label {*/
  1619. /* height: 82px;*/
  1620. /*}*/
  1621. // 控制select为只读的时候显示样式
  1622. .hide-sel {
  1623. .el-input__inner {
  1624. border: 0px;
  1625. }
  1626. .el-icon-arrow-up {
  1627. display: none;
  1628. }
  1629. .el-textarea__inner {
  1630. background-color: #fff !important;
  1631. border: 0;
  1632. }
  1633. .el-date-editor {
  1634. i {
  1635. display: none;
  1636. }
  1637. }
  1638. .is-disabled {
  1639. .el-input__inner:hover {
  1640. background-color: #fff !important;
  1641. border: 0;
  1642. }
  1643. color: #606266;
  1644. .el-input__inner {
  1645. background-color: #fff !important;
  1646. border: 0;
  1647. color: #606266;
  1648. }
  1649. .el-textarea__inner {
  1650. background-color: #fff !important;
  1651. border: 0;
  1652. color: #606266;
  1653. }
  1654. }
  1655. }
  1656. /deep/.ws-info-table .el-form-item .el-form-item__label {
  1657. width: 130px;
  1658. }
  1659. //*号
  1660. .unchangeable {
  1661. position: absolute;
  1662. width: 9px;
  1663. height: 22px;
  1664. font-size: 16px;
  1665. font-family: PingFangSC-Medium, PingFang SC;
  1666. font-weight: 500;
  1667. color: #ff2727;
  1668. line-height: 22px;
  1669. display: inline-block;
  1670. right: 14px;
  1671. }
  1672. /deep/.el-input,
  1673. /deep/.el-date-editor {
  1674. font-size: 13px;
  1675. }
  1676. /deep/.el-textarea {
  1677. width: 101%;
  1678. margin: 0px;
  1679. }
  1680. /deep/el-date-editor--date {
  1681. width: 200px;
  1682. }
  1683. .unchanged {
  1684. position: absolute;
  1685. left: 37px;
  1686. width: 102px;
  1687. height: 14px;
  1688. font-size: 14px;
  1689. font-family: PingFangSC-Regular, PingFang SC;
  1690. font-weight: 400;
  1691. color: #afb5cb;
  1692. line-height: 14px;
  1693. }
  1694. /deep/.el-input--small .el-input__inner {
  1695. height: 32px;
  1696. line-height: 32px;
  1697. }
  1698. // 控制select为只读的时候显示样式
  1699. /deep/.ws-class-table-col {
  1700. height: auto;
  1701. padding: 0px 2px;
  1702. /deep/.el-input__inner {
  1703. padding: 0px 2px;
  1704. }
  1705. }
  1706. /deep/.is-disabled {
  1707. .el-input__prefix,
  1708. .el-input__suffix {
  1709. display: none;
  1710. }
  1711. .el-input__inner {
  1712. background-color: #fff;
  1713. border-color: #fff !important;
  1714. color: #000 !important;
  1715. font-size: 14px;
  1716. cursor: text;
  1717. padding: 0 !important;
  1718. }
  1719. }
  1720. .winseaview-view {
  1721. padding: 0 0 20px;
  1722. }
  1723. .container {
  1724. overflow: scroll;
  1725. height: 93vh;
  1726. }
  1727. .addressUrls {
  1728. width: 100%;
  1729. display: flex;
  1730. margin-top: 10px;
  1731. }
  1732. .addressUrls-item {
  1733. position: relative;
  1734. display: flex;
  1735. }
  1736. .icon-guanbi {
  1737. position: absolute;
  1738. right: 8px;
  1739. }
  1740. .addressUrl {
  1741. margin: 0px 10px;
  1742. border-radius: 3px;
  1743. }
  1744. //上传文件成功标识
  1745. /deep/.el-upload-list__item-status-label {
  1746. position: absolute;
  1747. right: 22px;
  1748. top: -1px;
  1749. line-height: inherit;
  1750. display: none;
  1751. }
  1752. .map {
  1753. position: fixed;
  1754. top: 0;
  1755. bottom: 0;
  1756. left: 0;
  1757. right: 0;
  1758. margin: auto;
  1759. width: 850px;
  1760. height: 400px;
  1761. background: gainsboro;
  1762. border-radius: 20px;
  1763. padding: 10px;
  1764. box-sizing: border-box;
  1765. z-index: 99;
  1766. }
  1767. .amap-container {
  1768. width: 100% !important;
  1769. }
  1770. .address-btn {
  1771. width: 100%;
  1772. text-align: left;
  1773. }
  1774. .inline-input {
  1775. width: 100%;
  1776. }
  1777. </style>