salesContractAdd.vue 61 KB

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