transferGoodModal.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020
  1. <template>
  2. <el-dialog
  3. v-loading="loading"
  4. :title="'咨询单转报备'"
  5. :center="true"
  6. align="left"
  7. top="5vh"
  8. width="1040px"
  9. :close-on-click-modal="false"
  10. :visible.sync="showModelThis"
  11. element-loading-text="拼命加载中"
  12. element-loading-spinner="el-icon-loading"
  13. element-loading-background="rgba(0, 0, 0, 0.8)"
  14. append-to-body
  15. @close="showModelThis = false"
  16. >
  17. <el-card style="margin-top: -20px">
  18. <el-row>
  19. <el-col :span="24">
  20. <show-data-table
  21. v-if="newTime !== '' && sitem"
  22. style="margin: 0; padding: 0"
  23. :new-time="newTime"
  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>
  33. </span>
  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 }}
  40. </span>
  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="85px"
  56. class="demo-ruleForm"
  57. >
  58. <el-row>
  59. <el-col :span="5">
  60. <el-form-item label="报备数量" prop="good_num">
  61. <digital-input
  62. :values="ruleForm.good_num"
  63. :placeholder="'报备数量'"
  64. :min="1"
  65. :max="100000000000"
  66. :position="'right'"
  67. :precision="0"
  68. :size="'mini'"
  69. :controls="false"
  70. :disabled="false"
  71. :append="sitem.unit"
  72. @reschange="num_change($event, 'good_num')"
  73. />
  74. </el-form-item>
  75. </el-col>
  76. <el-col :span="6">
  77. <el-form-item label="销售单价" prop="sale_price">
  78. <digital-input
  79. :values="ruleForm.sale_price"
  80. :placeholder="'商品单价'"
  81. :min="sitem.sale_price"
  82. :max="100000000000"
  83. :position="'right'"
  84. :precision="2"
  85. :size="'mini'"
  86. :controls="false"
  87. :disabled="false"
  88. :append="'元'"
  89. @reschange="num_change($event, 'sale_price')"
  90. />
  91. </el-form-item>
  92. </el-col>
  93. <el-col :span="11">
  94. <el-form-item label="业务公司" prop="companyNo" label-width="85px">
  95. <search-work-company
  96. :value="ruleForm.companyNo"
  97. :placeholder="'业务公司'"
  98. :disabled="false"
  99. :size="'mini'"
  100. :is-detail="true"
  101. @searchChange="company_idsearchChange"
  102. />
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="2" style="text-align: right">
  106. <el-button :size="'mini'" type="primary" :disabled="loading" @click="submitForm">保 存</el-button>
  107. </el-col>
  108. <el-col :span="12">
  109. <el-form-item label="订单备注" prop="remark" label-width="85px" style="margin-bottom:2px">
  110. <el-input v-model="ruleForm.remark" maxlength="500" placeholder="订单备注" />
  111. </el-form-item>
  112. </el-col>
  113. <el-col :span="12">
  114. <el-form-item label="业务经理" prop="managerid" label-width="115px">
  115. <project-manager
  116. :size="'mini'"
  117. v-model.value="ruleForm.managerid"
  118. @searchChange="managerChange"
  119. style="width: 100%"
  120. />
  121. </el-form-item>
  122. </el-col>
  123. <el-col :span="24">
  124. <el-row>
  125. <el-col :span="6">
  126. <el-form-item label="凭证类型" prop="proof_type" label-width="85px" v-model="proof_type">
  127. <el-select
  128. v-model="ruleForm.proof_type"
  129. placeholder="凭证类型"
  130. style="width: 100%"
  131. @change="set_proof_url()"
  132. >
  133. <el-option
  134. v-for="item in proof_options"
  135. :key="item.value"
  136. :label="item.label"
  137. :value="item.value"
  138. />
  139. </el-select>
  140. </el-form-item>
  141. </el-col>
  142. <el-col :span="18">
  143. <el-form-item label="凭证文件" prop="proof_url" label-width="85px">
  144. <ul class="shangchuan-ul">
  145. <li v-if="ruleForm.proof_type + '' === '1'" class="shiping">
  146. <div v-if="video_url" class="clearfix">
  147. <el-popover placement="top" width="300" trigger="hover">
  148. <video width="275" controls class="fl">
  149. <source :src="video_url" type="video/mp4" />
  150. <source :src="video_url" type="video/avi" />您的浏览器不支持Video标签。
  151. </video>
  152. <i
  153. slot="reference"
  154. class="el-icon-video-camera-solid hover"
  155. style="font-size: 18px"
  156. />
  157. </el-popover>
  158. <el-link
  159. :underline="false"
  160. type="warning"
  161. style="margin: 0 0 0 16px"
  162. @click="deleteUrl('1')"
  163. >删除</el-link>
  164. </div>
  165. <div v-else class="activity-upload">
  166. <div class="btnupload" style="position: relative">
  167. <i class="el-icon-plus avatar-uploader-icon" />
  168. <video-upload
  169. class="Upload"
  170. :disabled="type === 'view' || type === 'editCoin'"
  171. :accept="'.mp4,.avi'"
  172. :multiple="false"
  173. :uploadcondition="beforeVideoUpload"
  174. @UploadErrorEvent="UploadVideoEventproof_url"
  175. @UploadSuccessEvent="UploadSuccessVideoproof_url"
  176. />
  177. </div>
  178. <div class="txt-tips fl">
  179. <p>建议大小:小于10MB</p>
  180. <p>文件格式:.mp4,.avi</p>
  181. </div>
  182. </div>
  183. </li>
  184. <li v-if="ruleForm.proof_type + '' === '2'" class="tupian">
  185. <div v-if="img_url" class="clearfix">
  186. <img style="width: 50px; height: 50px" :src="img_url" class="avatar fl" />
  187. <el-link
  188. :underline="false"
  189. type="warning"
  190. style="margin: 0 0 0 16px"
  191. @click="deleteUrl('2')"
  192. >删除</el-link>
  193. </div>
  194. <div v-else class="activity-upload">
  195. <div class="btnupload" style="position: relative">
  196. <i class="el-icon-plus avatar-uploader-icon" />
  197. <file-upload
  198. class="Upload"
  199. :disabled="type === 'view' || type === 'editCoin'"
  200. :accept="'.jpg,.png,.jpeg'"
  201. :multiple="false"
  202. :uploadcondition="beforeAvatarUpload"
  203. @UploadErrorEvent="UploadErrorEventproof_url"
  204. @UploadSuccessEvent="UploadSuccessEventproof_url"
  205. />
  206. </div>
  207. <div class="txt-tips fl">
  208. <p>建议大小:小于1MB</p>
  209. <p>文件格式:.jpg,.png,.jpeg</p>
  210. </div>
  211. </div>
  212. </li>
  213. <li v-if="ruleForm.proof_type + '' === '3'" class="qita">
  214. <div v-if="other_url" class="clearfix">
  215. <a :href="other_url" download="凭证文件">点击下载</a>
  216. <el-link
  217. :underline="false"
  218. type="warning"
  219. style="margin: 0 0 0 16px"
  220. @click="deleteUrl('3')"
  221. >删除</el-link>
  222. </div>
  223. <div v-else class="activity-upload">
  224. <div class="btnupload" style="position: relative">
  225. <i class="el-icon-plus avatar-uploader-icon" />
  226. <file-upload-pdf
  227. class="Upload"
  228. :accept="'.xlsx,.xls,.pdf,.zip,.rar,.7z'"
  229. :multiple="false"
  230. :uploadcondition="beforeOtherUpload"
  231. @UploadErrorEvent="UploadErrorOtherproof_url"
  232. @UploadSuccessEvent="UploadSuccessOtherproof_url"
  233. />
  234. </div>
  235. <div class="txt-tips fl">
  236. <p>建议大小:小于5MB</p>
  237. <p>文件格式:.xlsx,.xls,.pdf,.zip,.rar,.7z</p>
  238. </div>
  239. </div>
  240. </li>
  241. </ul>
  242. </el-form-item>
  243. </el-col>
  244. </el-row>
  245. </el-col>
  246. <el-col :span="12"></el-col>
  247. </el-row>
  248. </el-form>
  249. </el-col>
  250. <el-col :span="24">
  251. <in-addr-model
  252. :show-model="addrmodel"
  253. @cancel="addrmodel = false"
  254. @refresh="addrRefresh"
  255. />
  256. </el-col>
  257. </el-row>
  258. </el-card>
  259. </el-dialog>
  260. </template>
  261. <script>
  262. import resToken from "@/mixins/resToken";
  263. import asyncRequest from "@/apis/service/sellOut/zixunOrder";
  264. import SearchStockGoodModal from "@/components/search-stock-good-modal";
  265. import {
  266. isnumber,
  267. isMobile,
  268. isChinese,
  269. isEmoticon,
  270. isSpecialSymbol,
  271. hasSpace,
  272. isAddr
  273. } from "@/utils/validate";
  274. import inAddrModel from "@/components/in-addr-model";
  275. import { ShowDataTableColumns } from "./ShowDataTableColumns";
  276. import { replaceTextWrapAndSpace } from "@/utils";
  277. export default {
  278. name: "BuyGoodModal",
  279. components: { SearchStockGoodModal, inAddrModel },
  280. mixins: [resToken],
  281. props: ["showModel", "sitem"],
  282. data() {
  283. const validatemobile = (rule, value, callback) => {
  284. if (value === "") {
  285. callback(new Error("手机号不能为空!"));
  286. } else {
  287. if (!isMobile(value)) {
  288. callback(new Error("手机号格式不正确!"));
  289. } else {
  290. callback();
  291. }
  292. }
  293. };
  294. const validateWeight = (rule, value, callback) => {
  295. if (value === "") {
  296. callback(new Error("收货总数不能为空!"));
  297. } else {
  298. if (!isnumber(value)) {
  299. callback(new Error("收货总数仅支持整数!"));
  300. } else {
  301. callback();
  302. }
  303. }
  304. };
  305. const validate_num_0 = (rule, value, callback) => {
  306. const { required } = rule;
  307. if (required && value === "") {
  308. callback(new Error("不能为空!"));
  309. } else if (
  310. required &&
  311. (value === "0" ||
  312. value === "0." ||
  313. value === "0.0" ||
  314. value === "0.00" ||
  315. value === "0.000")
  316. ) {
  317. // new Error('不能为零!')
  318. callback();
  319. } else {
  320. callback();
  321. }
  322. };
  323. const validatecontactor = (rule, value, callback) => {
  324. if (value === "") {
  325. callback(new Error("联系人不能为空!"));
  326. } else {
  327. if (value.length < 2 || value.length > 10) {
  328. callback(new Error("联系人规则为2~10位汉字!"));
  329. } else {
  330. if (!isChinese(value)) {
  331. callback(new Error("联系人规则为2~10位汉字!"));
  332. } else if (isEmoticon(value)) {
  333. callback(new Error("联系人规则为2~10位汉字!"));
  334. } else {
  335. callback();
  336. }
  337. }
  338. }
  339. };
  340. const validateAddr = (rule, value, callback) => {
  341. if (value === "") {
  342. callback(new Error("详细地址不能为空!"));
  343. } else {
  344. if (hasSpace(value)) {
  345. callback(new Error("不能出现/回车/换行符!"));
  346. } else if (isSpecialSymbol(value)) {
  347. callback(new Error("不能使用英文特殊字符!"));
  348. } else if (isAddr(value)) {
  349. callback();
  350. } else {
  351. callback(new Error("详细地址填写不规范!"));
  352. }
  353. }
  354. };
  355. return {
  356. loading: false,
  357. total_price: "0",
  358. addrmodel: false,
  359. showModelThis: this.showModel,
  360. showGoodsModel: false,
  361. ShowDataTableColumns: ShowDataTableColumns,
  362. video_url: "",
  363. img_url: "",
  364. other_url: "",
  365. goodTypes: [
  366. { value: "1", label: "常规商品" },
  367. { value: "2", label: "赠品" },
  368. { value: "3", label: "样品" }
  369. ],
  370. proof_options: [
  371. {
  372. value: "1",
  373. label: "视频"
  374. },
  375. {
  376. value: "2",
  377. label: "图片"
  378. },
  379. {
  380. value: "3",
  381. label: "其他"
  382. }
  383. ],
  384. pickerOptions: {
  385. disabledDate: time => {
  386. return (
  387. time.getTime() < new Date(this.sitem.in_arrival_time).getTime()
  388. );
  389. }
  390. },
  391. options: [
  392. {
  393. value: "1",
  394. label: "有地址下单"
  395. },
  396. {
  397. value: "2",
  398. label: "无地址下单"
  399. }
  400. ],
  401. stock_code: "",
  402. cat_id: "",
  403. ruleForm: {
  404. managerid: [],
  405. manager: "",
  406. bidNo: "", // 竞价单反馈编号
  407. good_num: "", // 商品数量
  408. sale_price: "",
  409. sendtype: "1", // 发货方式
  410. arrtime: "", // 到货时间
  411. remark: "", // 订单备注
  412. platform_order: "", // 平台订单号
  413. workNo: "", // 其他单号
  414. companyNo: "",
  415. },
  416. manager_name: "",
  417. rulesThis: this.rules,
  418. rules: {
  419. goodtype: [
  420. {
  421. required: true,
  422. trigger: "change",
  423. message: "请选择商品类型"
  424. }
  425. ],
  426. good_num: [
  427. {
  428. required: true,
  429. validator: validate_num_0,
  430. trigger: "blur"
  431. }
  432. ],
  433. sale_price: [
  434. {
  435. required: true,
  436. validator: validate_num_0,
  437. trigger: "blur"
  438. }
  439. ],
  440. managerid: [
  441. {
  442. required: true,
  443. message: "请选择业务经理",
  444. trigger: "change"
  445. }
  446. ],
  447. companyNo: [
  448. {
  449. required: true,
  450. message: "请选择业务公司",
  451. trigger: "change"
  452. }
  453. ],
  454. sendtype: [
  455. {
  456. required: true,
  457. message: "请选择发货方式",
  458. trigger: "change"
  459. }
  460. ],
  461. remark: [
  462. {
  463. required: true,
  464. message: "输入订单备注",
  465. trigger: "blur"
  466. }
  467. ],
  468. arrtime: [
  469. {
  470. required: true,
  471. message: "要求到货时间",
  472. trigger: "change"
  473. }
  474. ],
  475. proof_type: [
  476. {
  477. required: true,
  478. message: "请选择凭证类型",
  479. trigger: "change"
  480. }
  481. ],
  482. proof_url: [
  483. {
  484. required: true,
  485. message: "请上传凭证文件",
  486. trigger: "blur,change"
  487. }
  488. ]
  489. },
  490. addrForm: {
  491. order_addr: [] // 收货地址
  492. },
  493. addrRules: {
  494. receipt_quantity: [
  495. {
  496. required: true,
  497. validator: validateWeight,
  498. trigger: "blur"
  499. }
  500. ],
  501. contactor: [
  502. {
  503. required: true,
  504. trigger: "blur",
  505. validator: validatecontactor
  506. }
  507. ],
  508. mobile: [
  509. {
  510. required: true,
  511. validator: validatemobile,
  512. trigger: "blur"
  513. }
  514. ],
  515. addr_code: [
  516. {
  517. type: "array",
  518. required: false,
  519. trigger: "change"
  520. }
  521. ],
  522. addr: [
  523. {
  524. required: true,
  525. validator: validateAddr,
  526. trigger: "blur"
  527. }
  528. ]
  529. },
  530. id: ""
  531. };
  532. },
  533. watch: {
  534. showModel: function(val) {
  535. this.showModelThis = val;
  536. if (val) {
  537. // this.rulesThis = this.rules;
  538. this.initForm();
  539. }
  540. },
  541. showModelThis(val) {
  542. if (!val) {
  543. this.$emit("cancel");
  544. }
  545. },
  546. "ruleForm.sale_price"(val) {
  547. this.ruleForm.goodtype = Number(val) === 0 ? "2" : "1";
  548. }
  549. },
  550. methods: {
  551. managerChange(e) {
  552. const { id, label } = e;
  553. this.ruleForm.manager = label;
  554. this.ruleForm.managerid = id ? [id] : []
  555. console.log(this.ruleForm)
  556. this.$refs.ruleForm.validateField("managerid");
  557. // this.manager_name = label ?? "";
  558. },
  559. // 修改日期校验
  560. mdDate() {
  561. // 用户传递的到货时间不能大于要求到货的时间 对要求到货时间进行字符截取10位抹除时分秒
  562. if (
  563. Date.parse(this.ruleForm.arrtime) <
  564. Date.parse(this.sitem.in_arrival_time.substring(0, 10))
  565. ) {
  566. this.$message.warning("到货时间不能小于要求到货日期");
  567. this.ruleForm.arrtime = "";
  568. }
  569. },
  570. // 销售方公司选择
  571. company_idsearchChange(e) {
  572. const { code } = e;
  573. this.ruleForm.companyNo = code || "";
  574. this.$refs.ruleForm && this.$refs.ruleForm.validateField("companyNo");
  575. },
  576. closeModel() {
  577. console.log("closeModel!!");
  578. this.showModelThis = false;
  579. },
  580. num_change(e, key) {
  581. this.ruleForm[key] = e + "";
  582. this.$refs.ruleForm && this.$refs.ruleForm.validateField(key);
  583. this.set_total_price();
  584. },
  585. set_total_price() {
  586. const { good_num, sale_price } = this.ruleForm;
  587. const num = good_num * 1;
  588. const price = sale_price * 1;
  589. this.total_price = num * price + "";
  590. },
  591. async initForm() {
  592. this.loading = true;
  593. this.rulesThis = this.rules;
  594. console.log(this.rulesThis)
  595. const { can } = this.sitem;
  596. this.sitem.can_name = "";
  597. this.sitem.is_noble = false;
  598. if (can && can.length > 0) {
  599. can.forEach((a, ai) => {
  600. this.sitem.is_noble = a.id + "" === "6";
  601. this.sitem.can_name += `${ai !== 0 ? "_" : ""}${a.name}`;
  602. });
  603. }
  604. await this.resetForm();
  605. this.getNewTime();
  606. this.set_total_price();
  607. this.loading = false;
  608. },
  609. addrRefresh(e) {
  610. const list = JSON.parse(JSON.stringify(e.list));
  611. list.forEach(item => {
  612. item.label = [item.label];
  613. item.code = [item.areaCode];
  614. });
  615. this.addrForm.order_addr.push(...list);
  616. },
  617. getNewTime() {
  618. this.newTime = new Date().valueOf();
  619. },
  620. async resetForm() {
  621. // 重置
  622. await this.$nextTick(() => {
  623. if (this.$refs.ruleForm) {
  624. this.$refs.ruleForm.resetFields();
  625. this.$refs.ruleForm.clearValidate();
  626. const {
  627. bidNo,
  628. in_num,
  629. in_arrival_time,
  630. sale_price,
  631. in_companyNo
  632. } = this.sitem;
  633. this.ruleForm = {
  634. bidNo: bidNo || "", // 竞价单反馈编号
  635. good_num: in_num || "0", // 商品数量
  636. sale_price: sale_price || "",
  637. sendtype: "1", // 发货方式
  638. arrtime: in_arrival_time || "", // 到货时间
  639. remark: "",
  640. proof_type: "1", // 通过or驳回
  641. proof_url: "", // 驳回至
  642. companyNo: in_companyNo || "",
  643. goodtype: Number(sale_price) === 0 ? "2" : "1",
  644. managerid: [],
  645. manager: ""
  646. };
  647. }
  648. if (this.$refs.addrForm) {
  649. this.$refs.addrForm.resetFields();
  650. this.$refs.addrForm.clearValidate();
  651. this.addrForm = {
  652. order_addr: []
  653. };
  654. }
  655. });
  656. },
  657. openHouseModal(index) {
  658. const findex = this.addrForm.order_addr.findIndex(v => v.edit === true);
  659. if (findex !== -1) {
  660. this.$message.warning("当前已有地址在编辑,请保存后再试!");
  661. return;
  662. } else {
  663. if (index === -1) {
  664. this.addrForm.order_addr.push({
  665. edit: true,
  666. receipt_quantity: "",
  667. contactor: "",
  668. mobile: "",
  669. addr_code: [],
  670. addr: "",
  671. code: [],
  672. label: []
  673. });
  674. } else {
  675. this.addrForm.order_addr[index].edit = true;
  676. }
  677. }
  678. },
  679. async areaChange(e, index) {
  680. const { code, area_code, label, splitLabel } = e;
  681. // this.addrForm.order_addr[index] = e
  682. this.addrForm.order_addr[index].addr_code_name = splitLabel
  683. ? splitLabel.split(",").join("/")
  684. : "";
  685. this.addrForm.order_addr[index].addr_code = code ? code.split(",") : [];
  686. this.addrForm.order_addr[index].code = area_code ? [area_code] : [];
  687. this.addrForm.order_addr[index].label = label ? [label] : [];
  688. },
  689. // 省市区选择
  690. // async select_area_change(e, index) {
  691. // this.addrForm.order_addr[index].addr_code = e
  692. // const { addr_code } = this.addrForm.order_addr[index]
  693. // if (addr_code && addr_code.length === 3) {
  694. // const arrCode = addr_code[addr_code.length - 1]
  695. // // console.log(model);
  696. // const { code, data, message } = await asyncRequest.addrall({
  697. // code: arrCode
  698. // })
  699. // if (code === 0) {
  700. // const { province, city, area } = data
  701. // const province_name = province && province.name ? province.name : ''
  702. // const city_name = city && city.name ? city.name : ''
  703. // const area_name = area && area.name ? area.name : ''
  704. // this.addrForm.order_addr[index].addr_code_name =
  705. // province_name && city_name && area_name
  706. // ? `${province_name}/${city_name}/${area_name}`
  707. // : ''
  708. // } else if (code >= 100 && code <= 104) {
  709. // await this.logout()
  710. // } else {
  711. // this.$message.warning(message)
  712. // }
  713. // } else {
  714. // this.addrForm.order_addr[index].addr_code_name = ''
  715. // }
  716. // },
  717. // 省市区保存某一行
  718. checkRow(rowIndex) {
  719. this.$refs.addrForm.validate(valid => {
  720. if (valid) {
  721. this.addrForm.order_addr[rowIndex].edit = false;
  722. } else {
  723. console.log("error submit!!");
  724. return false;
  725. }
  726. });
  727. },
  728. // 省市区删除行操作
  729. deleteRow(index, rows) {
  730. rows.splice(index, 1);
  731. },
  732. async submitForm() {
  733. await this.$refs.ruleForm.validate(async valid => {
  734. if (valid) {
  735. if (this.loading) return;
  736. this.loading = true;
  737. const model = JSON.parse(JSON.stringify(this.ruleForm));
  738. model.manager = model.manager.toString();
  739. const { remark, bidNo, sale_price, manager, managerid, good_num , proof_type, proof_url} = model;
  740. const res = await asyncRequest.transferFilling({
  741. remark, bidNo, sale_price, manager, managerid, good_num , proof_type, proof_url,
  742. managerid:Array.isArray(managerid) ? managerid[0] : managerid
  743. });
  744. if (res && res.code === 0) {
  745. this.$notify.success({
  746. title: "转单成功!",
  747. message: ""
  748. });
  749. this.showModelThis = false;
  750. // 刷新
  751. this.$emit("refresh");
  752. this.loading = false;
  753. } else if (res && res.code >= 100 && res.code <= 104) {
  754. this.loading = false;
  755. await this.logout();
  756. } else {
  757. this.loading = false;
  758. this.$message.warning(res.message);
  759. }
  760. } else {
  761. console.log("error submit!!");
  762. return false;
  763. }
  764. });
  765. },
  766. // 图片上传成功
  767. async UploadSuccessEventproof_url(data) {
  768. const { url } = data;
  769. if (url === "noToken") {
  770. await this.logout();
  771. } else {
  772. this.img_url = url;
  773. this.set_proof_url();
  774. this.$message.success("图片上传成功!");
  775. }
  776. },
  777. // 图片上传失败
  778. UploadErrorEventproof_url(res) {
  779. if (res !== "break") {
  780. this.set_proof_url();
  781. this.$message.error("图片上传失败!");
  782. }
  783. },
  784. // 判断图片规格
  785. beforeAvatarUpload(file) {
  786. let isJPG = false;
  787. if (
  788. file.type === "image/jpg" ||
  789. file.type === "image/png" ||
  790. file.type === "image/jpeg"
  791. ) {
  792. isJPG = true;
  793. }
  794. const isLt2M = file.size / 1024 / 1024 < 1;
  795. if (!isJPG) {
  796. this.$message.error("图片格式不正确!");
  797. }
  798. if (!isLt2M) {
  799. this.$message.error("图片大小不能超过 1MB!");
  800. }
  801. return isJPG && isLt2M;
  802. },
  803. // 视频上传成功
  804. async UploadSuccessVideoproof_url(data) {
  805. const { url } = data;
  806. if (url === "noToken") {
  807. await this.logout();
  808. } else {
  809. this.video_url = url;
  810. this.set_proof_url();
  811. this.$message.success("视频上传成功!");
  812. }
  813. },
  814. // 视频上传失败
  815. UploadErrorVideoproof_url(res) {
  816. if (res !== "break") {
  817. this.set_proof_url();
  818. this.$message.error("视频上传失败!");
  819. }
  820. },
  821. // 判断视频规格
  822. beforeVideoUpload(file) {
  823. let isJPG = false;
  824. if (file.type === "video/mp4" || file.type === "video/avi") {
  825. isJPG = true;
  826. }
  827. const isLt2M = file.size / 1024 / 1024 < 10;
  828. if (!isJPG) {
  829. this.$message.error("视频格式不正确!");
  830. }
  831. if (!isLt2M) {
  832. this.$message.error("视频大小不能超过 10MB!");
  833. }
  834. return isJPG && isLt2M;
  835. },
  836. // 其他文件上传成功
  837. async UploadSuccessOtherproof_url(data) {
  838. const { url } = data;
  839. if (url === "noToken") {
  840. await this.logout();
  841. } else {
  842. this.other_url = url;
  843. this.set_proof_url();
  844. this.$message.success("文件成功!");
  845. }
  846. },
  847. // 其他文件上传失败
  848. UploadErrorOtherproof_url(res) {
  849. if (res !== "break") {
  850. this.set_proof_url();
  851. this.$message.error("文件上传失败!");
  852. }
  853. },
  854. // 判断其他文件规格
  855. beforeOtherUpload(file) {
  856. console.log(file);
  857. let isJPG = false;
  858. if (
  859. file.type === "application/vnd.ms-excel" ||
  860. file.type ===
  861. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
  862. file.type === "application/pdf" ||
  863. file.type === "application/x-zip-compressed"
  864. ) {
  865. isJPG = true;
  866. }
  867. const name = file.name;
  868. const list = name.split(".");
  869. if (list[list.length - 1] === "rar" || list[list.length - 1] === "7z") {
  870. isJPG = true;
  871. }
  872. const isLt2M = file.size / 1024 / 1024 < 5;
  873. if (!isJPG) {
  874. this.$message.error("文件格式不正确!");
  875. }
  876. if (!isLt2M) {
  877. this.$message.error("文件大小不能超过 5MB!");
  878. }
  879. return isJPG && isLt2M;
  880. },
  881. deleteUrl(type) {
  882. switch (type) {
  883. case "1":
  884. this.video_url = "";
  885. break;
  886. case "2":
  887. this.img_url = "";
  888. break;
  889. case "3":
  890. this.other_url = "";
  891. break;
  892. default:
  893. this.video_url = "";
  894. }
  895. this.set_proof_url();
  896. },
  897. set_proof_url() {
  898. const { proof_type } = this.ruleForm;
  899. switch (proof_type) {
  900. case "1":
  901. this.ruleForm.proof_url = this.video_url;
  902. break;
  903. case "2":
  904. this.ruleForm.proof_url = this.img_url;
  905. break;
  906. case "3":
  907. this.ruleForm.proof_url = this.other_url;
  908. break;
  909. default:
  910. this.ruleForm.proof_url = this.video_url;
  911. }
  912. this.$refs.ruleForm.validateField("proof_url");
  913. }
  914. }
  915. };
  916. </script>
  917. <style lang="scss" scoped>
  918. // .capitalClaim {
  919. .excelUploadBox {
  920. position: relative;
  921. width: 100%;
  922. height: 120px;
  923. line-height: 120px;
  924. box-sizing: border-box;
  925. &:hover {
  926. cursor: pointer;
  927. }
  928. .el-icon-receiving {
  929. width: 100%;
  930. text-align: center;
  931. height: 50px;
  932. display: block;
  933. font-size: 32px;
  934. line-height: 90px;
  935. color: #d3d4d6;
  936. }
  937. .boxM {
  938. width: 100%;
  939. display: block;
  940. text-align: center;
  941. line-height: 65px;
  942. height: 60px;
  943. color: #909399;
  944. }
  945. }
  946. .excelUpload {
  947. top: 0;
  948. left: 0;
  949. position: absolute;
  950. z-index: 2;
  951. width: 100%;
  952. height: 120px;
  953. line-height: 120px;
  954. box-sizing: border-box;
  955. }
  956. .excelUploadRes {
  957. width: 100%;
  958. height: 120px;
  959. line-height: 120px;
  960. box-sizing: border-box;
  961. i {
  962. width: 55px;
  963. height: 120px;
  964. line-height: 120px;
  965. text-align: center;
  966. font-size: 20px;
  967. &.fl {
  968. padding-left: 16px;
  969. }
  970. &.fr {
  971. padding-right: 16px;
  972. &:hover {
  973. cursor: pointer;
  974. }
  975. }
  976. }
  977. span {
  978. width: 386px;
  979. line-height: 16px;
  980. margin: 52px 0 0 0;
  981. font-size: 16px;
  982. }
  983. }
  984. // }
  985. </style>