buyGoodModal.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247
  1. <template>
  2. <el-dialog
  3. :title="'竞价单选定商品下单'"
  4. :center="true"
  5. align="left"
  6. top="5vh"
  7. width="1040px"
  8. @close="showModelThis = false"
  9. :close-on-click-modal="false"
  10. :visible.sync="showModelThis"
  11. v-loading="loading"
  12. element-loading-text="拼命加载中"
  13. element-loading-spinner="el-icon-loading"
  14. element-loading-background="rgba(0, 0, 0, 0.8)"
  15. append-to-body
  16. >
  17. <el-card style="margin-top: -20px">
  18. <el-row>
  19. <el-col :span="24">
  20. <show-data-table
  21. style="margin: 0; padding: 0"
  22. :newTime="newTime"
  23. v-if="newTime !== '' && sitem"
  24. :sitem="sitem"
  25. border
  26. :columns="ShowDataTableColumns"
  27. >
  28. <template slot="good_name">
  29. <span>{{ sitem.good_name }}</span>
  30. <span v-for="(si, sii) in sitem.specinfo" :key="si.specid + sii">
  31. <span v-if="sii !== 0">--</span
  32. ><span>{{ si.spec_name }}[{{ si.spec_value_name }}]</span></span
  33. >
  34. </template>
  35. <template slot="is_noble">
  36. <span v-if="sitem.is_noble">
  37. {{ sitem.noble_weight }}g--{{ sitem.metal_name }}--{{
  38. sitem.is_diff === "1" ? "有" : "无"
  39. }}工差--{{ sitem.config }}--{{ sitem.other_config }}</span
  40. >
  41. <span v-else>非贵金属商品</span>
  42. </template>
  43. <template slot="in_num">
  44. <span>{{ sitem.in_num }}{{ sitem.unit }}</span>
  45. </template>
  46. </show-data-table>
  47. </el-col>
  48. <el-col :span="24" style="padding: 18px 0 0 0">
  49. <el-form
  50. ref="ruleForm"
  51. :model="ruleForm"
  52. status-icon
  53. :rules="rulesThis"
  54. :size="'mini'"
  55. label-width="55px"
  56. class="demo-ruleForm"
  57. >
  58. <el-row>
  59. <el-col :span="5">
  60. <el-form-item label="数量" prop="good_num">
  61. <!--:min="sitem.in_num"-->
  62. <digital-input
  63. :values="ruleForm.good_num"
  64. :placeholder="'数量'"
  65. :min="1"
  66. :max="100000000000"
  67. :position="'right'"
  68. :precision="0"
  69. :size="'mini'"
  70. :controls="false"
  71. :disabled="false"
  72. :append="sitem.unit"
  73. @reschange="num_change($event, 'good_num')"
  74. />
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span="6">
  78. <el-form-item label="单价" prop="sale_price">
  79. <digital-input
  80. :values="ruleForm.sale_price"
  81. :placeholder="'商品单价'"
  82. :min="sitem.sale_price"
  83. :max="100000000000"
  84. :position="'right'"
  85. :precision="2"
  86. :size="'mini'"
  87. :controls="false"
  88. :disabled="false"
  89. :append="'元'"
  90. @reschange="num_change($event, 'sale_price')"
  91. />
  92. </el-form-item>
  93. </el-col>
  94. <el-col :span="6">
  95. <el-form-item label="总金额" prop="good_num" label-width="70px">
  96. <el-input
  97. v-model="total_price"
  98. placeholder="总金额"
  99. disabled
  100. maxlength="500"
  101. />
  102. </el-form-item>
  103. </el-col>
  104. <el-col :span="5">
  105. <el-form-item label="发货方式" prop="sendtype" label-width="90px">
  106. <el-select
  107. v-model="ruleForm.sendtype"
  108. placeholder="发货方式"
  109. style="width: 100%"
  110. >
  111. <el-option
  112. v-for="item in options"
  113. :key="item.value"
  114. :label="item.label"
  115. :value="item.value"
  116. >
  117. </el-option>
  118. </el-select>
  119. </el-form-item>
  120. </el-col>
  121. <el-col :span="2" style="text-align: right">
  122. <el-button
  123. :size="'mini'"
  124. type="primary"
  125. :disabled="loading"
  126. @click="submitForm"
  127. >保 存
  128. </el-button>
  129. </el-col>
  130. <el-col :span="11">
  131. <el-form-item label="业务公司" prop="companyNo" label-width="85px">
  132. <search-work-company
  133. :value="ruleForm.companyNo"
  134. :placeholder="'业务公司'"
  135. :disabled="false"
  136. :size="'mini'"
  137. :isDetail="true"
  138. @searchChange="company_idsearchChange"
  139. />
  140. </el-form-item>
  141. </el-col>
  142. <el-col :span="13">
  143. <el-form-item label="订单备注" prop="remark" label-width="85px">
  144. <el-input
  145. v-model="ruleForm.remark"
  146. maxlength="500"
  147. placeholder="订单备注"
  148. />
  149. </el-form-item>
  150. </el-col>
  151. <el-col :span="12">
  152. <el-row>
  153. <el-col :span="12"
  154. ><el-form-item label="凭证类型" prop="proof_type" label-width="85px">
  155. <el-select
  156. v-model="ruleForm.proof_type"
  157. @change="set_proof_url()"
  158. placeholder="凭证类型"
  159. style="width: 100%"
  160. >
  161. <el-option
  162. v-for="item in proof_options"
  163. :key="item.value"
  164. :label="item.label"
  165. :value="item.value"
  166. >
  167. </el-option>
  168. </el-select>
  169. </el-form-item>
  170. </el-col>
  171. <el-col :span="12">
  172. <el-form-item label="到货时间" prop="arrtime" label-width="85px">
  173. <el-date-picker
  174. v-model="ruleForm.arrtime"
  175. type="date"
  176. style="width: 100%"
  177. :disabled="false"
  178. value-format="yyyy-MM-dd"
  179. :picker-options="pickerOptions"
  180. placeholder="要求到货时间"
  181. @change="mdDate"
  182. >
  183. </el-date-picker>
  184. </el-form-item>
  185. </el-col>
  186. <el-col :span="24">
  187. <el-form-item label="凭证文件" prop="proof_url" label-width="85px">
  188. <ul class="shangchuan-ul">
  189. <li v-if="ruleForm.proof_type === '1'" class="shiping">
  190. <div v-if="video_url" class="clearfix">
  191. <el-popover placement="top" width="300" trigger="hover">
  192. <video width="275" controls class="fl">
  193. <source :src="video_url" type="video/mp4" />
  194. <source :src="video_url" type="video/avi" />
  195. 您的浏览器不支持Video标签。
  196. </video>
  197. <i
  198. class="el-icon-video-camera-solid hover"
  199. style="font-size: 18px"
  200. slot="reference"
  201. ></i>
  202. </el-popover>
  203. <el-link
  204. :underline="false"
  205. @click="deleteUrl('1')"
  206. type="warning"
  207. style="margin: 0 0 0 16px"
  208. >删除</el-link
  209. >
  210. </div>
  211. <div class="activity-upload" v-else>
  212. <div class="btnupload" style="position: relative">
  213. <i class="el-icon-plus avatar-uploader-icon"></i>
  214. <video-upload
  215. class="Upload"
  216. :disabled="type === 'view' || type === 'editCoin'"
  217. :accept="'.mp4,.avi'"
  218. :multiple="false"
  219. :uploadcondition="beforeVideoUpload"
  220. @UploadErrorEvent="UploadVideoEventproof_url"
  221. @UploadSuccessEvent="UploadSuccessVideoproof_url"
  222. />
  223. </div>
  224. <div class="txt-tips fl">
  225. <p>建议大小:小于10MB</p>
  226. <p>文件格式:.mp4,.avi</p>
  227. </div>
  228. </div>
  229. </li>
  230. <li v-if="ruleForm.proof_type === '2'" class="tupian">
  231. <div v-if="img_url" class="clearfix">
  232. <img
  233. style="width: 50px; height: 50px"
  234. :src="img_url"
  235. class="avatar fl"
  236. />
  237. <el-link
  238. :underline="false"
  239. @click="deleteUrl('2')"
  240. type="warning"
  241. style="margin: 0 0 0 16px"
  242. >删除</el-link
  243. >
  244. </div>
  245. <div class="activity-upload" v-else>
  246. <div class="btnupload" style="position: relative">
  247. <i class="el-icon-plus avatar-uploader-icon"></i>
  248. <file-upload
  249. class="Upload"
  250. :disabled="type === 'view' || type === 'editCoin'"
  251. :accept="'.jpg,.png,.jpeg'"
  252. :multiple="false"
  253. :uploadcondition="beforeAvatarUpload"
  254. @UploadErrorEvent="UploadErrorEventproof_url"
  255. @UploadSuccessEvent="UploadSuccessEventproof_url"
  256. ></file-upload>
  257. </div>
  258. <div class="txt-tips fl">
  259. <p>建议大小:小于1MB</p>
  260. <p>文件格式:.jpg,.png,.jpeg</p>
  261. </div>
  262. </div>
  263. </li>
  264. <li v-if="ruleForm.proof_type === '3'" class="qita">
  265. <div v-if="other_url" class="clearfix">
  266. <a :href="other_url" download="凭证文件">点击下载</a>
  267. <el-link
  268. :underline="false"
  269. @click="deleteUrl('3')"
  270. type="warning"
  271. style="margin: 0 0 0 16px"
  272. >删除</el-link
  273. >
  274. </div>
  275. <div class="activity-upload" v-else>
  276. <div class="btnupload" style="position: relative">
  277. <i class="el-icon-plus avatar-uploader-icon"></i>
  278. <file-upload-pdf
  279. class="Upload"
  280. :accept="'.xlsx,.xls,.pdf,.zip,.rar,.7z'"
  281. :multiple="false"
  282. :uploadcondition="beforeOtherUpload"
  283. @UploadErrorEvent="UploadErrorOtherproof_url"
  284. @UploadSuccessEvent="UploadSuccessOtherproof_url"
  285. />
  286. </div>
  287. <div class="txt-tips fl">
  288. <p>建议大小:小于5MB</p>
  289. <p>文件格式:.xlsx,.xls,.pdf,.zip,.rar,.7z</p>
  290. </div>
  291. </div>
  292. </li>
  293. </ul>
  294. </el-form-item>
  295. </el-col>
  296. </el-row>
  297. </el-col>
  298. <el-col :span="12">
  299. <el-form-item label="其他单号" prop="workNo" label-width="115px">
  300. <el-input
  301. v-model="ruleForm.workNo"
  302. maxlength="2000"
  303. type="textarea"
  304. :rows="2"
  305. show-word-limit
  306. placeholder="如: 业管单号"
  307. />
  308. </el-form-item>
  309. </el-col>
  310. <el-col :span="12">
  311. <el-form-item
  312. label="平台订单号"
  313. prop="platform_order"
  314. label-width="115px"
  315. >
  316. <el-input
  317. v-model="ruleForm.platform_order"
  318. maxlength="2000"
  319. type="textarea"
  320. :rows="2"
  321. show-word-limit
  322. placeholder="如: PO号"
  323. />
  324. </el-form-item>
  325. </el-col>
  326. </el-row>
  327. </el-form>
  328. </el-col>
  329. <el-col :span="24" v-if="ruleForm.sendtype === '1'">
  330. <el-form :model="addrForm" ref="addrForm" :size="'mini'">
  331. <el-table
  332. :data="addrForm.order_addr"
  333. border
  334. :size="'mini'"
  335. style="width: 100%"
  336. max-height="300px"
  337. row-key="key"
  338. >
  339. <el-table-column type="index" width="50" show-overflow-tooltip />
  340. <el-table-column
  341. prop="receipt_quantity"
  342. label="收货总数"
  343. min-width="125"
  344. show-overflow-tooltip
  345. >
  346. <template slot-scope="scope">
  347. <el-form-item
  348. v-if="scope.row.edit"
  349. :prop="'order_addr.' + scope.$index + '.' + 'receipt_quantity'"
  350. :rules="addrRules.receipt_quantity"
  351. :size="'mini'"
  352. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  353. >
  354. <el-input
  355. v-model="scope.row.receipt_quantity"
  356. placeholder="收货总数"
  357. :disabled="!scope.row.edit"
  358. maxlength="10"
  359. />
  360. </el-form-item>
  361. <span v-if="!scope.row.edit">{{ scope.row.receipt_quantity }}</span>
  362. </template>
  363. </el-table-column>
  364. <el-table-column
  365. prop="contactor"
  366. label="收件联系人"
  367. min-width="110"
  368. show-overflow-tooltip
  369. >
  370. <template slot-scope="scope">
  371. <el-form-item
  372. v-if="scope.row.edit"
  373. :prop="'order_addr.' + scope.$index + '.' + 'contactor'"
  374. :rules="addrRules.contactor"
  375. :size="'mini'"
  376. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  377. >
  378. <el-input
  379. v-model="scope.row.contactor"
  380. placeholder="收件联系人"
  381. maxlength="20"
  382. :disabled="!scope.row.edit"
  383. />
  384. </el-form-item>
  385. <span v-if="!scope.row.edit">{{ scope.row.contactor }}</span>
  386. </template>
  387. </el-table-column>
  388. <el-table-column
  389. prop="mobile"
  390. label="收货联系电话"
  391. min-width="130"
  392. show-overflow-tooltip
  393. >
  394. <template slot-scope="scope">
  395. <el-form-item
  396. v-if="scope.row.edit"
  397. :prop="'order_addr.' + scope.$index + '.' + 'mobile'"
  398. :rules="addrRules.mobile"
  399. :size="'mini'"
  400. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  401. >
  402. <el-input
  403. v-model="scope.row.mobile"
  404. placeholder="收货联系电话"
  405. :disabled="!scope.row.edit"
  406. maxlength="11"
  407. />
  408. </el-form-item>
  409. <span v-if="!scope.row.edit">{{ scope.row.mobile }}</span>
  410. </template>
  411. </el-table-column>
  412. <el-table-column
  413. prop="addr_code"
  414. label="收货省市区"
  415. min-width="230"
  416. show-overflow-tooltip
  417. >
  418. <template slot-scope="scope">
  419. <el-form-item
  420. v-if="scope.row.edit"
  421. :prop="'order_addr.' + scope.$index + '.' + 'addr_code'"
  422. :rules="addrRules.addr_code"
  423. :size="'mini'"
  424. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  425. >
  426. <select-area
  427. :value="scope.row.addr_code"
  428. :disabled="!scope.row.edit"
  429. placeholder="收货省市区"
  430. :size="'mini'"
  431. @selectChange="select_area_change($event, scope.$index)"
  432. />
  433. </el-form-item>
  434. <span v-if="!scope.row.edit">{{ scope.row.addr_code_name }}</span>
  435. </template>
  436. </el-table-column>
  437. <el-table-column
  438. prop="addr"
  439. label="详细地址"
  440. min-width="170"
  441. show-overflow-tooltip
  442. >
  443. <template slot-scope="scope">
  444. <el-form-item
  445. v-if="scope.row.edit"
  446. :prop="'order_addr.' + scope.$index + '.' + 'addr'"
  447. :rules="addrRules.addr"
  448. :size="'mini'"
  449. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  450. >
  451. <el-input
  452. v-model="scope.row.addr"
  453. placeholder="详细地址"
  454. :disabled="!scope.row.edit"
  455. maxlength="100"
  456. />
  457. </el-form-item>
  458. <span v-if="!scope.row.edit">{{ scope.row.addr }}</span>
  459. </template>
  460. </el-table-column>
  461. <el-table-column fixed="right" width="94" show-overflow-tooltip>
  462. <template slot="header" slot-scope="scope">
  463. <el-tooltip
  464. class="fr"
  465. style="margin: 3px 0 0 8px"
  466. effect="dark"
  467. content="手动添加地址"
  468. placement="top"
  469. >
  470. <i
  471. class="el-icon-circle-plus-outline tb-icon"
  472. style="color: #63cbe7"
  473. @click="openHouseModal(-1)"
  474. ></i>
  475. </el-tooltip>
  476. <el-tooltip
  477. class="fr"
  478. style="margin: 3px 0 0 8px"
  479. effect="dark"
  480. content="导入收货地址"
  481. placement="top"
  482. >
  483. <i
  484. class="el-icon-upload2 tb-icon"
  485. style="color: #63cbe7"
  486. @click="addrmodel = true"
  487. ></i>
  488. </el-tooltip>
  489. <el-tooltip
  490. class="fr"
  491. style="margin: 3px 0 0 0"
  492. effect="dark"
  493. content="下载收货地址模板"
  494. placement="top"
  495. >
  496. <a class="downloadAddr" href="./static/收货地址模板.xlsx">
  497. <i
  498. class="el-icon-download tb-icon"
  499. style="color: #63cbe7; margin: 0"
  500. ></i>
  501. </a>
  502. </el-tooltip>
  503. </template>
  504. <template slot-scope="scope">
  505. <el-tooltip
  506. effect="dark"
  507. content="编辑"
  508. v-if="!scope.row.edit"
  509. placement="top"
  510. >
  511. <i
  512. class="el-icon-edit tb-icon"
  513. @click="openHouseModal(scope.$index)"
  514. ></i>
  515. </el-tooltip>
  516. <el-tooltip
  517. effect="dark"
  518. content="保存"
  519. v-if="scope.row.edit"
  520. placement="top"
  521. >
  522. <i
  523. class="el-icon-circle-check tb-icon"
  524. @click="checkRow(scope.$index)"
  525. ></i>
  526. </el-tooltip>
  527. <el-tooltip effect="dark" content="删除" placement="top">
  528. <i
  529. class="el-icon-delete tb-icon"
  530. @click="deleteRow(scope.$index, addrForm.order_addr)"
  531. ></i>
  532. </el-tooltip>
  533. </template>
  534. </el-table-column>
  535. </el-table>
  536. </el-form>
  537. </el-col>
  538. <el-col :span="24">
  539. <in-addr-model
  540. :show-model="addrmodel"
  541. @cancel="addrmodel = false"
  542. @refresh="addrRefresh"
  543. />
  544. </el-col>
  545. </el-row>
  546. </el-card>
  547. </el-dialog>
  548. </template>
  549. <script>
  550. import resToken from "@/mixins/resToken";
  551. import asyncRequest from "@/apis/service/sellOut/zixunOrder";
  552. import searchStockGoodModal from "@/components/search-stock-good-modal";
  553. import { isnumber, isMobile } from "@/utils/validate";
  554. import inAddrModel from "@/components/in-addr-model";
  555. import { ShowDataTableColumns } from "./ShowDataTableColumns";
  556. export default {
  557. name: "buyGoodModal",
  558. props: ["showModel", "sitem"],
  559. mixins: [resToken],
  560. components: { searchStockGoodModal, inAddrModel },
  561. data() {
  562. const validatemobile = (rule, value, callback) => {
  563. if (value === "") {
  564. callback(new Error("手机号不能为空!"));
  565. } else {
  566. if (!isMobile(value)) {
  567. callback(new Error("手机号格式不正确!"));
  568. } else {
  569. callback();
  570. }
  571. }
  572. };
  573. const validateWeight = (rule, value, callback) => {
  574. if (value === "") {
  575. callback(new Error("收货总数不能为空!"));
  576. } else {
  577. if (!isnumber(value)) {
  578. callback(new Error("收货总数仅支持整数!"));
  579. } else {
  580. callback();
  581. }
  582. }
  583. };
  584. const validate_num_0 = (rule, value, callback) => {
  585. const { required } = rule;
  586. if (required && value === "") {
  587. callback(new Error("不能为空!"));
  588. } else if (
  589. required &&
  590. (value === "0" ||
  591. value === "0." ||
  592. value === "0.0" ||
  593. value === "0.00" ||
  594. value === "0.000")
  595. ) {
  596. callback(new Error("不能为零!"));
  597. } else {
  598. callback();
  599. }
  600. };
  601. return {
  602. loading: false,
  603. total_price: "0",
  604. addrmodel: false,
  605. showModelThis: this.showModel,
  606. showGoodsModel: false,
  607. ShowDataTableColumns: ShowDataTableColumns,
  608. video_url: "",
  609. img_url: "",
  610. other_url: "",
  611. proof_options: [
  612. {
  613. value: "1",
  614. label: "视频",
  615. },
  616. {
  617. value: "2",
  618. label: "图片",
  619. },
  620. {
  621. value: "3",
  622. label: "其他",
  623. },
  624. ],
  625. pickerOptions: {
  626. disabledDate: (time) => {
  627. return time.getTime() < new Date(this.sitem.in_arrival_time).getTime();
  628. },
  629. },
  630. options: [
  631. {
  632. value: "1",
  633. label: "直接发货",
  634. },
  635. {
  636. value: "2",
  637. label: "延时发货",
  638. },
  639. ],
  640. stock_code: "",
  641. cat_id: "",
  642. ruleForm: {
  643. bidNo: "", //竞价单反馈编号
  644. good_num: "", //商品数量
  645. sale_price: "",
  646. sendtype: "1", // 发货方式
  647. arrtime: "", // 到货时间
  648. remark: "", //订单备注
  649. platform_order: "", //平台订单号
  650. workNo: "", //其他单号
  651. companyNo: "",
  652. },
  653. rulesThis: this.rules,
  654. rules: {
  655. good_num: [
  656. {
  657. required: true,
  658. validator: validate_num_0,
  659. trigger: "blur",
  660. },
  661. ],
  662. sale_price: [
  663. {
  664. required: true,
  665. validator: validate_num_0,
  666. trigger: "blur",
  667. },
  668. ],
  669. companyNo: [
  670. {
  671. required: true,
  672. message: "请选择业务公司",
  673. trigger: "change",
  674. },
  675. ],
  676. sendtype: [
  677. {
  678. required: true,
  679. message: "请选择发货方式",
  680. trigger: "change",
  681. },
  682. ],
  683. remark: [
  684. {
  685. required: true,
  686. message: "输入订单备注",
  687. trigger: "blur",
  688. },
  689. ],
  690. arrtime: [
  691. {
  692. required: true,
  693. message: "要求到货时间",
  694. trigger: "change",
  695. },
  696. ],
  697. proof_type: [
  698. {
  699. required: false,
  700. message: "请选择凭证类型",
  701. trigger: "change",
  702. },
  703. ],
  704. proof_url: [
  705. {
  706. required: false,
  707. message: "请上传凭证文件",
  708. trigger: "blur,change",
  709. },
  710. ],
  711. },
  712. addrForm: {
  713. order_addr: [], //收货地址
  714. },
  715. addrRules: {
  716. receipt_quantity: [
  717. {
  718. required: true,
  719. validator: validateWeight,
  720. trigger: "blur",
  721. },
  722. ],
  723. contactor: [
  724. {
  725. required: true,
  726. trigger: "blur",
  727. message: "联系人不能为空",
  728. },
  729. ],
  730. mobile: [
  731. {
  732. required: true,
  733. validator: validatemobile,
  734. trigger: "blur",
  735. },
  736. ],
  737. addr_code: [
  738. {
  739. type: "array",
  740. required: false,
  741. message: "收货省市区不能为空",
  742. trigger: "change",
  743. },
  744. ],
  745. addr: [
  746. {
  747. required: true,
  748. message: "详细地址不能为空",
  749. trigger: "blur",
  750. },
  751. ],
  752. },
  753. loading: false,
  754. id: "",
  755. };
  756. },
  757. created() {
  758. // this.this.ruleForm.arrtime = this.sitem.in_arrival_time.substring(0, 10);
  759. },
  760. watch: {
  761. showModel: function (val) {
  762. this.showModelThis = val;
  763. if (val) {
  764. // this.rulesThis = this.rules;
  765. this.initForm();
  766. }
  767. },
  768. showModelThis(val) {
  769. if (!val) {
  770. this.$emit("cancel");
  771. }
  772. },
  773. },
  774. methods: {
  775. //修改日期校验
  776. mdDate() {
  777. //用户传递的到货时间不能大于要求到货的时间 对要求到货时间进行字符截取10位抹除时分秒
  778. if (
  779. Date.parse(this.ruleForm.arrtime) <
  780. Date.parse(this.sitem.in_arrival_time.substring(0, 10))
  781. ) {
  782. this.$message.warning("到货时间不能小于要求到货日期");
  783. this.ruleForm.arrtime = "";
  784. }
  785. },
  786. //销售方公司选择
  787. company_idsearchChange(e) {
  788. const { code } = e;
  789. this.ruleForm.companyNo = code || "";
  790. this.$refs.ruleForm.validateField("companyNo");
  791. },
  792. closeModel() {
  793. console.log("closeModel!!");
  794. this.showModelThis = false;
  795. },
  796. num_change(e, key) {
  797. this.ruleForm[key] = e + "";
  798. this.$refs.ruleForm.validateField(key);
  799. this.set_total_price();
  800. },
  801. set_total_price() {
  802. const { good_num, sale_price } = this.ruleForm;
  803. let num = good_num * 1;
  804. let price = sale_price * 1;
  805. this.total_price = num * price + "";
  806. },
  807. async initForm() {
  808. this.loading = true;
  809. this.rulesThis = this.rules;
  810. console.log(this.sitem);
  811. const { can } = this.sitem;
  812. this.sitem.can_name = "";
  813. this.sitem.is_noble = false;
  814. if (can && can.length > 0) {
  815. can.forEach((a, ai) => {
  816. this.sitem.is_noble = a.id === "6";
  817. this.sitem.can_name += `${ai !== 0 ? "_" : ""}${a.name}`;
  818. });
  819. }
  820. await this.resetForm();
  821. this.getNewTime();
  822. this.set_total_price();
  823. this.loading = false;
  824. },
  825. addrRefresh(e) {
  826. const { list } = e;
  827. this.addrForm.order_addr.push(...list);
  828. },
  829. getNewTime() {
  830. this.newTime = new Date().valueOf();
  831. },
  832. async resetForm() {
  833. //重置
  834. await this.$nextTick(() => {
  835. if (this.$refs.ruleForm) {
  836. this.$refs.ruleForm.resetFields();
  837. this.$refs.ruleForm.clearValidate();
  838. const {
  839. bidNo,
  840. in_num,
  841. in_arrival_time,
  842. sale_price,
  843. remark,
  844. in_companyNo,
  845. } = this.sitem;
  846. console.log(this.sitem);
  847. this.ruleForm = {
  848. bidNo: bidNo || "", //竞价单反馈编号
  849. good_num: in_num || "0", //商品数量
  850. sale_price: sale_price || "",
  851. sendtype: "1", // 发货方式
  852. arrtime: in_arrival_time || "", // 到货时间
  853. remark: "",
  854. proof_type: "1", // 通过or驳回
  855. proof_url: "", //驳回至
  856. companyNo: in_companyNo || "",
  857. };
  858. }
  859. if (this.$refs.addrForm) {
  860. this.$refs.addrForm.resetFields();
  861. this.$refs.addrForm.clearValidate();
  862. this.addrForm = {
  863. order_addr: [],
  864. };
  865. }
  866. });
  867. },
  868. openHouseModal(index) {
  869. let findex = this.addrForm.order_addr.findIndex((v) => v.edit === true);
  870. if (findex !== -1) {
  871. this.$message.warning("当前已有地址在编辑,请保存后再试!");
  872. return;
  873. } else {
  874. if (index === -1) {
  875. this.addrForm.order_addr.push({
  876. edit: true,
  877. receipt_quantity: "",
  878. contactor: "",
  879. mobile: "",
  880. addr_code: [],
  881. addr: "",
  882. });
  883. } else {
  884. this.addrForm.order_addr[index].edit = true;
  885. }
  886. }
  887. },
  888. //省市区选择
  889. async select_area_change(e, index) {
  890. this.addrForm.order_addr[index].addr_code = e;
  891. const { addr_code } = this.addrForm.order_addr[index];
  892. if (addr_code && addr_code.length === 3) {
  893. let arrCode = addr_code[addr_code.length - 1];
  894. // console.log(model);
  895. let { code, data, message } = await asyncRequest.addrall({
  896. code: arrCode,
  897. });
  898. if (code === 0) {
  899. const { province, city, area } = data;
  900. let province_name = province && province.name ? province.name : "";
  901. let city_name = city && city.name ? city.name : "";
  902. let area_name = area && area.name ? area.name : "";
  903. this.addrForm.order_addr[index].addr_code_name =
  904. province_name && city_name && area_name
  905. ? `${province_name}/${city_name}/${area_name}`
  906. : "";
  907. } else if (code >= 100 && code <= 104) {
  908. await this.logout();
  909. } else {
  910. this.$message.warning(message);
  911. }
  912. } else {
  913. this.addrForm.order_addr[index].addr_code_name = "";
  914. }
  915. },
  916. //省市区保存某一行
  917. checkRow(rowIndex) {
  918. this.$refs.addrForm.validate((valid) => {
  919. if (valid) {
  920. this.addrForm.order_addr[rowIndex].edit = false;
  921. } else {
  922. console.log("error submit!!");
  923. return false;
  924. }
  925. });
  926. },
  927. // 省市区删除行操作
  928. deleteRow(index, rows) {
  929. rows.splice(index, 1);
  930. },
  931. async submitForm() {
  932. await this.$refs.ruleForm.validate(async (valid) => {
  933. if (valid) {
  934. if (this.loading) return;
  935. this.loading = true;
  936. let model = JSON.parse(JSON.stringify(this.ruleForm));
  937. model.order_addr = [];
  938. const { sendtype, good_num } = model;
  939. const { order_addr } = JSON.parse(JSON.stringify(this.addrForm));
  940. if (sendtype === "1" && order_addr && order_addr.length === 0) {
  941. this.$message.warning("至少上传一个地址信息!");
  942. this.loading = false;
  943. return;
  944. }
  945. if (sendtype === "1") {
  946. let addrT = 0,
  947. isAEdit = false;
  948. order_addr.forEach((v2) => {
  949. if (v2.edit) {
  950. isAEdit = true;
  951. }
  952. addrT += parseInt(v2.receipt_quantity + "");
  953. let model2 = {
  954. addr_code: v2.addr_code.toString(),
  955. contactor: v2.contactor,
  956. mobile: v2.mobile,
  957. addr: v2.addr,
  958. receipt_quantity: v2.receipt_quantity,
  959. };
  960. model.order_addr.push(model2);
  961. });
  962. if (isAEdit) {
  963. this.$message.warning("请保存地址信息!");
  964. this.loading = false;
  965. return;
  966. }
  967. if (parseInt(good_num + "") !== addrT) {
  968. this.$message.warning("收货总数量与购买不一致!");
  969. this.loading = false;
  970. return;
  971. }
  972. }
  973. this.loading = false;
  974. let res = await asyncRequest.consultorder(model);
  975. this.loading = false;
  976. if (res && res.code === 0) {
  977. this.$notify.success({
  978. title: "下单成功!",
  979. message: "",
  980. });
  981. this.showModelThis = false;
  982. // 刷新
  983. this.$emit("refresh");
  984. } else if (res && res.code >= 100 && res.code <= 104) {
  985. await this.logout();
  986. } else {
  987. this.$message.warning(res.message);
  988. }
  989. } else {
  990. console.log("error submit!!");
  991. return false;
  992. }
  993. });
  994. },
  995. //图片上传成功
  996. async UploadSuccessEventproof_url(data) {
  997. const { url } = data;
  998. if (url === "noToken") {
  999. await this.logout();
  1000. } else {
  1001. this.img_url = url;
  1002. this.set_proof_url();
  1003. this.$message.success("图片上传成功!");
  1004. }
  1005. },
  1006. //图片上传失败
  1007. UploadErrorEventproof_url(res) {
  1008. if (res !== "break") {
  1009. this.set_proof_url();
  1010. this.$message.error("图片上传失败!");
  1011. }
  1012. },
  1013. //判断图片规格
  1014. beforeAvatarUpload(file) {
  1015. let isJPG = false;
  1016. if (
  1017. file.type === "image/jpg" ||
  1018. file.type === "image/png" ||
  1019. file.type === "image/jpeg"
  1020. ) {
  1021. isJPG = true;
  1022. }
  1023. const isLt2M = file.size / 1024 / 1024 < 1;
  1024. if (!isJPG) {
  1025. this.$message.error("图片格式不正确!");
  1026. }
  1027. if (!isLt2M) {
  1028. this.$message.error("图片大小不能超过 1MB!");
  1029. }
  1030. return isJPG && isLt2M;
  1031. },
  1032. //视频上传成功
  1033. async UploadSuccessVideoproof_url(data) {
  1034. const { url } = data;
  1035. if (url === "noToken") {
  1036. await this.logout();
  1037. } else {
  1038. this.video_url = url;
  1039. this.set_proof_url();
  1040. this.$message.success("视频上传成功!");
  1041. }
  1042. },
  1043. //视频上传失败
  1044. UploadErrorVideoproof_url(res) {
  1045. if (res !== "break") {
  1046. this.set_proof_url();
  1047. this.$message.error("视频上传失败!");
  1048. }
  1049. },
  1050. //判断视频规格
  1051. beforeVideoUpload(file) {
  1052. let isJPG = false;
  1053. if (file.type === "video/mp4" || file.type === "video/avi") {
  1054. isJPG = true;
  1055. }
  1056. const isLt2M = file.size / 1024 / 1024 < 10;
  1057. if (!isJPG) {
  1058. this.$message.error("视频格式不正确!");
  1059. }
  1060. if (!isLt2M) {
  1061. this.$message.error("视频大小不能超过 10MB!");
  1062. }
  1063. return isJPG && isLt2M;
  1064. },
  1065. // 其他文件上传成功
  1066. async UploadSuccessOtherproof_url(data) {
  1067. const { url } = data;
  1068. if (url === "noToken") {
  1069. await this.logout();
  1070. } else {
  1071. this.other_url = url;
  1072. this.set_proof_url();
  1073. this.$message.success("文件成功!");
  1074. }
  1075. },
  1076. //其他文件上传失败
  1077. UploadErrorOtherproof_url(res) {
  1078. if (res !== "break") {
  1079. this.set_proof_url();
  1080. this.$message.error("文件上传失败!");
  1081. }
  1082. },
  1083. //判断其他文件规格
  1084. beforeOtherUpload(file) {
  1085. console.log(file);
  1086. let isJPG = false;
  1087. if (
  1088. file.type === "application/vnd.ms-excel" ||
  1089. file.type ===
  1090. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
  1091. file.type === "application/pdf" ||
  1092. file.type === "application/x-zip-compressed"
  1093. ) {
  1094. isJPG = true;
  1095. }
  1096. let name = file.name;
  1097. let list = name.split(".");
  1098. if (list[list.length - 1] === "rar" || list[list.length - 1] === "7z") {
  1099. isJPG = true;
  1100. }
  1101. const isLt2M = file.size / 1024 / 1024 < 5;
  1102. if (!isJPG) {
  1103. this.$message.error("文件格式不正确!");
  1104. }
  1105. if (!isLt2M) {
  1106. this.$message.error("文件大小不能超过 5MB!");
  1107. }
  1108. return isJPG && isLt2M;
  1109. },
  1110. deleteUrl(type) {
  1111. switch (type) {
  1112. case "1":
  1113. this.video_url = "";
  1114. break;
  1115. case "2":
  1116. this.img_url = "";
  1117. break;
  1118. case "3":
  1119. this.other_url = "";
  1120. break;
  1121. default:
  1122. this.video_url = "";
  1123. }
  1124. this.set_proof_url();
  1125. },
  1126. set_proof_url() {
  1127. const { proof_type } = this.ruleForm;
  1128. switch (proof_type) {
  1129. case "1":
  1130. this.ruleForm.proof_url = this.video_url;
  1131. break;
  1132. case "2":
  1133. this.ruleForm.proof_url = this.img_url;
  1134. break;
  1135. case "3":
  1136. this.ruleForm.proof_url = this.other_url;
  1137. break;
  1138. default:
  1139. this.ruleForm.proof_url = this.video_url;
  1140. }
  1141. this.$refs.ruleForm.validateField("proof_url");
  1142. },
  1143. },
  1144. };
  1145. </script>
  1146. <style lang="scss" scoped>
  1147. // .capitalClaim {
  1148. .excelUploadBox {
  1149. position: relative;
  1150. width: 100%;
  1151. height: 120px;
  1152. line-height: 120px;
  1153. box-sizing: border-box;
  1154. &:hover {
  1155. cursor: pointer;
  1156. }
  1157. .el-icon-receiving {
  1158. width: 100%;
  1159. text-align: center;
  1160. height: 50px;
  1161. display: block;
  1162. font-size: 32px;
  1163. line-height: 90px;
  1164. color: #d3d4d6;
  1165. }
  1166. .boxM {
  1167. width: 100%;
  1168. display: block;
  1169. text-align: center;
  1170. line-height: 65px;
  1171. height: 60px;
  1172. color: #909399;
  1173. }
  1174. }
  1175. .excelUpload {
  1176. top: 0;
  1177. left: 0;
  1178. position: absolute;
  1179. z-index: 2;
  1180. width: 100%;
  1181. height: 120px;
  1182. line-height: 120px;
  1183. box-sizing: border-box;
  1184. }
  1185. .excelUploadRes {
  1186. width: 100%;
  1187. height: 120px;
  1188. line-height: 120px;
  1189. box-sizing: border-box;
  1190. i {
  1191. width: 55px;
  1192. height: 120px;
  1193. line-height: 120px;
  1194. text-align: center;
  1195. font-size: 20px;
  1196. &.fl {
  1197. padding-left: 16px;
  1198. }
  1199. &.fr {
  1200. padding-right: 16px;
  1201. &:hover {
  1202. cursor: pointer;
  1203. }
  1204. }
  1205. }
  1206. span {
  1207. width: 386px;
  1208. line-height: 16px;
  1209. margin: 52px 0 0 0;
  1210. font-size: 16px;
  1211. }
  1212. }
  1213. // }
  1214. </style>