潘超林 1 month ago
parent
commit
4f60c46702

+ 35 - 0
src/api/manage/address.js

@@ -0,0 +1,35 @@
+import request from '@/utils/request'
+
+export function dxAddressList(query) {
+    return request({
+        url: '/system/dxAddress/list',
+        method: 'get',
+        params: query
+    })
+}
+export function getWarehouseInfo(query) {
+  return request({
+      url: '/system/dxAddress/getWarehouseInfo',
+      method: 'get',
+      params: query
+  })
+}
+export function saveOrUpdate(query) {
+  return request({
+      url: '/system/dxAddress/saveOrUpdate',
+      method: 'post',
+      data: query
+  })
+}
+export function dxAddressDelete(query) {
+  return request({
+      url: '/system/dxAddress/delete/'+query,
+      method: 'get',
+  })
+}
+export function dxAddressInfo(query) {
+  return request({
+      url: '/system/dxAddress/info/'+query,
+      method: 'get',
+  })
+}

+ 159 - 0
src/views/manage/address/index.vue

@@ -0,0 +1,159 @@
+<template>
+  <div style="padding: 20px">
+    <div>
+      <div class="header">
+        <h3>发货地址</h3>
+        <el-button type="primary" size="small" @click="addInfo">添加</el-button>
+      </div>
+
+      <span style="color: orange"
+        >*设置后,发布批发商品时,可选择已设置地址</span
+      >
+    </div>
+    <div>
+      <el-row
+        style="
+          margin-top: 20px;
+          display: flex;
+          flex-direction: row;
+          flex-wrap: wrap;
+          min-height: 250px;
+        "
+      >
+        <el-col :span="12" v-for="(item, index) in list" :key="index">
+          <el-card class="box-card" style="width: 90%">
+            <div
+              style="
+                display: flex;
+                flex-direction: row;
+                align-items: center;
+                justify-content: space-between;
+              "
+            >
+              <div>
+                <el-tag v-if="item.defaultTag == 1" style="margin-right: 20px">
+                  默认
+                </el-tag>
+                <span>{{ item.address }}</span>
+              </div>
+              <div>
+                <el-button type="text" @click="edit(item)">编辑</el-button>
+                <el-button type="text" @click="remove(item)" style="color: red"
+                  >删除</el-button
+                >
+              </div>
+            </div>
+          </el-card>
+        </el-col>
+      </el-row>
+    </div>
+    <Amap ref="mapOpen" @address="Mapaddress"></Amap>
+  </div>
+</template>
+
+<script>
+import Amap from "./map.vue";
+import {
+  dxAddressList,
+  dxAddressDelete,
+  saveOrUpdate,
+  dxAddressInfo,
+} from "@/api/manage/address";
+export default {
+  components: { Amap },
+  data() {
+    return {
+      list: [],
+      adddata: {},
+    };
+  },
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    getList() {
+      dxAddressList().then((res) => {
+        if (res.code == 200) {
+          this.list = res.data;
+        }
+      });
+    },
+    edit(item) {
+      dxAddressInfo(item.id).then((res) => {
+        if (res.code == 200) {
+          this.$refs.mapOpen.loadMap(res.data);
+        }
+      });
+    },
+    Mapaddress(data) {
+      console.log(data);
+      this.$refs.mapOpen.closeMap();
+      let params = {
+        addr: data.map?.address || data.form?.address || "", // 地址,字符串类型,非必填
+        addrDetail: data.form?.addrDetail || "", // 详细地址,字符串类型,非必填
+        cityCode: data.map?.cityCode || data.form?.cityCode || "", // 市级代码,int32类型,非必填
+        cityName: data.map?.cityname || data.form?.cityName || "", // 市名称,字符串类型,非必填
+        countyCode: data.map?.adcode || data.form?.countyCode || "", // 区县级代码,int32类型,非必填
+        countyName: data.map?.adname || data.form?.countyName || "", // 区县名称,字符串类型,非必填
+        defaultTag: data.form?.defaultTag || 0, // 是否默认标签 1-默认,int32类型,非必填
+        latitude: data.map?.location?.lat || data.form?.latitude || "", // 纬度,字符串类型,非必填
+        longitude: data.map?.location?.lng || data.form?.longitude || "", // 经度,字符串类型,非必填
+        provinceCode: data.map?.pcode || data.form?.provinceCode || "", // 省级代码,int32类型,非必填
+        provinceName: data.map?.pname || data.form?.provinceName || "", // 省名称,字符串类型,非必填
+        id: data.form?.id || "",
+        storeHouse: data.form?.storeHouse
+          ? JSON.stringify({
+              storeHouseId: data.form.storeHouse.id || "",
+              storeHouseName: data.form.storeHouse.name || "",
+            })
+          : "",
+      };
+      saveOrUpdate(params).then((res) => {
+        if (res.code == 200) {
+          if (params.id) {
+            this.$message.success("修改成功!");
+          } else {
+            this.$message.success("新增成功!");
+          }
+
+          this.getList();
+        }
+      });
+    },
+
+    remove(item) {
+      this.$confirm("是否确认删除收获地址", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          dxAddressDelete(item.id).then((res) => {
+            if (res.code == 200) {
+              this.$message.success("删除成功!");
+              this.getList();
+            }
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
+    addInfo() {
+      this.$refs.mapOpen.loadMap();
+    },
+  },
+};
+</script>
+
+<style scoped>
+.header {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+}
+</style>

+ 369 - 0
src/views/manage/address/map.vue

@@ -0,0 +1,369 @@
+<template>
+  <el-dialog
+    title="地图选点"
+    :visible.sync="dialogVisible"
+    width="1200px"
+    :before-close="dialogVisible == false"
+    :destroy-on-close="true"
+  >
+    <div>
+      <el-input
+        placeholder="请输入内容"
+        v-model="input"
+        class="input-with-select"
+        id="input"
+        style="width: 90%"
+      >
+      </el-input>
+      <el-button
+        type="primary"
+        icon="el-icon-search"
+        @click="autoInput"
+      ></el-button>
+    </div>
+    <div style="margin-top: 10px">已选择地址:{{ address }}</div>
+    <div id="container" style="margin-top: 10px"></div>
+
+    <el-form
+      label-width="120px"
+      :model="form"
+      :rules="rules"
+      ref="ruleForm"
+      style="margin-top: 30px"
+    >
+      <el-form-item label="详情地址" prop="addrDetail">
+        <el-input v-model="form.addrDetail" style="width: 500px"></el-input>
+      </el-form-item>
+      <el-form-item label="仓库" prop="storeHouse">
+        <el-select
+          value-key="value"
+          clearable
+          v-model="form.storeHouseId"
+          placeholder="请选择"
+          @change="selectChange"
+          style="width: 300px"
+        >
+          <el-option
+            v-for="(item, index) in houseList"
+            :label="item.name"
+            :key="index"
+            :value="item.id"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="设为默认地址">
+        <el-switch
+          v-model="form.defaultTag"
+          active-color="#13ce66"
+          inactive-color="#ff4949"
+          :active-value="1"
+          :inactive-value="0"
+        >
+        </el-switch>
+      </el-form-item>
+    </el-form>
+
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="closeMap">取 消</el-button>
+      <el-button type="primary" @click="SubmitMapPoint">确 定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<style scoped>
+#container {
+  padding: 0px;
+  margin: 0px;
+  width: 100%;
+  height: 500px;
+}
+</style>
+<script>
+import { getWarehouseInfo } from "@/api/manage/address";
+import AMapLoader from "@amap/amap-jsapi-loader";
+export default {
+  data() {
+    return {
+      map: null,
+      marker: null,
+      geocoder: null,
+      dialogVisible: false,
+      input: "",
+      markers: [],
+      address: "",
+      addressParams: {},
+      form: {
+        storeHouseId: "",
+      },
+      rules: {
+        addrDetail: [
+          { required: true, message: "请填写详细地址", trigger: "blur" },
+        ],
+      },
+      houseList: [],
+    };
+  },
+  mounted() {
+    this.initAMap();
+  },
+  unmounted() {
+    this.map?.destroy();
+  },
+  methods: {
+    selectChange(val) {
+      if (!val) this.form.storeHouse = "";
+    },
+    loadMap(data) {
+      // 处理传入的数据
+      if (data) {
+        if (typeof data.cityCode === "number") {
+          this.gethouse(data.cityCode);
+        }
+        this.form = {
+          ...data,
+          defaultTag: data.defaultTag ?? 0,
+          storeHouseId: JSON.parse(data.storeHouse).storeHouseId,
+        };
+        console.log(JSON.parse(data.storeHouse));
+        // 构建完整地址
+        this.address = [
+          data.provinceName,
+          data.cityName,
+          data.countyName,
+          data.addr,
+        ]
+          .filter(Boolean)
+          .join("");
+        // 获取仓库信息
+      } else {
+        this.form = {};
+      }
+      this.dialogVisible = true;
+      this.initAMap();
+    },
+
+    closeMap() {
+      this.address = "";
+      this.input = "";
+      this.dialogVisible = false;
+      this.form = {};
+      this.map?.destroy();
+    },
+    SubmitMapPoint() {
+      const selectedHouse = this.houseList.find(
+        (item) => item.id === this.form.storeHouseId
+      );
+      let params = {
+        name: selectedHouse.name,
+        id: selectedHouse.id,
+      };
+      this.form.storeHouse = params;
+      if (!this.address) {
+        this.$message.error("请先在地图选择省市区!");
+        return;
+      }
+      this.$refs.ruleForm.validate((valid) => {
+        if (valid) {
+          let params = {
+            map: this.addressParams,
+            form: this.form,
+          };
+          this.$emit("address", params);
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+
+    gethouse(cityCode) {
+      getWarehouseInfo({ cityCode: cityCode }).then((res) => {
+        if (res.code == 200) {
+          this.houseList = res.data;
+        }
+      });
+    },
+
+    // 获取搜索信息
+    autoInput() {
+      let that = this;
+      var keywords = this.input;
+      if (this.markers.length > 0) {
+        this.map.remove(this.markers);
+      }
+      AMap.plugin(["AMap.PlaceSearch"], function () {
+        //构造地点查询类
+        var placeSearch = new AMap.PlaceSearch({
+          pageSize: 5, // 单页显示结果条数
+          pageIndex: 1, // 页码
+          map: that.map, // 展现结果的地图实例
+          // panel: "panel", // 结果列表将在此容器中进行展示。
+          autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
+        });
+        placeSearch.search(keywords);
+        placeSearch.on("markerClick", function (e) {
+          let obj = { ...e.data };
+          obj.address =
+            e.data.pname +
+            "" +
+            e.data.cityname +
+            "" +
+            e.data.adname +
+            "" +
+            e.data.address +
+            "" +
+            e.data.name;
+          e.data.cityCode = obj.adcode.substring(0, 4) + "00";
+          that.addressParams = obj;
+          that.address = obj.address;
+          that.gethouse(e.data.cityCode);
+        });
+      });
+    },
+
+    getLocation() {
+      const _this = this;
+      AMap.plugin("AMap.CitySearch", function () {
+        var citySearch = new AMap.CitySearch();
+        citySearch.getLocalCity(function (status, result) {
+          if (status === "complete" && result.info === "OK") {
+            console.log(result.rectangle.split(";"));
+            let xy = result.rectangle.split(";")[0].split(",");
+            console.log("xxx", _this.map.getCenter());
+            _this.map.setCenter(xy);
+          }
+        });
+      });
+    },
+    initAMap() {
+      window._AMapSecurityConfig = {
+        securityJsCode: "aae243a4d33170d5331abec91fe2cd0c",
+      };
+      let that = this;
+      AMapLoader.load({
+        key: "2e75f4c22217359628e22c2e170b4778", // 申请好的Web端开发者Key,首次调用 load 时必填
+        version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
+        plugins: [
+          "AMap.Geocoder",
+          "AMap.Autocomplete",
+          "AMap.PlaceSearch",
+          "AMap.Scale",
+          "AMap.OverView",
+          "AMap.Geolocation",
+          "AMap.ToolBar",
+          "AMap.MapType",
+          "AMap.PolyEditor",
+          "AMap.CircleEditor",
+        ], //需要使用的的插件列表,如比例尺'AMap.Scale',支持添加多个如:['...','...']
+      })
+        .then((AMap) => {
+          that.map = new AMap.Map("container", {
+            // 设置地图容器id
+            viewMode: "2D", // 是否为3D地图模式
+            zoom: 11, // 初始化地图级别.
+            resizeEnable: true,
+          });
+          that.geocoder = new AMap.Geocoder();
+          that.map.on("click", that.handleMapClick);
+
+          setTimeout(() => {
+            that.getLocation();
+          }, 500);
+        })
+        .catch((e) => {
+          console.log(e);
+        });
+    },
+    handleMapClick(e) {
+      if (this.marker) {
+        if (this.marker) {
+          this.marker.setMap(null);
+          this.marker = null;
+        }
+      }
+      if (!this.marker) {
+        this.marker = new AMap.Marker({
+          icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
+          position: [e.lnglat.lng, e.lnglat.lat],
+          imageSize: new AMap.Size(12, 12),
+          offset: new AMap.Pixel(-13, -30),
+        });
+        this.marker.setMap(this.map);
+        this.regeoCode(e.lnglat);
+      }
+    },
+    markerBlur(e) {
+      console.log(e);
+    },
+    regeoCode(lnglat) {
+      let that = this;
+      this.map.add(this.marker);
+      this.marker.setPosition(lnglat);
+      // 创建高德地图的 Geocoder 实例
+      this.geocoder.getAddress(lnglat, function (status, result) {
+        if (status === "complete" && result.regeocode) {
+          var address = result.regeocode.formattedAddress;
+          result.regeocode.addressComponent.location = lnglat;
+          result.regeocode.addressComponent.address = address;
+          let addrs = result.regeocode.addressComponent;
+          result.regeocode.addressComponent.pname = addrs.province;
+          result.regeocode.addressComponent.cityname = addrs.city;
+          result.regeocode.addressComponent.adname = addrs.district;
+          result.regeocode.addressComponent.pcode =
+            result.regeocode.addressComponent.adcode.substring(0, 3) + "000";
+          result.regeocode.addressComponent.cityCode =
+            result.regeocode.addressComponent.adcode.substring(0, 4) + "00";
+          that.gethouse(result.regeocode.addressComponent.cityCode);
+          that.address = address;
+          console.log("cccc", that.address);
+          that.$forceUpdate();
+          that.addressParams = result.regeocode.addressComponent;
+        } else {
+          that.$message.error("根据经纬度查询地址失败");
+        }
+      });
+    },
+  },
+};
+</script>
+<style>
+html,
+body,
+#container {
+  height: 100%;
+  width: 100%;
+}
+
+.amap-icon img,
+.amap-marker-content img {
+  width: 25px;
+  height: 34px;
+}
+
+.marker {
+  position: absolute;
+  top: -20px;
+  right: -118px;
+  color: #fff;
+  padding: 4px 10px;
+  box-shadow: 1px 1px 1px rgba(10, 10, 10, 0.2);
+  white-space: nowrap;
+  font-size: 12px;
+  font-family: "";
+  background-color: #25a5f7;
+  border-radius: 3px;
+}
+
+.input-card {
+  width: 18rem;
+  z-index: 170;
+}
+
+.input-card .btn {
+  margin-right: 0.8rem;
+}
+
+.input-card .btn:last-child {
+  margin-right: 0;
+}
+</style>

+ 112 - 15
src/views/manage/shopInfo.vue

@@ -4,9 +4,12 @@
       <el-tab-pane label="基本信息" :name="1">
         <div style="padding: 20px">
           <el-descriptions title="基本信息" :column="1">
-            <el-descriptions-item label="店铺名称">{{
-              shopInfo ? shopInfo.storeName : ""
-            }}</el-descriptions-item>
+            <el-descriptions-item label="店铺名称">
+              {{ shopInfo ? shopInfo.storeName : "" }}
+              <a style="margin-left: 20px; color: #1890ff" @click="edit"
+                >修改</a
+              >
+            </el-descriptions-item>
             <el-descriptions-item label="店铺id">{{
               shopInfo ? shopInfo.id : ""
             }}</el-descriptions-item>
@@ -33,21 +36,55 @@
               }}</el-tag></el-descriptions-item
             >
             <el-descriptions-item label="店铺头像">
-              <el-image
-                :src="shopInfo ? shopInfo.storeLogoUrl : ''"
-                mode=""
-                style="width: 100px; height: 100px"
-              />
+              <div
+                style="display: flex; flex-direction: row; align-items: center"
+              >
+                <el-image
+                  :src="shopInfo ? shopInfo.storeLogoUrl : ''"
+                  mode=""
+                  style="width: 100px; height: 100px"
+                />
+                <el-upload
+                  class="upload-demo"
+                  :http-request="(data) => requestUpload(data, 'tx')"
+                  :limit="1"
+                  action="#"
+                  accept=".png,.jpg,.jpeg"
+                  :show-file-list="false"
+                >
+                  <el-button type="text" style="margin-left: 20px"
+                    >修改</el-button
+                  >
+                </el-upload>
+              </div>
             </el-descriptions-item>
             <el-descriptions-item label="店铺地址">
               {{ shopInfo ? shopInfo.storeAddress : "" }}
             </el-descriptions-item>
-            <el-descriptions-item label="店铺背景图"
-              ><el-image
-                :src="shopInfo ? shopInfo.storeBackgroundUrl : ''"
-                mode=""
-                style="width: 100px; height: 100px"
-            /></el-descriptions-item>
+            <el-descriptions-item label="店铺背景图">
+              <div
+                style="display: flex; flex-direction: row; align-items: center"
+              >
+                <el-image
+                  :src="shopInfo ? shopInfo.storeBackgroundUrl : ''"
+                  mode=""
+                  style="width: 100px; height: 100px"
+                />
+
+                <el-upload
+                  class="upload-demo"
+                  :http-request="(data) => requestUpload(data, 'bj')"
+                  :limit="1"
+                  action="#"
+                  accept=".png,.jpg,.jpeg"
+                  :show-file-list="false"
+                >
+                  <el-button type="text" style="margin-left: 20px"
+                    >修改</el-button
+                  >
+                </el-upload>
+              </div>
+            </el-descriptions-item>
             <el-descriptions-item label="店铺简介"
               ><image :src="shopInfo ? shopInfo.storeIntro : ''" mode=""
             /></el-descriptions-item>
@@ -120,24 +157,59 @@
         <chainStore></chainStore>
       </el-tab-pane>
     </el-tabs>
+
+    <el-dialog
+      title="修改店铺名称"
+      :visible.sync="dialogVisible"
+      width="30%"
+      :before-close="handleClose"
+    >
+      <el-input
+        v-model="shopInfo.storeName"
+        placeholder="请输入店铺名称"
+      ></el-input>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="editOk">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
+import { getStoreInfo, modifyStoreInfo } from "@/api/common/index";
 import chainStore from "@/views/manage/shopInfoCommon/index.vue";
-import { getStoreInfo } from "@/api/common/index";
+import axios from "axios";
+import { getToken } from "@/utils/auth";
 export default {
   components: { chainStore },
   data() {
     return {
+      dialogVisible: false,
       activeName: 1,
       shopInfo: {},
+      headers: {
+        Auth: "Bearer " + getToken(),
+        "Content-type": "multipart/form-data",
+      },
     };
   },
   mounted() {
     this.getInfo();
   },
   methods: {
+    edit() {
+      this.dialogVisible = true;
+    },
+    editOk() {
+      modifyStoreInfo(this.shopInfo).then((res) => {
+        if (res.code == 200) {
+          this.$message.success("保存成功!");
+          this.getInfo();
+          this.dialogVisible = false;
+        }
+      });
+    },
     getInfo() {
       getStoreInfo().then((res) => {
         if (res.code == 200) {
@@ -145,6 +217,31 @@ export default {
         }
       });
     },
+    // 可以获取图片参数
+    async requestUpload(data, type) {
+      const formdata = new FormData();
+      formdata.append("file", data.file);
+      const res = await axios.post(
+        `${process.env.VUE_APP_NSY_UPLOAD_API}/api/third/op/v1/third/uploadPic`,
+        formdata,
+        {
+          headers: this.headers,
+        }
+      );
+      if (res.data.data) {
+        if (type == "tx") {
+          this.shopInfo.storeLogoUrl = res.data.data;
+        } else if (type == "bj") {
+          this.shopInfo.storeBackgroundUrl = res.data.data;
+        }
+        modifyStoreInfo(this.shopInfo).then((res) => {
+          if (res.code == 200) {
+            this.$message.success("保存成功!");
+            this.getInfo();
+          }
+        });
+      }
+    },
   },
 };
 </script>

+ 26 - 6
src/views/member/list/draftProduct.vue

@@ -64,21 +64,20 @@
       </el-table-column>
       <el-table-column label="价格" align="center">
         <template slot-scope="scope">
-          {{ scope.row.skuList ? scope.row.skuList[0].skuPriceList[0].price : "" }}/{{
-            scope.row.unit
-          }}
+          {{ getPrice(scope.row, "price") }}/{{ scope.row.unit }}
         </template>
       </el-table-column>
 
       <el-table-column label="起批量" align="center">
         <template slot-scope="scope">
-          {{ scope.row.skuList ? scope.row.skuList[0].skuPriceList[0].minPurchase : ""
-          }}{{ scope.row.unit }}
+          {{ getPrice(scope.row, "minPurchase") }}
+          {{ scope.row.unit }}
         </template>
       </el-table-column>
       <el-table-column label="库存" align="center">
         <template slot-scope="scope">
-          {{ scope.row.skuList ? scope.row.skuList[0].stock + "/" + scope.row.unit : "" }}
+          {{ getStock(scope.row) }}
+          {{ scope.row.unit }}
         </template>
       </el-table-column>
       <el-table-column label="经营区域" align="center">
@@ -157,6 +156,27 @@ export default {
     this.getInfo();
   },
   methods: {
+    getStock(row) {
+      if (
+        row.skuList &&
+        row.skuList.length > 0 &&
+        row.skuList[0].stock !== undefined
+      ) {
+        return row.skuList[0].stock;
+      }
+      return "";
+    },
+    getPrice(row, value) {
+      if (
+        row.skuList &&
+        row.skuList.length > 0 &&
+        row.skuList[0].skuPriceList &&
+        row.skuList[0].skuPriceList.length > 0
+      ) {
+        return row.skuList[0].skuPriceList[0][value];
+      }
+      return "";
+    },
     getInfo() {
       getStoreInfo().then((res) => {
         if (res.code == 200) {

+ 63 - 64
src/views/member/module/sales-info.vue

@@ -297,36 +297,25 @@
         </el-form-item>
       </el-col>
       <el-col :span="24" style="margin-top: 20px">
-        <el-form-item prop="shippingAddrBean.addrDetail">
+        <el-form-item prop="shippingAddrId">
           <span slot="label"> 发货地址</span>
-          <div style="display: flex; flex-direction: row; align-items: center">
-            <el-button
-              @click="selectAddr"
-              type="text"
-              style="
-                font-size: 16px;
-                display: flex;
-                flex-direction: row;
-                align-items: center;
-              "
-              ><img
-                src="@/assets/images/point.png"
-                style="width: 20px; height: 20px"
-              />
-              选择地址</el-button
+          <el-select
+            v-model="form.shippingAddrId"
+            placeholder="请选择"
+            style="width: 300px"
+            @change="passValue"
+          >
+            <el-option
+              v-for="item in options"
+              :key="item.id"
+              :label="item.address"
+              :value="item.id"
             >
-            <span style="margin-left: 20px">已选择地址:{{ addr }}</span>
-          </div>
-
-          <el-input
-            type="textarea"
-            :rows="3"
-            placeholder="请输入详细地址"
-            v-model="form.shippingAddrBean.addrDetail"
-            style="width: 700px"
-            @blur="passValue"
+            </el-option>
+          </el-select>
+          <el-button type="text" @click="areaAdd" style="margin-left: 10px">
+            没有所需地址?前去添加</el-button
           >
-          </el-input>
         </el-form-item>
       </el-col>
       <el-col :span="24" v-if="saleModel == 7">
@@ -350,6 +339,7 @@
 </template>
 
 <script>
+import { dxAddressList } from "@/api/manage/address";
 import { getStoreInfo } from "@/api/common/index";
 import Amap from "@/components/Map/map.vue";
 import { getDict } from "@/api/common/index.js";
@@ -396,11 +386,12 @@ export default {
         packing: [
           { required: true, message: "包装方式不能为空", trigger: "blur" },
         ],
-        "shippingAddrBean.addrDetail": [
-          { required: true, message: "详细地址不能为空", trigger: "blur" },
+        shippingAddrId: [
+          { required: true, message: "请选择地址", trigger: "blur" },
         ],
       },
       shopInfo: {},
+      options: [],
       saleType: undefined,
       sj: true,
       showCom: true,
@@ -419,60 +410,68 @@ export default {
   mounted() {
     this.getInfo();
     this.getdictImpl();
+    this.getAreaList();
   },
 
   methods: {
+    areaAdd() {
+      this.$router.push({ path: "/manage/manage/address/index" });
+    },
+    getAreaList() {
+      dxAddressList().then((res) => {
+        if (res.code == 200) {
+          this.options = res.data;
+        }
+      });
+    },
     getFormInfo(record) {
-      // 解构赋值获取常用属性
       const {
         merchantClassifyName,
         saleModel,
         shippingAddr,
         expressType,
         shareRate,
-        props,
         lookSalesVolume,
         unit,
         packing,
         shippingTimeDesc,
         freeShipping,
         skuList,
-        shippingAddrBean: {
-          addrDetail = undefined,
-          cityCode,
-          countyCode,
-          latitude,
-          longitude,
-          provinceCode,
-        } = {},
+        props = [],
+        shippingAddrId,
+        shippingAddrBean = {},
       } = record;
-      this.form.merchantClassifyName = merchantClassifyName;
-      // 赋值操作
+
+      this.form = {
+        ...this.form,
+        shippingAddrId,
+        merchantClassifyName,
+        expressType,
+        shareRate,
+        lookSalesVolume,
+        unit,
+        shippingAddr,
+        packing,
+        shippingTimeDesc,
+        skuList,
+        props: Array.isArray(props) ? props : [],
+        shippingAddrBean: {
+          addr: shippingAddr,
+          addrDetail: shippingAddrBean.addrDetail,
+          cityCode: shippingAddrBean.cityCode,
+          countyCode: shippingAddrBean.countyCode,
+          latitude: shippingAddrBean.latitude,
+          longitude: shippingAddrBean.longitude,
+          provinceCode: shippingAddrBean.provinceCode,
+        },
+        freeShipping:
+          this.form.freeShipping !== undefined
+            ? freeShipping
+            : this.form.freeShipping,
+      };
+
       this.saleModel = saleModel;
       this.addr = shippingAddr;
-      this.form.expressType = expressType;
-      this.form.shareRate = shareRate;
-      this.form.shippingAddrBean = {
-        addr: shippingAddr,
-        addrDetail,
-        cityCode,
-        countyCode,
-        latitude,
-        longitude,
-        provinceCode,
-      };
-      // 简化 props 的赋值逻辑
-      this.form.props = props && props.length > 0 ? props : [];
-      this.form.lookSalesVolume = lookSalesVolume;
-      this.form.unit = unit;
-      this.form.shippingAddr = shippingAddr;
-      this.form.packing = packing;
-      this.form.shippingTimeDesc = shippingTimeDesc;
-      // 只有当 this.form.freeShipping 为真时才进行赋值
-      if (this.form.freeShipping) {
-        this.form.freeShipping = freeShipping;
-      }
-      this.form.skuList = skuList;
     },
     setShowCom(val) {
       this.showCom = val;

+ 1 - 4
src/views/product/createProduct.vue

@@ -354,10 +354,7 @@ export default {
         this.$message.error(`商品规格不能为空`);
         return;
       }
-      if (!this.form.shippingAddrBean.provinceCode) {
-        this.$message.error(`请点击选择地址,选择发货地址的省市区!`);
-        return;
-      }
+
       if (this.form.categoryId?.length > 0) {
         this.form.categoryId =
           this.form.categoryId[this.form.categoryId.length - 1];

+ 26 - 13
src/views/product/list/draftProduct.vue

@@ -70,28 +70,20 @@
       </el-table-column>
       <el-table-column label="价格" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList ? scope.row.skuList[0].skuPriceList[0].price : ""
-          }}/{{ scope.row.unit }}
+          {{ getPrice(scope.row, "price") }}/{{ scope.row.unit }}
         </template>
       </el-table-column>
 
       <el-table-column label="起批量" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList
-              ? scope.row.skuList[0].skuPriceList[0].minPurchase
-              : ""
-          }}{{ scope.row.unit }}
+          {{ getPrice(scope.row, "minPurchase") }}
+          {{ scope.row.unit }}
         </template>
       </el-table-column>
       <el-table-column label="库存" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList
-              ? scope.row.skuList[0].stock + "/" + scope.row.unit
-              : ""
-          }}
+          {{ getStock(scope.row) }}
+          {{ scope.row.unit }}
         </template>
       </el-table-column>
       <el-table-column label="经营区域" align="center">
@@ -176,6 +168,27 @@ export default {
     this.getInfo();
   },
   methods: {
+    getStock(row) {
+      if (
+        row.skuList &&
+        row.skuList.length > 0 &&
+        row.skuList[0].stock !== undefined
+      ) {
+        return row.skuList[0].stock;
+      }
+      return "";
+    },
+    getPrice(row, value) {
+      if (
+        row.skuList &&
+        row.skuList.length > 0 &&
+        row.skuList[0].skuPriceList &&
+        row.skuList[0].skuPriceList.length > 0
+      ) {
+        return row.skuList[0].skuPriceList[0][value];
+      }
+      return "";
+    },
     getInfo() {
       getStoreInfo().then((res) => {
         if (res.code == 200) {

+ 78 - 62
src/views/product/module/sales-info.vue

@@ -371,36 +371,25 @@
         </el-form-item>
       </el-col>
       <el-col :span="24" style="margin-top: 20px">
-        <el-form-item prop="shippingAddrBean.addrDetail">
+        <el-form-item prop="shippingAddrId">
           <span slot="label"> 发货地址</span>
-          <div style="display: flex; flex-direction: row; align-items: center">
-            <el-button
-              @click="selectAddr"
-              type="text"
-              style="
-                font-size: 16px;
-                display: flex;
-                flex-direction: row;
-                align-items: center;
-              "
-              ><img
-                src="@/assets/images/point.png"
-                style="width: 20px; height: 20px"
-              />
-              选择地址</el-button
+          <el-select
+            v-model="form.shippingAddrId"
+            placeholder="请选择"
+            style="width: 300px"
+            @change="passValue"
+          >
+            <el-option
+              v-for="item in options"
+              :key="item.id"
+              :label="item.address"
+              :value="item.id"
             >
-            <span style="margin-left: 20px">已选择地址:{{ addr }}</span>
-          </div>
-
-          <el-input
-            type="textarea"
-            :rows="3"
-            placeholder="请输入详细地址"
-            v-model="form.shippingAddrBean.addrDetail"
-            style="width: 700px"
-            @blur="passValue"
+            </el-option>
+          </el-select>
+          <el-button type="text" @click="areaAdd" style="margin-left: 10px">
+            没有所需地址?前去添加</el-button
           >
-          </el-input>
         </el-form-item>
       </el-col>
       <el-col :span="24">
@@ -428,6 +417,7 @@ import { getMerchantClassifyList } from "@/api/sort/index.js";
 import { getStoreInfo } from "@/api/common/index";
 import Amap from "@/components/Map/map.vue";
 import { getDict } from "@/api/common/index.js";
+import { dxAddressList } from "@/api/manage/address";
 export default {
   props: ["data", "saleType", "saleModels"],
   components: { Amap },
@@ -476,8 +466,8 @@ export default {
         packing: [
           { required: true, message: "包装方式不能为空", trigger: "blur" },
         ],
-        "shippingAddrBean.addrDetail": [
-          { required: true, message: "详细地址不能为空", trigger: "blur" },
+        shippingAddrId: [
+          { required: true, message: "请选择地址", trigger: "blur" },
         ],
         merchantClassifyIds: [
           { required: true, message: "店铺所属分类不能为空", trigger: "blur" },
@@ -489,6 +479,7 @@ export default {
       sj: true,
       skuIds: [],
       saleModel: 1,
+      options: [],
       categoryprops: {
         checkStrictly: true,
         lazy: true,
@@ -508,9 +499,20 @@ export default {
   mounted() {
     this.getInfo();
     this.getdictImpl();
+    this.getAreaList();
   },
 
   methods: {
+    getAreaList() {
+      dxAddressList().then((res) => {
+        if (res.code == 200) {
+          this.options = res.data;
+        }
+      });
+    },
+    areaAdd() {
+      this.$router.push({ path: "/manage/manage/address/index" });
+    },
     categoryLazyLoad(node, resolve) {
       let level = node.level;
       if (!node.data) {
@@ -558,41 +560,55 @@ export default {
       this.passValue();
     },
     getFormInfo(record) {
-      this.form.merchantClassifyName = record.merchantClassifyName;
-      this.saleModel = record.saleModel;
-      this.addr = record.shippingAddr;
-      this.form.expressType = record.expressType;
-      this.form.shareRate = record.shareRate;
-      this.form.merchantClassifyIds = record.merchantClassifyId;
-      this.form.merchantClassifyId = record.merchantClassifyId;
-      this.form.shippingAddrBean = {
-        addr: record.shippingAddr,
-        addrDetail: record.shippingAddrBean
-          ? record.shippingAddrBean.addrDetail
-          : undefined,
-        cityCode: record.cityCode,
-        countyCode: record.countyCode,
-        latitude: record.latitude,
-        longitude: record.longitude,
-        provinceCode: record.provinceCode,
+      const {
+        merchantClassifyName,
+        saleModel,
+        shippingAddr,
+        expressType,
+        shareRate,
+        merchantClassifyId,
+        lookSalesVolume,
+        unit,
+        packing,
+        shippingTimeDesc,
+        freeShipping,
+        skuList,
+        props = [],
+        shippingAddrId,
+      } = record || {};
+
+      this.form = {
+        ...this.form,
+        shippingAddrId,
+        merchantClassifyName,
+        expressType,
+        shareRate,
+        merchantClassifyIds: merchantClassifyId,
+        merchantClassifyId,
+        lookSalesVolume,
+        unit,
+        shippingAddr,
+        packing,
+        shippingTimeDesc,
+        freeShipping:
+          this.form.freeShipping !== undefined
+            ? freeShipping
+            : this.form.freeShipping,
+        skuList,
+        props,
+        shippingAddrBean: {
+          addr: shippingAddr,
+          addrDetail: record?.shippingAddrBean?.addrDetail,
+          cityCode: record.cityCode,
+          countyCode: record.countyCode,
+          latitude: record.latitude,
+          longitude: record.longitude,
+          provinceCode: record.provinceCode,
+        },
       };
-      if (record.props && record.props?.length < 1) {
-        this.form.props = [];
-      } else if (!record.props) {
-        this.form.props = [];
-      } else {
-        this.form.props = record.props;
-      }
-      this.form.lookSalesVolume = record.lookSalesVolume;
-      this.form.unit = record.unit;
-      this.form.shippingAddr = record.shippingAddr;
-      this.form.packing = record.packing;
-      this.form.shippingTimeDesc = record.shippingTimeDesc;
-      if (this.form.freeShipping) {
-        this.form.freeShipping = record.freeShipping;
-      }
 
-      this.form.skuList = record.skuList;
+      this.saleModel = saleModel;
+      this.addr = shippingAddr;
     },
 
     compilatePrice(data) {

+ 0 - 4
src/views/product/updateProduct.vue

@@ -432,10 +432,6 @@ export default {
         this.$message.error(`商品规格不能为空`);
         return;
       }
-      if (!this.form.shippingAddrBean.provinceCode) {
-        this.$message.error(`请选择发货地址的省市区!`);
-        return;
-      }
       this.btnLading = true;
       if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
         if (this.form.datePicke) {

+ 4 - 4
src/views/productNationwide/createProduct.vue

@@ -334,10 +334,10 @@ export default {
         this.$message.error(`商品规格不能为空`);
         return;
       }
-      if(!this.form.shippingAddrBean.provinceCode){
-        this.$message.error(`请点击选择地址,选择发货地址的省市区!`);
-        return;
-      }
+      // if(!this.form.shippingAddrBean.provinceCode){
+      //   this.$message.error(`请点击选择地址,选择发货地址的省市区!`);
+      //   return;
+      // }
       if (this.form.categoryId?.length > 0) {
         this.form.categoryId = this.form.categoryId[this.form.categoryId.length - 1];
       }

+ 26 - 13
src/views/productNationwide/list/draftProduct.vue

@@ -70,28 +70,20 @@
       </el-table-column>
       <el-table-column label="价格" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList ? scope.row.skuList[0].skuPriceList[0].price : ""
-          }}/{{ scope.row.unit }}
+          {{ getPrice(scope.row, "price") }}/{{ scope.row.unit }}
         </template>
       </el-table-column>
 
       <el-table-column label="起批量" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList
-              ? scope.row.skuList[0].skuPriceList[0].minPurchase
-              : ""
-          }}{{ scope.row.unit }}
+          {{ getPrice(scope.row, "minPurchase") }}
+          {{ scope.row.unit }}
         </template>
       </el-table-column>
       <el-table-column label="库存" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList
-              ? scope.row.skuList[0].stock + "/" + scope.row.unit
-              : ""
-          }}
+          {{ getStock(scope.row) }}
+          {{ scope.row.unit }}
         </template>
       </el-table-column>
       <el-table-column label="经营区域" align="center">
@@ -176,6 +168,27 @@ export default {
     this.getInfo();
   },
   methods: {
+    getStock(row) {
+      if (
+        row.skuList &&
+        row.skuList.length > 0 &&
+        row.skuList[0].stock !== undefined
+      ) {
+        return row.skuList[0].stock;
+      }
+      return "";
+    },
+    getPrice(row, value) {
+      if (
+        row.skuList &&
+        row.skuList.length > 0 &&
+        row.skuList[0].skuPriceList &&
+        row.skuList[0].skuPriceList.length > 0
+      ) {
+        return row.skuList[0].skuPriceList[0][value];
+      }
+      return "";
+    },
     getInfo() {
       getStoreInfo().then((res) => {
         if (res.code == 200) {

+ 111 - 14
src/views/productNationwide/module/basic-info.vue

@@ -4,7 +4,7 @@
     ref="queryForm"
     size="small"
     :inline="true"
-    label-width="120px"
+    label-width="140px"
     :rules="rules"
   >
     <el-row>
@@ -27,7 +27,7 @@
           </el-radio-group>
         </el-form-item>
       </el-col>
-      <el-col :span="24" v-if="form.saleModel == 2 || form.saleType == 2">
+      <!-- <el-col :span="24" v-if="form.saleModel == 2">
         <el-form-item prop="datePicker">
           <span slot="label">预售时间</span>
           <el-date-picker
@@ -41,8 +41,47 @@
           >
           </el-date-picker>
         </el-form-item>
-      </el-col>
+      </el-col> -->
 
+      <el-col :span="24" v-if="form.saleModel == 2">
+        <el-form-item prop="djzfPicker">
+          <span slot="label">定金支付时间</span>
+          <el-date-picker
+            v-model="form.djzfPicker"
+            type="datetimerange"
+            range-separator="至"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            @change="djzfChange"
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+      <el-col :span="24" v-if="form.saleModel == 2">
+        <el-form-item prop="wkzfPicker">
+          <span slot="label">尾款支付时间</span>
+          <el-date-picker
+            v-model="form.wkzfPicker"
+            type="datetimerange"
+            range-separator="至"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            @change="wkzfChange"
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+      <el-col :span="24" v-if="form.saleModel == 2">
+        <el-form-item prop="presaleEndStatus">
+          <span slot="label">预售结束商品状态</span>
+          <el-radio-group v-model="form.presaleEndStatus">
+            <el-radio :label="0">正常销售</el-radio>
+            <el-radio :label="1">下架商品</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-col>
       <el-col :span="24">
         <el-form-item prop="categoryId">
           <span slot="label">商品分类</span>
@@ -221,8 +260,21 @@ export default {
         carpoolSuccessTime: [
           { required: true, message: "拼车成功时间不能为空", trigger: "blur" },
         ],
-        datePicker: [
-          { required: true, message: "预售时间不能为空", trigger: "blur" },
+        // datePicker: [
+        //   { required: true, message: "预售时间不能为空", trigger: "blur" },
+        // ],
+        djzfPicker: [
+          { required: true, message: "定金支付时间不能为空", trigger: "blur" },
+        ],
+        wkzfPicker: [
+          { required: true, message: "尾款支付时间不能为空", trigger: "blur" },
+        ],
+        presaleEndStatus: [
+          {
+            required: true,
+            message: "预售结束商品状态不能为空",
+            trigger: "blur",
+          },
         ],
       },
       index: 0,
@@ -236,7 +288,7 @@ export default {
     getFormInfo(record, type) {
       // 重置表单基础数据
       this.actionType = type === "cg" ? "" : "edit";
-      this.form.datePicker = [];
+      // this.form.datePicker = [];
       // 解构赋值与默认值处理
       const {
         categoryId,
@@ -253,6 +305,11 @@ export default {
         categoryName,
         presaleStartTime,
         presaleEndTime,
+        downPayStartTime,
+        downPayEndTime,
+        balancePayStartTime,
+        balancePayEndTime,
+        presaleEndStatus,
       } = record || {};
       // 更新表单数据
       this.form = {
@@ -275,14 +332,43 @@ export default {
         presaleEndTime: presaleEndTime
           ? moment(presaleEndTime).format("yyyy-MM-DD HH:mm:ss")
           : "",
+        downPayStartTime: downPayStartTime
+          ? moment(downPayStartTime).format("yyyy-MM-DD HH:mm:ss")
+          : "",
+        downPayEndTime: downPayEndTime
+          ? moment(downPayEndTime).format("yyyy-MM-DD HH:mm:ss")
+          : "",
+        balancePayStartTime: balancePayStartTime
+          ? moment(balancePayStartTime).format("yyyy-MM-DD HH:mm:ss")
+          : "",
+        balancePayEndTime: balancePayEndTime
+          ? moment(balancePayEndTime).format("yyyy-MM-DD HH:mm:ss")
+          : "",
+        presaleEndStatus,
       };
 
-      // 更新日期选择器
-      if (presaleStartTime && presaleEndTime) {
+      // // 更新日期选择器
+      // if (presaleStartTime && presaleEndTime) {
+      //   this.$nextTick(() => {
+      //     this.$set(this.form, "datePicker", [
+      //       this.form.presaleStartTime,
+      //       this.form.presaleEndTime,
+      //     ]);
+      //   });
+      // }
+      if (downPayStartTime && downPayEndTime) {
+        this.$nextTick(() => {
+          this.$set(this.form, "djzfPicker", [
+            this.form.downPayStartTime,
+            this.form.downPayEndTime,
+          ]);
+        });
+      }
+      if (balancePayStartTime && balancePayEndTime) {
         this.$nextTick(() => {
-          this.$set(this.form, "datePicker", [
-            this.form.presaleStartTime,
-            this.form.presaleEndTime,
+          this.$set(this.form, "wkzfPicker", [
+            this.form.balancePayStartTime,
+            this.form.balancePayEndTime,
           ]);
         });
       }
@@ -294,6 +380,7 @@ export default {
           sort: 1,
         });
       }
+      this.categoryName = categoryName;
       // 触发强制更新(尽量避免使用)
       // this.$forceUpdate();
     },
@@ -333,9 +420,19 @@ export default {
       this.bannerList.splice(index, 1);
       this.passValue();
     },
-    pickerChange(val) {
-      this.form.presaleStartTime = moment(this.form.datePicker[0]).valueOf();
-      this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
+    // pickerChange(val) {
+    //   this.form.presaleStartTime = moment(this.form.datePicker[0]).valueOf();
+    //   this.form.presaleEndTime = moment(this.form.datePicker[1]).valueOf();
+    //   this.passValue();
+    // },
+    djzfChange(val) {
+      this.form.downPayStartTime = moment(val[0]).valueOf();
+      this.form.downPayEndTime = moment(val[1]).valueOf();
+      this.passValue();
+    },
+    wkzfChange(val) {
+      this.form.balancePayStartTime = moment(val[0]).valueOf();
+      this.form.balancePayEndTime = moment(val[1]).valueOf();
       this.passValue();
     },
     draggableChange() {

+ 125 - 66
src/views/productNationwide/module/sales-info.vue

@@ -93,7 +93,7 @@
                 />
               </template>
             </el-table-column>
-            <el-table-column prop="name" label="预计库存" width="160">
+            <el-table-column prop="name" label="预计库存" width="140">
               <template slot-scope="scope">
                 <el-input-number
                   :controls="false"
@@ -186,7 +186,44 @@
                 </el-input-number>
               </template>
             </el-table-column>
-            <el-table-column prop="address" label="商品单价" width="140">
+
+            <el-table-column
+              prop="presaleTotalPrice"
+              label="预售总价"
+              width="140"
+              v-if="saleModel == 2"
+            >
+              <template slot-scope="scope">
+                <el-input-number
+                  :controls="false"
+                  @input="passValue"
+                  v-model="scope.row.skuPriceList[0].presaleTotalPrice"
+                  placeholder="预售总价"
+                  clearable
+                >
+                  <template slot="suffix"> {{ form.unit }}/元 </template>
+                </el-input-number>
+              </template>
+            </el-table-column>
+            <el-table-column
+              prop="address"
+              label="预售定金"
+              width="140"
+              v-if="saleModel == 2"
+            >
+              <template slot-scope="scope">
+                <el-input-number
+                  :controls="false"
+                  @input="passValue"
+                  v-model="scope.row.skuPriceList[0].downPayPrice"
+                  placeholder="预售定金"
+                  clearable
+                >
+                  <template slot="suffix"> {{ form.unit }}/元 </template>
+                </el-input-number>
+              </template>
+            </el-table-column>
+            <el-table-column prop="address" label="商品单价" width="100">
               <template slot-scope="scope">
                 {{ computePrice(scope.row) }}元/{{ form.unit }}
               </template>
@@ -324,36 +361,25 @@
         </el-form-item>
       </el-col>
       <el-col :span="24" style="margin-top: 20px">
-        <el-form-item prop="shippingAddrBean.addrDetail">
+        <el-form-item prop="shippingAddrId">
           <span slot="label"> 发货地址</span>
-          <div style="display: flex; flex-direction: row; align-items: center">
-            <el-button
-              @click="selectAddr"
-              type="text"
-              style="
-                font-size: 16px;
-                display: flex;
-                flex-direction: row;
-                align-items: center;
-              "
-              ><img
-                src="@/assets/images/point.png"
-                style="width: 20px; height: 20px"
-              />
-              选择地址</el-button
+          <el-select
+            v-model="form.shippingAddrId"
+            placeholder="请选择"
+            style="width: 300px"
+            @change="passValue"
+          >
+            <el-option
+              v-for="item in options"
+              :key="item.id"
+              :label="item.address"
+              :value="item.id"
             >
-            <span style="margin-left: 20px">已选择地址:{{ addr }}</span>
-          </div>
-
-          <el-input
-            type="textarea"
-            :rows="3"
-            placeholder="请输入详细地址"
-            v-model="form.shippingAddrBean.addrDetail"
-            style="width: 700px"
-            @blur="passValue"
+            </el-option>
+          </el-select>
+          <el-button type="text" @click="areaAdd" style="margin-left: 10px">
+            没有所需地址?前去添加</el-button
           >
-          </el-input>
         </el-form-item>
       </el-col>
       <el-col :span="24">
@@ -381,6 +407,7 @@ import { getMerchantClassifyList } from "@/api/sort/index.js";
 import { getStoreInfo } from "@/api/common/index";
 import Amap from "@/components/Map/map.vue";
 import { getDict } from "@/api/common/index.js";
+import { dxAddressList } from "@/api/manage/address";
 export default {
   props: ["data", "saleType", "saleModels"],
   components: { Amap },
@@ -408,6 +435,7 @@ export default {
         merchantClassifyId: "",
         merchantClassifyIds: [],
         merchantClassifyName: "",
+        shippingAddrId: "",
       },
       addr: "",
       measure: [],
@@ -429,8 +457,8 @@ export default {
         packing: [
           { required: true, message: "包装方式不能为空", trigger: "blur" },
         ],
-        "shippingAddrBean.addrDetail": [
-          { required: true, message: "详细地址不能为空", trigger: "blur" },
+        shippingAddrId: [
+          { required: true, message: "请选择地址", trigger: "blur" },
         ],
         merchantClassifyIds: [
           { required: true, message: "店铺所属分类不能为空", trigger: "blur" },
@@ -449,6 +477,7 @@ export default {
         label: "label",
         value: "value",
       },
+      options: [],
     };
   },
   watch: {
@@ -461,9 +490,19 @@ export default {
   mounted() {
     this.getInfo();
     this.getdictImpl();
+    this.getAreaList();
   },
-
   methods: {
+    areaAdd() {
+      this.$router.push({ path: "/manage/manage/address/index" });
+    },
+    getAreaList() {
+      dxAddressList().then((res) => {
+        if (res.code == 200) {
+          this.options = res.data;
+        }
+      });
+    },
     categoryLazyLoad(node, resolve) {
       let level = node.level;
       if (!node.data) {
@@ -511,40 +550,59 @@ export default {
       this.passValue();
     },
     getFormInfo(record) {
-      this.form.merchantClassifyName = record.merchantClassifyName;
-      this.saleModel = record.saleModel;
-      this.addr = record.shippingAddr;
-      this.form.expressType = record.expressType;
-      this.form.shareRate = record.shareRate;
-      this.form.merchantClassifyIds = record.merchantClassifyId;
-      this.form.merchantClassifyId = record.merchantClassifyId;
-      this.form.shippingAddrBean = {
-        addr: record.shippingAddr,
-        addrDetail: record.shippingAddrBean
-          ? record.shippingAddrBean.addrDetail
-          : undefined,
-        cityCode: record.cityCode,
-        countyCode: record.countyCode,
-        latitude: record.latitude,
-        longitude: record.longitude,
-        provinceCode: record.provinceCode,
+      // 基础属性赋值
+      const {
+        shippingAddrId,
+        merchantClassifyName,
+        saleModel,
+        shippingAddr: addr,
+        expressType,
+        shareRate,
+        merchantClassifyId,
+        lookSalesVolume,
+        unit,
+        packing,
+        shippingTimeDesc,
+        freeShipping,
+        skuList,
+        props = [], // 默认空数组避免后续判断
+      } = record;
+
+      // 更新表单数据
+      this.form = {
+        ...this.form, // 保留原有属性
+        shippingAddrId,
+        merchantClassifyName,
+        expressType,
+        shareRate,
+        merchantClassifyIds: merchantClassifyId,
+        merchantClassifyId,
+        lookSalesVolume,
+        unit,
+        shippingAddr: addr,
+        packing,
+        shippingTimeDesc,
+        freeShipping: this.form.freeShipping
+          ? freeShipping
+          : this.form.freeShipping,
+        skuList,
+        props, // 已默认处理空值情况
+        shippingAddrBean: {
+          addr,
+          addrDetail: record.shippingAddrBean?.addrDetail,
+          cityCode: record.cityCode,
+          countyCode: record.countyCode,
+          latitude: record.latitude,
+          longitude: record.longitude,
+          provinceCode: record.provinceCode,
+        },
       };
-      if (record.props && record.props?.length < 1) {
-        this.form.props = [];
-      } else if (!record.props) {
-        this.form.props = [];
-      } else {
-        this.form.props = record.props;
-      }
-      this.form.lookSalesVolume = record.lookSalesVolume;
-      this.form.unit = record.unit;
-      this.form.shippingAddr = record.shippingAddr;
-      this.form.packing = record.packing;
-      this.form.shippingTimeDesc = record.shippingTimeDesc;
-      if (this.form.freeShipping) {
-        this.form.freeShipping = record.freeShipping;
-      }
-      this.form.skuList = record.skuList;
+
+      console.log(this.form);
+
+      // 独立处理特殊属性
+      this.saleModel = saleModel;
+      this.addr = addr;
     },
     compilatePrice(data) {
       if (data.price) {
@@ -613,12 +671,13 @@ export default {
     passValue() {
       this.form.skuList.forEach((e) => {
         e.skuPriceList.forEach((a) => {
+          e.presaleTotalPrice = a.presaleTotalPrice;
+          e.downPayPrice = a.downPayPrice;
           a.price = this.computePrice(e);
           a.originalPrice = this.computePrice(e);
           a.lowestPrice = this.computePrice(e);
         });
       });
-
       this.$emit("updateValue", this.form);
     },
 

+ 5 - 41
src/views/productNationwide/updateProduct.vue

@@ -277,7 +277,6 @@ export default {
     });
   },
   mounted() {
-    this.getInfo();
     if (
       (this.$route.query.params != "[object Object]" &&
         this.$route.query.params) ||
@@ -324,13 +323,6 @@ export default {
               });
             }
             this.headerImg.sort((a, b) => a.sort - b.sort); //排序 视频在最前面>封面>商品banner
-            if (this.form.scope == 0) {
-              this.$refs.salesRefs.setShowCom(false);
-            } else if (this.form.saleType == 2 && this.form.scope == 0) {
-              this.$refs.salesRefs.setShowCom(false);
-            } else {
-              this.$refs.salesRefs.setShowCom(true);
-            }
             this.$refs.basicRefs.getFormInfo(this.form, this.$route.query.type);
             this.$refs.salesRefs.getFormInfo(this.form);
             this.$refs.productRefs.getFormInfo(this.form);
@@ -366,13 +358,6 @@ export default {
               });
             }
             this.headerImg.sort((a, b) => a.sort - b.sort); //排序 视频在最前面>封面>商品banner
-            if (this.form.scope == 0) {
-              this.$refs.salesRefs.setShowCom(false);
-            } else if (this.form.saleType == 2 && this.form.scope == 0) {
-              this.$refs.salesRefs.setShowCom(false);
-            } else {
-              this.$refs.salesRefs.setShowCom(true);
-            }
             this.$refs.basicRefs.getFormInfo(this.form, this.$route.query.type);
             this.$refs.salesRefs.getFormInfo(this.form);
             this.$refs.productRefs.getFormInfo(this.form);
@@ -385,21 +370,7 @@ export default {
     skuRemove(list) {
       this.skulist = list;
     },
-    getInfo() {
-      getStoreInfo().then((res) => {
-        if (res.code == 200) {
-          if (res.data.scope == 0) {
-            if (this.form.saleType == 2) {
-              this.$refs.salesRefs.setShowCom(true);
-            } else {
-              this.$refs.salesRefs.setShowCom(false);
-            }
-          } else {
-            this.$refs.salesRefs.setShowCom(true);
-          }
-        }
-      });
-    },
+
     submitCancel() {
       this.$confirm("是否取消发布,所填写的信息将会消失?", "提示", {
         confirmButtonText: "确定",
@@ -461,10 +432,10 @@ export default {
         this.$message.error(`商品规格不能为空`);
         return;
       }
-      if (!this.form.shippingAddrBean.provinceCode) {
-        this.$message.error(`请选择发货地址的省市区!`);
-        return;
-      }
+      // if (!this.form.shippingAddrBean.provinceCode) {
+      //   this.$message.error(`请选择发货地址的省市区!`);
+      //   return;
+      // }
       this.btnLading = true;
       if (!this.form.presaleStartTime && !this.form.presaleEndTime) {
         if (this.form.datePicke) {
@@ -515,13 +486,6 @@ export default {
     },
     updateValue(val) {
       this.form = { ...this.form, ...val };
-      if (this.form.saleType == 2) {
-        this.$refs.salesRefs.setShowCom(true);
-      } else if (this.form.scope == 0) {
-        this.$refs.salesRefs.setShowCom(false);
-      } else {
-        this.$refs.salesRefs.setShowCom(true);
-      }
 
       this.headerImg = [];
       if (val.vid || this.form.vid) {

+ 26 - 13
src/views/shipping/list/draftProduct.vue

@@ -70,28 +70,20 @@
       </el-table-column>
       <el-table-column label="价格" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList ? scope.row.skuList[0].skuPriceList[0].price : ""
-          }}/{{ scope.row.unit }}
+          {{ getPrice(scope.row, "price") }}/{{ scope.row.unit }}
         </template>
       </el-table-column>
 
       <el-table-column label="起批量" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList
-              ? scope.row.skuList[0].skuPriceList[0].minPurchase
-              : ""
-          }}{{ scope.row.unit }}
+          {{ getPrice(scope.row, "minPurchase") }}
+          {{ scope.row.unit }}
         </template>
       </el-table-column>
       <el-table-column label="库存" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList
-              ? scope.row.skuList[0].stock + "/" + scope.row.unit
-              : ""
-          }}
+          {{ getStock(scope.row) }}
+          {{ scope.row.unit }}
         </template>
       </el-table-column>
       <el-table-column label="经营区域" align="center">
@@ -176,6 +168,27 @@ export default {
     this.getInfo();
   },
   methods: {
+    getStock(row) {
+      if (
+        row.skuList &&
+        row.skuList.length > 0 &&
+        row.skuList[0].stock !== undefined
+      ) {
+        return row.skuList[0].stock;
+      }
+      return "";
+    },
+    getPrice(row, value) {
+      if (
+        row.skuList &&
+        row.skuList.length > 0 &&
+        row.skuList[0].skuPriceList &&
+        row.skuList[0].skuPriceList.length > 0
+      ) {
+        return row.skuList[0].skuPriceList[0][value];
+      }
+      return "";
+    },
     getInfo() {
       getStoreInfo().then((res) => {
         if (res.code == 200) {

+ 5 - 34
src/views/shipping/module/basic-info.vue

@@ -35,35 +35,6 @@
           />
         </el-form-item>
       </el-col>
-      <el-col :span="24" v-if="form.saleType == 2">
-        <el-form-item prop="carpoolSuccessTime">
-          <span slot="label">拼车成功时间</span>
-          <el-input
-            v-model="form.carpoolSuccessTime"
-            placeholder="请输入拼车成功时间"
-            clearable
-            style="width: 260px"
-            @input="passValue"
-          >
-            <template slot="suffix"> 天 </template>
-          </el-input>
-        </el-form-item>
-      </el-col>
-      <el-col :span="24" v-if="form.saleType == 4">
-        <el-form-item prop="giftDesc">
-          <span slot="label">礼包描述</span>
-          <el-input
-            @input="passValue"
-            v-model="form.giftDesc"
-            maxlength="70"
-            show-word-limit
-            placeholder="请输入礼包描述"
-            clearable
-            style="width: 600px"
-          >
-          </el-input>
-        </el-form-item>
-      </el-col>
       <el-col :span="24">
         <el-form-item label="商品视频">
           <span class="tips">上传视频用户看的更直接</span>
@@ -260,7 +231,7 @@ export default {
           ? moment(presaleEndTime).format("yyyy-MM-DD HH:mm:ss")
           : "",
       };
-
+      this.categoryName=categoryName
       // 更新日期选择器
       if (presaleStartTime && presaleEndTime) {
         this.$nextTick(() => {
@@ -327,10 +298,10 @@ export default {
         if (res.code == 200) {
           this.shopInfo = res.data;
           this.form.scope = res.data.scope;
-          if (res.data.scope == 1) {
-            this.form.saleType = 0;
-            this.form.saleModel = 1;
-          }
+          // if (res.data.scope == 1) {
+          //   this.form.saleType = 0;
+          //   this.form.saleModel = 1;
+          // }
         }
       });
     },

+ 8 - 38
src/views/shipping/updateProduct.vue

@@ -277,7 +277,6 @@ export default {
     });
   },
   mounted() {
-    this.getInfo();
     if (
       (this.$route.query.params != "[object Object]" &&
         this.$route.query.params) ||
@@ -324,13 +323,6 @@ export default {
               });
             }
             this.headerImg.sort((a, b) => a.sort - b.sort); //排序 视频在最前面>封面>商品banner
-            if (this.form.scope == 0) {
-              this.$refs.salesRefs.setShowCom(false);
-            } else if (this.form.saleType == 2 && this.form.scope == 0) {
-              this.$refs.salesRefs.setShowCom(false);
-            } else {
-              this.$refs.salesRefs.setShowCom(true);
-            }
             this.$refs.basicRefs.getFormInfo(this.form, this.$route.query.type);
             this.$refs.salesRefs.getFormInfo(this.form);
             this.$refs.productRefs.getFormInfo(this.form);
@@ -366,13 +358,6 @@ export default {
               });
             }
             this.headerImg.sort((a, b) => a.sort - b.sort); //排序 视频在最前面>封面>商品banner
-            if (this.form.scope == 0) {
-              this.$refs.salesRefs.setShowCom(false);
-            } else if (this.form.saleType == 2 && this.form.scope == 0) {
-              this.$refs.salesRefs.setShowCom(false);
-            } else {
-              this.$refs.salesRefs.setShowCom(true);
-            }
             this.$refs.basicRefs.getFormInfo(this.form, this.$route.query.type);
             this.$refs.salesRefs.getFormInfo(this.form);
             this.$refs.productRefs.getFormInfo(this.form);
@@ -385,21 +370,7 @@ export default {
     skuRemove(list) {
       this.skulist = list;
     },
-    getInfo() {
-      getStoreInfo().then((res) => {
-        if (res.code == 200) {
-          if (res.data.scope == 0) {
-            if (this.form.saleType == 2) {
-              this.$refs.salesRefs.setShowCom(true);
-            } else {
-              this.$refs.salesRefs.setShowCom(false);
-            }
-          } else {
-            this.$refs.salesRefs.setShowCom(true);
-          }
-        }
-      });
-    },
+
     submitCancel() {
       this.$confirm("是否取消发布,所填写的信息将会消失?", "提示", {
         confirmButtonText: "确定",
@@ -515,14 +486,13 @@ export default {
     },
     updateValue(val) {
       this.form = { ...this.form, ...val };
-      if (this.form.saleType == 2) {
-        this.$refs.salesRefs.setShowCom(true);
-      } else if (this.form.scope == 0) {
-        this.$refs.salesRefs.setShowCom(false);
-      } else {
-        this.$refs.salesRefs.setShowCom(true);
-      }
-
+      // if (this.form.saleType == 2) {
+      //   this.$refs.salesRefs.setShowCom(true);
+      // } else if (this.form.scope == 0) {
+      //   this.$refs.salesRefs.setShowCom(false);
+      // } else {
+      //   this.$refs.salesRefs.setShowCom(true);
+      // }
       this.headerImg = [];
       if (val.vid || this.form.vid) {
         this.headerImg.push({

+ 26 - 15
src/views/transmission/list/draftProduct.vue

@@ -70,30 +70,20 @@
       </el-table-column>
       <el-table-column label="价格" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList.length > 0
-              ? scope.row.skuList[0].skuPriceList[0].price
-              : ""
-          }}/{{ scope.row.unit }}
+          {{ getPrice(scope.row, "price") }}/{{ scope.row.unit }}
         </template>
       </el-table-column>
 
       <el-table-column label="起批量" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList.length > 0
-              ? scope.row.skuList[0].skuPriceList[0].minPurchase
-              : ""
-          }}{{ scope.row.unit }}
+          {{ getPrice(scope.row, "minPurchase") }}
+          {{ scope.row.unit }}
         </template>
       </el-table-column>
       <el-table-column label="库存" align="center">
         <template slot-scope="scope">
-          {{
-            scope.row.skuList.length > 0
-              ? scope.row.skuList[0].stock + "/" + scope.row.unit
-              : ""
-          }}
+          {{ getStock(scope.row) }}
+          {{ scope.row.unit }}
         </template>
       </el-table-column>
 
@@ -177,6 +167,27 @@ export default {
     this.getInfo();
   },
   methods: {
+    getStock(row) {
+      if (
+        row.skuList &&
+        row.skuList.length > 0 &&
+        row.skuList[0].stock !== undefined
+      ) {
+        return row.skuList[0].stock;
+      }
+      return "";
+    },
+    getPrice(row, value) {
+      if (
+        row.skuList &&
+        row.skuList.length > 0 &&
+        row.skuList[0].skuPriceList &&
+        row.skuList[0].skuPriceList.length > 0
+      ) {
+        return row.skuList[0].skuPriceList[0][value];
+      }
+      return "";
+    },
     getInfo() {
       getStoreInfo().then((res) => {
         if (res.code == 200) {