sales-info.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935
  1. <template>
  2. <el-form
  3. :model="form"
  4. ref="queryForm"
  5. size="small"
  6. :inline="true"
  7. label-width="120px"
  8. :rules="rules"
  9. >
  10. <el-row>
  11. <el-col :span="24">
  12. <el-form-item prop="lookSalesVolume">
  13. <span slot="label">展示销量</span>
  14. <el-input
  15. v-model="form.lookSalesVolume"
  16. placeholder="请输入展示销量"
  17. clearable
  18. @input="passValue"
  19. />
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="24">
  23. <el-form-item prop="unit">
  24. <span slot="label">计量单位</span>
  25. <el-select
  26. v-model="form.unit"
  27. placeholder="请选择"
  28. @change="passValue"
  29. >
  30. <el-option
  31. v-for="item in measure"
  32. :key="item.dictLabel"
  33. :label="item.dictLabel"
  34. :value="item.dictLabel"
  35. >
  36. </el-option>
  37. </el-select>
  38. </el-form-item>
  39. </el-col>
  40. <el-col :span="24">
  41. <el-form-item>
  42. <span slot="label"><span class="required">*</span> 商品规格</span>
  43. <el-button @click="addSpecification" type="primary"
  44. >添加规格</el-button
  45. >
  46. <el-table :data="form.skuList" style="width: 100%; margin-top: 20px">
  47. <el-table-column prop="name" label="规格名称" width="140">
  48. <template slot-scope="scope">
  49. <el-input
  50. v-model="scope.row.skuSpecsList[0].specsName"
  51. placeholder="请输入规格名称"
  52. clearable
  53. maxlength="8"
  54. @input="passValue"
  55. show-word-limit
  56. />
  57. </template>
  58. </el-table-column>
  59. <el-table-column prop="address" label="规格内容" width="140">
  60. <template slot-scope="scope">
  61. <el-input
  62. v-model="scope.row.skuSpecsList[0].specsValue"
  63. placeholder="规格内容"
  64. clearable
  65. maxlength="8"
  66. show-word-limit
  67. @input="passValue"
  68. />
  69. </template>
  70. </el-table-column>
  71. <el-table-column prop="name" label="预计库存" width="140">
  72. <template slot-scope="scope">
  73. <el-input-number
  74. :controls="false"
  75. v-model="scope.row.predictStocks"
  76. placeholder="预计库存"
  77. clearable
  78. @input="passValue"
  79. >
  80. <template slot="suffix"> {{ form.unit }} </template>
  81. </el-input-number>
  82. </template>
  83. </el-table-column>
  84. <el-table-column prop="name" label="实际库存" width="140">
  85. <template slot-scope="scope">
  86. <el-input-number
  87. :controls="false"
  88. v-model="scope.row.stock"
  89. placeholder="实际库存"
  90. clearable
  91. @input="passValue"
  92. >
  93. <template slot="suffix"> {{ form.unit }} </template>
  94. </el-input-number>
  95. </template>
  96. </el-table-column>
  97. <el-table-column prop="address" label="起批量" width="140">
  98. <template slot-scope="scope">
  99. <el-input-number
  100. :controls="false"
  101. v-model="scope.row.skuPriceList[0].minPurchase"
  102. placeholder="起批量"
  103. clearable
  104. @input="passValue"
  105. >
  106. <template slot="suffix">
  107. {{ form.unit }}
  108. </template>
  109. </el-input-number>
  110. </template>
  111. </el-table-column>
  112. <el-table-column prop="address" label="收购价" width="140">
  113. <template slot-scope="scope">
  114. <el-input-number
  115. :controls="false"
  116. v-model="scope.row.skuCost.purchaseFee"
  117. placeholder="收购价"
  118. clearable
  119. @input="passValue"
  120. >
  121. <template slot="suffix"> {{ form.unit }}/元 </template>
  122. </el-input-number>
  123. </template>
  124. </el-table-column>
  125. <el-table-column prop="address" label="人工费" width="140">
  126. <template slot-scope="scope">
  127. <el-input-number
  128. :controls="false"
  129. v-model="scope.row.skuCost.laborFee"
  130. placeholder="人工费"
  131. clearable
  132. @input="passValue"
  133. >
  134. <template slot="suffix"> {{ form.unit }}/元 </template>
  135. </el-input-number>
  136. </template>
  137. </el-table-column>
  138. <el-table-column prop="address" label="代办费" width="140">
  139. <template slot-scope="scope">
  140. <el-input-number
  141. :controls="false"
  142. v-model="scope.row.skuCost.agencyFee"
  143. placeholder="代办费"
  144. clearable
  145. @input="passValue"
  146. >
  147. <template slot="suffix"> {{ form.unit }}/元 </template>
  148. </el-input-number>
  149. </template>
  150. </el-table-column>
  151. <el-table-column prop="address" label="材料费" width="140">
  152. <template slot-scope="scope">
  153. <el-input-number
  154. :controls="false"
  155. @input="passValue"
  156. v-model="scope.row.skuCost.materialFee"
  157. placeholder="材料费"
  158. clearable
  159. >
  160. <template slot="suffix"> {{ form.unit }}/元 </template>
  161. </el-input-number>
  162. </template>
  163. </el-table-column>
  164. <el-table-column
  165. prop="presaleTotalPrice"
  166. label="预售总价"
  167. width="140"
  168. v-if="saleModel == 2"
  169. >
  170. <template slot-scope="scope">
  171. <el-input-number
  172. :controls="false"
  173. @input="passValue"
  174. v-model="scope.row.skuPriceList[0].presaleTotalPrice"
  175. placeholder="预售总价"
  176. clearable
  177. >
  178. <template slot="suffix"> {{ form.unit }}/元 </template>
  179. </el-input-number>
  180. </template>
  181. </el-table-column>
  182. <el-table-column
  183. prop="address"
  184. label="预售定金"
  185. width="140"
  186. v-if="saleModel == 2"
  187. >
  188. <template slot-scope="scope">
  189. <el-input-number
  190. :controls="false"
  191. @input="passValue"
  192. v-model="scope.row.skuPriceList[0].downPayPrice"
  193. placeholder="预售定金"
  194. clearable
  195. >
  196. <template slot="suffix"> {{ form.unit }}/元 </template>
  197. </el-input-number>
  198. </template>
  199. </el-table-column>
  200. <el-table-column prop="address" label="商品单价" width="100">
  201. <template slot-scope="scope">
  202. {{ computePrice(scope.row) }}元/{{ form.unit }}
  203. </template>
  204. </el-table-column>
  205. <el-table-column prop="address" label="操作">
  206. <template slot-scope="scope">
  207. <el-button
  208. type="text"
  209. style="color: red"
  210. @click="removeSpecification(scope.row, scope.$index)"
  211. >删除</el-button
  212. >
  213. </template>
  214. </el-table-column>
  215. </el-table>
  216. </el-form-item>
  217. </el-col>
  218. <el-col :span="24" style="margin-top: 20px">
  219. <el-form-item>
  220. <span slot="label"><span class="required">*</span> 商品属性</span>
  221. <div class="main">
  222. <div style="padding-top: 20px">
  223. <el-form-item label="包装方式" prop="packing">
  224. <el-select
  225. v-model="form.packing"
  226. placeholder="请选择包装方式"
  227. @change="passValue"
  228. >
  229. <el-option
  230. v-for="item in package"
  231. :key="item.dictLabel"
  232. :label="item.dictLabel"
  233. :value="item.dictLabel"
  234. >
  235. </el-option>
  236. </el-select>
  237. </el-form-item>
  238. <el-form-item prop="shippingTimeDesc">
  239. <span slot="label">发货时间</span>
  240. <el-select
  241. v-model="form.shippingTimeDesc"
  242. placeholder="请选择发货时间"
  243. @change="passValue"
  244. >
  245. <el-option label="付款24小时之内" value="付款24小时之内" />
  246. <el-option label="付款36小时之内" value="付款36小时之内" />
  247. <el-option label="付款48小时之内" value="付款48小时之内" />
  248. <el-option label="付款72小时之内" value="付款72小时之内" />
  249. </el-select>
  250. </el-form-item>
  251. <template v-if="salesCategory == 1">
  252. <el-form-item>
  253. <span slot="label">产地</span>
  254. <el-cascader
  255. v-model="form.producerIds"
  256. :options="areaoptions"
  257. @change="handleChange"
  258. ref="cascader"
  259. :props="propsarea"
  260. collapse-tags
  261. ></el-cascader>
  262. </el-form-item>
  263. <el-form-item prop="producerAddrDetail">
  264. <span slot="label">详细地址</span>
  265. <el-input
  266. @input="passValue"
  267. v-model="form.producerAddrDetail"
  268. placeholder="请输入产地详细地址"
  269. clearable
  270. >
  271. </el-input>
  272. </el-form-item>
  273. <el-form-item prop="squareMeasureUnit">
  274. <span slot="label">面积单位</span>
  275. <el-select
  276. v-model="form.squareMeasureUnit"
  277. placeholder="请选择面积单位"
  278. @change="passValue"
  279. >
  280. <el-option label="平方米" value="平方米"> </el-option>
  281. <el-option label="公顷" value="公顷"> </el-option>
  282. </el-select>
  283. </el-form-item>
  284. <el-form-item prop="squareMeasure">
  285. <span slot="label">面积</span>
  286. <el-input
  287. @input="passValue"
  288. v-model="form.squareMeasure"
  289. placeholder="请输入面积"
  290. clearable
  291. >
  292. <template slot="suffix">
  293. {{ form.squareMeasureUnit }}</template
  294. >
  295. </el-input>
  296. </el-form-item>
  297. <el-form-item prop="yield">
  298. <span slot="label">产量单位</span>
  299. <el-select
  300. v-model="form.yieldUnit"
  301. placeholder="请选择产量单位"
  302. @change="passValue"
  303. >
  304. <el-option label="千克" value="千克"> </el-option>
  305. <el-option label="吨" value="吨"> </el-option>
  306. </el-select>
  307. </el-form-item>
  308. <el-form-item prop="yields">
  309. <span slot="label">产量</span>
  310. <el-input
  311. @input="passValue"
  312. v-model="form.yields"
  313. placeholder="请输入产量"
  314. clearable
  315. >
  316. <template slot="suffix">{{ form.yieldUnit }}</template>
  317. </el-input>
  318. </el-form-item>
  319. <el-form-item prop="variety">
  320. <span slot="label">品种</span>
  321. <el-input
  322. @input="passValue"
  323. v-model="form.variety"
  324. placeholder="请输入品种名称"
  325. clearable
  326. >
  327. </el-input>
  328. </el-form-item>
  329. </template>
  330. </div>
  331. <el-form-item
  332. label="自定义属性"
  333. v-if="form.props && form.props.length > 0"
  334. >
  335. <div
  336. style="
  337. width: 100%;
  338. display: flex;
  339. flex-direction: row;
  340. flex-flow: wrap;
  341. justify-content: center;
  342. "
  343. >
  344. <div
  345. class="item"
  346. v-for="(item, index) in form.props ? form.props : []"
  347. :key="index"
  348. >
  349. <el-input
  350. v-model="item.name"
  351. placeholder="请输入属性名称"
  352. clearable
  353. maxlength="8"
  354. show-word-limit
  355. style="width: 200px"
  356. />
  357. <el-input
  358. v-model="item.value"
  359. placeholder="请输入属性值"
  360. clearable
  361. maxlength="8"
  362. show-word-limit
  363. @input="passValue"
  364. style="width: 200px"
  365. />
  366. <i
  367. class="el-icon-delete"
  368. size="22"
  369. style="color: red"
  370. @click="removeAttribute(item, index)"
  371. ></i>
  372. </div>
  373. </div>
  374. </el-form-item>
  375. </div>
  376. <div class="item1" style="width: 180px">
  377. <span @click="addattribute" style="cursor: pointer">
  378. <i class="el-icon-plus" size="22"></i>自定义添加商品属性</span
  379. >
  380. </div>
  381. </el-form-item>
  382. </el-col>
  383. <el-col :span="24">
  384. <el-form-item prop="merchantClassifyIds">
  385. <span slot="label">店铺内所属分类</span>
  386. <el-cascader
  387. :filterable="true"
  388. v-model="form.merchantClassifyIds"
  389. ref="formCascader"
  390. :placeholder="
  391. form.merchantClassifyName
  392. ? form.merchantClassifyName
  393. : '请选择分类'
  394. "
  395. :props="categoryprops"
  396. @change="cascaderChange"
  397. />
  398. </el-form-item>
  399. </el-col>
  400. <el-col :span="24" style="margin-top: 20px">
  401. <el-form-item prop="freeShipping">
  402. <span slot="label">运费</span>
  403. <div class="main1">
  404. <el-radio-group
  405. v-model="form.freeShipping"
  406. class="radios"
  407. @change="passValue"
  408. >
  409. <el-radio :label="0" :value="0"
  410. >双方协商后卖家进行修改,买家和订单一起支付</el-radio
  411. >
  412. <el-radio :label="1" :value="1"
  413. >全国包邮,由卖家承担运费</el-radio
  414. >
  415. </el-radio-group>
  416. </div>
  417. </el-form-item>
  418. </el-col>
  419. <el-col :span="24" style="margin-top: 20px">
  420. <el-form-item prop="shippingAddrId">
  421. <span slot="label"> 发货地址</span>
  422. <el-select
  423. v-model="form.shippingAddrId"
  424. placeholder="请选择"
  425. style="width: 300px"
  426. @change="passValue"
  427. >
  428. <el-option
  429. v-for="item in options"
  430. :key="item.id"
  431. :label="
  432. item.defaultTag == 1 ? '默认-' + item.address : item.address
  433. "
  434. :value="item.id"
  435. >
  436. </el-option>
  437. </el-select>
  438. <el-button type="text" @click="areaAdd" style="margin-left: 10px">
  439. 没有所需地址?前去添加</el-button
  440. >
  441. </el-form-item>
  442. </el-col>
  443. <el-col :span="24">
  444. <el-form-item prop="shareRate">
  445. <span slot="label">分享比例</span>
  446. <el-input-number
  447. v-model="form.shareRate"
  448. :min="0"
  449. :max="100"
  450. placeholder="请输入分享比例"
  451. :controls="false"
  452. @change="passValue"
  453. >
  454. </el-input-number
  455. >%
  456. </el-form-item>
  457. </el-col>
  458. <el-col :span="24">
  459. <el-form-item prop="returnVoucherRatio">
  460. <span slot="label"
  461. >返券比例(%)
  462. <el-tooltip
  463. effect="dark"
  464. content="返券比例:用户下单该商品后,交易完成后可获得商品金额的X%的代金券奖励,该代金券只可在本店铺使用"
  465. placement="top-start"
  466. >
  467. <i class="el-icon-question"></i>
  468. </el-tooltip>
  469. </span>
  470. <el-input-number
  471. v-model="form.returnVoucherRatio"
  472. :min="0"
  473. :max="100"
  474. placeholder="请输入返券比例"
  475. :controls="false"
  476. @change="passValue"
  477. >
  478. </el-input-number
  479. >%
  480. </el-form-item>
  481. </el-col>
  482. </el-row>
  483. <Amap ref="mapOpen" @address="Mapaddress"></Amap>
  484. </el-form>
  485. </template>
  486. <script>
  487. import cityJson from "@/assets/city.json";
  488. import { getMerchantClassifyList } from "@/api/sort/index.js";
  489. import { getStoreInfo } from "@/api/common/index";
  490. import { getCityTreeNew } from "@/api/manage/material.js";
  491. import Amap from "@/components/Map/map.vue";
  492. import { getDict } from "@/api/common/index.js";
  493. import { dxAddressList } from "@/api/manage/address";
  494. export default {
  495. props: ["data", "saleType", "saleModels", "salesCategory"],
  496. components: { Amap },
  497. data() {
  498. return {
  499. form: {
  500. expressType: 0,
  501. unit: "斤",
  502. props: [],
  503. freeShipping: 0,
  504. lookSalesVolume: "",
  505. shippingAddrBean: {
  506. addr: "",
  507. addrDetail: "",
  508. cityCode: "",
  509. countyCode: "",
  510. latitude: "",
  511. longitude: "",
  512. provinceCode: "",
  513. },
  514. shippingAddr: "",
  515. skuList: [],
  516. packing: "",
  517. shippingTimeDesc: "",
  518. merchantClassifyId: "",
  519. merchantClassifyIds: [],
  520. merchantClassifyName: "",
  521. shippingAddrId: "",
  522. yields: "",
  523. },
  524. addr: "",
  525. measure: [],
  526. package: [],
  527. rules: {
  528. freeShipping: [
  529. { required: true, message: "请选择运费方式", trigger: "blur" },
  530. ],
  531. props: [
  532. { required: true, message: "商品属性不能为空", trigger: "blur" },
  533. ],
  534. unit: [
  535. { required: true, message: "计量单位不能为空", trigger: "blur" },
  536. ],
  537. shippingTimeDesc: [
  538. { required: true, message: "发货时间不能为空", trigger: "blur" },
  539. ],
  540. skuList: [{ required: true, message: "规格不能为空", trigger: "blur" }],
  541. packing: [
  542. { required: true, message: "包装方式不能为空", trigger: "blur" },
  543. ],
  544. shippingAddrId: [
  545. { required: true, message: "请选择地址", trigger: "blur" },
  546. ],
  547. merchantClassifyIds: [
  548. { required: true, message: "店铺所属分类不能为空", trigger: "blur" },
  549. ],
  550. },
  551. propsarea: {
  552. label: "name",
  553. value: "code",
  554. children: "childList",
  555. },
  556. shopInfo: {},
  557. saleType: undefined,
  558. sj: true,
  559. skuIds: [],
  560. saleModel: 1,
  561. categoryprops: {
  562. checkStrictly: true,
  563. lazy: true,
  564. lazyLoad: this.categoryLazyLoad,
  565. label: "label",
  566. value: "value",
  567. },
  568. options: [],
  569. areaoptions: [],
  570. };
  571. },
  572. watch: {
  573. //监听文件url改变时重新赋值
  574. saleModels(newVal, oldVal) {
  575. this.saleModel = newVal;
  576. this.$forceUpdate();
  577. },
  578. },
  579. mounted() {
  580. this.getArea();
  581. this.getInfo();
  582. this.getdictImpl();
  583. this.getAreaList();
  584. },
  585. methods: {
  586. getArea() {
  587. console.log(cityJson);
  588. this.areaoptions = cityJson;
  589. },
  590. handleChange(val) {
  591. const cascader = this.$refs.cascader;
  592. const selectedLabels = cascader.getCheckedNodes();
  593. this.form.producerAddr = selectedLabels[0].pathLabels.join("");
  594. },
  595. areaAdd() {
  596. this.$router.push({ path: "/manage/manage/address/index" });
  597. },
  598. getAreaList() {
  599. dxAddressList().then((res) => {
  600. if (res.code == 200) {
  601. this.options = res.data;
  602. let defaults = this.options.filter((item) => {
  603. // 根据搜索文本过滤,不区分大小写
  604. return item.defaultTag == 1;
  605. });
  606. this.form.shippingAddrId = defaults[0].id;
  607. }
  608. });
  609. },
  610. categoryLazyLoad(node, resolve) {
  611. let level = node.level;
  612. if (!node.data) {
  613. getMerchantClassifyList({ classifyType: 1, isDefault: 1 }).then(
  614. (res) => {
  615. //接口
  616. const nodes = Array.from(res.data).map((item, index) => ({
  617. value: item.id,
  618. label: `${item.classifyName}`,
  619. leaf: level >= 2,
  620. }));
  621. // 通过调用resolve将子节点数据返回,通知组件数据加载完成
  622. resolve(nodes);
  623. }
  624. );
  625. } else if (level == 1) {
  626. getMerchantClassifyList({
  627. parentId: node.data.value,
  628. classifyType: 1,
  629. }).then((res) => {
  630. const nodes = Array.from(res.data).map((item) => ({
  631. value: item.id,
  632. label: `${item.classifyName}`,
  633. leaf: level >= 2,
  634. // level: 2,
  635. }));
  636. // 通过调用resolve将子节点数据返回,通知组件数据加载完成
  637. resolve(nodes);
  638. });
  639. } else {
  640. resolve({});
  641. }
  642. },
  643. cascaderChange(val) {
  644. const dom = document.getElementsByClassName("el-radio is-checked");
  645. //这里我把dom打出来看了 最后一个选项才是我选中的节点 即[length-1] 有的博主写的是 第一个元素 即[0] 大家自行尝试
  646. let radioDom = dom[dom.length - 1];
  647. const brother = radioDom.nextElementSibling;
  648. let nodes = this.$refs.formCascader.getCheckedNodes();
  649. this.form.merchantClassifyName = nodes[0].label;
  650. this.form.merchantClassifyIds = val;
  651. this.form.merchantClassifyId = JSON.stringify(val);
  652. brother.click();
  653. // this.form.merchantClassifyId = `["${this.form.merchantClassifyId.join('')}"]`;
  654. this.passValue();
  655. },
  656. getFormInfo(record) {
  657. // 基础属性赋值
  658. const {
  659. shippingAddrId,
  660. merchantClassifyName,
  661. saleModel,
  662. shippingAddr: addr,
  663. expressType,
  664. shareRate,
  665. merchantClassifyId,
  666. lookSalesVolume,
  667. unit,
  668. packing,
  669. shippingTimeDesc,
  670. freeShipping,
  671. skuList,
  672. returnVoucherRatio,
  673. producerAddr,
  674. producerAddrDetail,
  675. squareMeasure,
  676. squareMeasureUnit,
  677. variety,
  678. producerIds,
  679. yieldUnit,
  680. props = [], // 默认空数组避免后续判断
  681. } = record;
  682. // 更新表单数据
  683. this.form = {
  684. producerIds: JSON.parse(producerIds).map(String),
  685. ...this.form, // 保留原有属性
  686. producerAddr,
  687. yieldUnit,
  688. squareMeasure,
  689. producerAddrDetail,
  690. squareMeasureUnit,
  691. variety,
  692. shippingAddrId: JSON.stringify(shippingAddrId),
  693. merchantClassifyName,
  694. returnVoucherRatio,
  695. expressType,
  696. shareRate,
  697. merchantClassifyIds: merchantClassifyId,
  698. merchantClassifyId,
  699. lookSalesVolume,
  700. unit,
  701. shippingAddr: addr,
  702. packing,
  703. shippingTimeDesc,
  704. freeShipping: freeShipping,
  705. skuList,
  706. props, // 已默认处理空值情况
  707. shippingAddrBean: {
  708. addr,
  709. addrDetail: record.shippingAddrBean?.addrDetail,
  710. cityCode: record.cityCode,
  711. countyCode: record.countyCode,
  712. latitude: record.latitude,
  713. longitude: record.longitude,
  714. provinceCode: record.provinceCode,
  715. },
  716. };
  717. this.form.yields = record.yield;
  718. console.log('zzz',this.form);
  719. // 独立处理特殊属性
  720. this.saleModel = saleModel;
  721. this.addr = addr;
  722. },
  723. compilatePrice(data) {
  724. if (data.price) {
  725. return data.price.toFixed(2);
  726. } else if (data.originalPrice) {
  727. return data.originalPrice.toFixed(2);
  728. } else if (data.originalPrice && data.price) {
  729. return data.price.toFixed(2);
  730. }
  731. },
  732. formvalidate() {
  733. let that = this;
  734. return new Promise((resolve) => {
  735. that.$refs.queryForm.validate((valid, row) => {
  736. if (valid) {
  737. resolve(valid);
  738. } else {
  739. for (const key in row) {
  740. for (let index = 0; index < row[key].length; index++) {
  741. this.$message.error(row[key][index].message);
  742. return;
  743. }
  744. }
  745. resolve(valid);
  746. }
  747. });
  748. });
  749. },
  750. getInfo() {
  751. getStoreInfo().then((res) => {
  752. if (res.code == 200) {
  753. this.shopInfo = res.data;
  754. }
  755. });
  756. },
  757. getdictImpl() {
  758. getDict("stockUnit").then((res) => {
  759. if (res.code == 200) {
  760. this.measure = res.data;
  761. }
  762. });
  763. getDict("packType").then((res) => {
  764. if (res.code == 200) {
  765. this.package = res.data;
  766. }
  767. });
  768. },
  769. computePrice(data) {
  770. if (
  771. data.skuCost.purchaseFee &&
  772. data.skuCost.laborFee &&
  773. data.skuCost.agencyFee &&
  774. data.skuCost.materialFee
  775. ) {
  776. return (
  777. Number(data.skuCost.purchaseFee) +
  778. Number(data.skuCost.laborFee) +
  779. Number(data.skuCost.agencyFee) +
  780. Number(data.skuCost.materialFee)
  781. ).toFixed(2);
  782. } else {
  783. return 0;
  784. }
  785. },
  786. passValue() {
  787. this.form.skuList.forEach((e) => {
  788. e.skuPriceList.forEach((a) => {
  789. e.presaleTotalPrice = a.presaleTotalPrice;
  790. e.downPayPrice = a.downPayPrice;
  791. a.price = this.computePrice(e);
  792. a.originalPrice = this.computePrice(e);
  793. a.lowestPrice = this.computePrice(e);
  794. });
  795. });
  796. this.$emit("updateValue", this.form);
  797. },
  798. Mapaddress(data) {
  799. this.form.shippingAddr = data.pname + data.cityname + data.adname;
  800. this.form.shippingAddrBean.addr = data.address;
  801. // this.form.shippingAddrBean.addrDetail = data.name ? data.name : undefined;
  802. this.form.shippingAddrBean.cityCode = data.cityCode;
  803. this.form.shippingAddrBean.countyCode = data.adcode;
  804. if (data.location) {
  805. this.form.shippingAddrBean.latitude = data.location.lat;
  806. this.form.shippingAddrBean.longitude = data.location.lng;
  807. }
  808. this.form.shippingAddrBean.provinceCode = data.pcode;
  809. this.addr = data.address;
  810. this.$refs.mapOpen.closeMap();
  811. // this.passValue();
  812. },
  813. selectAddr() {
  814. this.$refs.mapOpen.loadMap();
  815. },
  816. addattribute() {
  817. if (this.form.prop?.length > 0) {
  818. this.form.props.push({
  819. name: "",
  820. id: "",
  821. value: "",
  822. });
  823. } else {
  824. this.form.prop = [];
  825. this.form.props.push({
  826. name: "",
  827. id: "",
  828. value: "",
  829. });
  830. }
  831. },
  832. removeAttribute(record, index) {
  833. this.form.props.splice(index, 1);
  834. this.passValue();
  835. },
  836. removeSpecification(record, index) {
  837. console.log("record", record.id);
  838. this.skuIds.push(record.id);
  839. this.form.skuList.splice(index, 1);
  840. this.$emit("skuRemove", this.skuIds);
  841. },
  842. addSpecification() {
  843. if (!this.form.skuList) {
  844. this.form.skuList = [];
  845. }
  846. this.form.skuList.push({
  847. stock: undefined,
  848. weight: undefined,
  849. sj: true,
  850. skuCost: {
  851. purchaseFee: undefined,
  852. laborFee: undefined,
  853. agencyFee: undefined,
  854. materialFee: undefined,
  855. },
  856. skuSpecsList: [
  857. {
  858. specsId: "0",
  859. specsName: "",
  860. specsValue: "",
  861. },
  862. ],
  863. skuPriceList: [
  864. {
  865. minPurchase: undefined,
  866. maxPurchase: undefined,
  867. price: undefined,
  868. originalPrice: undefined,
  869. lowestPrice: 1,
  870. },
  871. ],
  872. });
  873. },
  874. },
  875. };
  876. </script>
  877. <style>
  878. .el-upload-list__item {
  879. transition: none !important;
  880. -webkit-transition: nonne !important;
  881. }
  882. .el-upload-list__item-name {
  883. transition: none !important;
  884. -webkit-transition: nonne !important;
  885. }
  886. </style>
  887. <style scoped>
  888. /deep/ .el-radio-group {
  889. display: flex;
  890. flex-direction: column;
  891. justify-content: space-around;
  892. height: 50px;
  893. }
  894. .item {
  895. display: flex;
  896. flex-direction: row;
  897. align-items: center;
  898. margin-bottom: 20px;
  899. margin-right: 10px;
  900. }
  901. .main1 {
  902. background: #f1f1f1;
  903. min-height: 80px;
  904. display: flex;
  905. flex-direction: row;
  906. flex-wrap: wrap;
  907. align-items: center;
  908. padding: 0px 20px;
  909. }
  910. .main {
  911. width: 58vw;
  912. background: #f1f1f1;
  913. min-height: 80px;
  914. display: flex;
  915. flex-direction: column;
  916. align-items: flex-start;
  917. /* display: flex;
  918. flex-direction: row;
  919. flex-wrap: wrap;
  920. align-items: center;
  921. padding: 20px 20px 0px 20px; */
  922. }
  923. </style>