salesContractAdd.vue 60 KB

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