فهرست منبع

红德堂-运费模板,积分商品订单运费,奖励商品订单运费

Long 14 ساعت پیش
والد
کامیت
34f97cd9e4

+ 8 - 8
src/api/hisStore/city.js

@@ -3,14 +3,14 @@ import request from '@/utils/request'
 // 查询城市列表
 export function listCity(query) {
   return request({
-    url: '/store/city/list',
+    url: '/his/city/list',
     method: 'get',
     params: query
   })
 }
 export function getAllList(query) {
   return request({
-    url: '/store/city/getAllList',
+    url: '/his/city/getAllList',
     method: 'get',
     params: query
   })
@@ -18,7 +18,7 @@ export function getAllList(query) {
 
 export function getCitys() {
   return request({
-    url: '/store/city/getCitys',
+    url: '/his/city/getCitys',
     method: 'get'
   })
 }
@@ -28,7 +28,7 @@ export function getCitys() {
 // 查询城市详细
 export function getCity(id) {
   return request({
-    url: '/store/city/' + id,
+    url: '/his/city/' + id,
     method: 'get'
   })
 }
@@ -36,7 +36,7 @@ export function getCity(id) {
 // 新增城市
 export function addCity(data) {
   return request({
-    url: '/store/city',
+    url: '/his/city',
     method: 'post',
     data: data
   })
@@ -45,7 +45,7 @@ export function addCity(data) {
 // 修改城市
 export function updateCity(data) {
   return request({
-    url: '/store/city',
+    url: '/his/city',
     method: 'put',
     data: data
   })
@@ -54,7 +54,7 @@ export function updateCity(data) {
 // 删除城市
 export function delCity(id) {
   return request({
-    url: '/store/city/' + id,
+    url: '/his/city/' + id,
     method: 'delete'
   })
 }
@@ -62,7 +62,7 @@ export function delCity(id) {
 // 导出城市
 export function exportCity(query) {
   return request({
-    url: '/store/city/export',
+    url: '/his/city/export',
     method: 'get',
     params: query
   })

+ 18 - 0
src/api/hisStore/shippingTemplates.js

@@ -9,6 +9,15 @@ export function listShippingTemplates(query) {
   })
 }
 
+// 查询运费模板列表
+export function componentList(query) {
+  return request({
+    url: '/store/store/shippingTemplates/componentList',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询运费模板详细
 export function getShippingTemplates(shippingId) {
   return request({
@@ -57,3 +66,12 @@ export function getAllShippingTemplates() {
     method: 'get'
   })
 }
+
+// 根据ids查询模板列表
+export function getByIds(query) {
+  return request({
+    url: '/store/store/shippingTemplates/getByIds',
+    method: 'get',
+    params: query
+  })
+}

+ 493 - 0
src/components/City/indexZm.vue

@@ -0,0 +1,493 @@
+<template>
+  <el-dialog :close-on-click-modal="false"
+             :visible.sync="addressView"
+             append-to-body
+             class="modal"
+             title="选择城市" width="950px">
+    <el-row :gutter="24" type="flex">
+      <el-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24" class="item">
+        <div class="check-btn">
+          <el-checkbox v-model="iSselect" @change="allCheckbox">全选</el-checkbox>
+          <div class="empty" @click="empty">清空</div>
+        </div>
+      </el-col>
+    </el-row>
+    <el-row  :gutter="24"  :loading="loading" >
+      <el-col  :xl="6" :lg="6" :md="6" :sm="8" :xs="6" class="item"  v-for="(item,index) in cityList" :key="index">
+        <div @mouseenter="enter(index)" @mouseleave="leave()" v-if="item.level==1">
+          <el-checkbox
+            v-model="item.checked"
+            :label="item.cityName"
+            :disabled="item.disabled"
+            @change="checkedClick(index)"
+            :class="{ 'disabled-checkbox': item.disabled }"
+          >{{item.cityName}}</el-checkbox>
+          <div class="city" v-show="activeCity===index">
+            <div class="checkBox">
+              <div class="arrow"></div>
+              <div>
+                <el-checkbox
+                  v-model="subitem.checked"
+                  :label="subitem.cityName"
+                  :disabled="subitem.disabled"
+                  @change="primary(index,subindex)"
+                  class="itemn"
+                  v-for="(subitem,subindex) in item.children"
+                  :key="subindex"
+                  :class="{ 'disabled-checkbox': subitem.disabled }"
+                >{{subitem.cityName}}</el-checkbox>
+              </div>
+            </div>
+          </div>
+        </div>
+      </el-col>
+    </el-row>
+    <div slot="footer">
+      <el-button @click="close">取消</el-button>
+      <el-button type="primary" @click="confirm">确定</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import {getAllList} from "@/api/hisStore/city";
+
+export default {
+  name: 'CityZm',
+  props: {
+    type: {
+      type: Number,
+      default: 0
+    },
+    selectedCities: {
+      type: Array,
+      default: () => []
+    }
+  },
+  data() {
+    return {
+      iSselect: false,
+      addressView: false,
+      cityList: [],
+      activeCity: -1,
+      loading: false
+    }
+  },
+  methods: {
+    enter(index) {
+      this.activeCity = index;
+    },
+    leave() {
+      this.activeCity = null;
+    },
+    getCityList() {
+      this.loading = true;
+      getAllList().then(res => {
+        this.loading = false;
+        console.log(res.data)
+        var data = res.data;
+        this.cityList = data.filter(item => item.level === 1)
+
+        this.cityList.forEach((item, index, arr) => {
+          // 加载市的数据
+          var subData = data.filter(subitem => subitem.parentId === item.cityId && subitem.level === 2)
+          console.log(subData)
+          item.children = subData;
+
+          // 加载县的数据到每个市下
+          item.children.forEach((city, cityIndex) => {
+            var countyData = data.filter(county => county.parentId === city.cityId && county.level === 3);
+            if (countyData && countyData.length > 0) {
+              city.children = countyData;
+            }
+          });
+
+          // 标记已选择的城市
+          this.markSelectedCities(item);
+        });
+      })
+    },
+    // 标记已选择的城市为禁用状态
+    markSelectedCities(province) {
+      let that = this;
+      if (!that.selectedCities || that.selectedCities.length === 0) {
+        return;
+      }
+
+      // 检查是否选择了整个省(children为空数组或不存在)
+      let selectedProvince = that.selectedCities.find(city => {
+        if (city.cityId === province.cityId) {
+          // 如果没有children属性,或者children是空数组,说明选择了整个省
+          return !city.children || city.children.length === 0;
+        }
+        return false;
+      });
+
+      if (selectedProvince) {
+        // 整个省已选择,禁用省和所有市
+        that.$set(province, 'disabled', true);
+        if (province.children && province.children.length > 0) {
+          province.children.forEach((city, cityIndex) => {
+            that.$set(province.children[cityIndex], 'disabled', true);
+            // 如果市下有县,也禁用所有县
+            if (city.children && city.children.length > 0) {
+              city.children.forEach((county, countyIndex) => {
+                that.$set(province.children[cityIndex].children[countyIndex], 'disabled', true);
+              });
+            }
+          });
+        }
+      } else {
+        // 检查是否有部分市被选择
+        let selectedCityMap = new Map(); // 存储已选择的市及其县信息
+        that.selectedCities.forEach(selectedCity => {
+          if (selectedCity.cityId === province.cityId && selectedCity.children && selectedCity.children.length > 0) {
+            // 该省下有选择的市
+            selectedCity.children.forEach(child => {
+              if (!selectedCityMap.has(child.cityId)) {
+                selectedCityMap.set(child.cityId, new Set());
+              }
+              // 如果市下有选择的县,记录县的ID
+              if (child.children && child.children.length > 0) {
+                child.children.forEach(county => {
+                  selectedCityMap.get(child.cityId).add(county.cityId);
+                });
+              }
+            });
+          }
+        });
+
+        if (selectedCityMap.size > 0) {
+          // 检查该省下所有市是否都被选择
+          let allCitiesSelected = true;
+          if (province.children && province.children.length > 0) {
+            province.children.forEach(city => {
+              if (!selectedCityMap.has(city.cityId)) {
+                allCitiesSelected = false;
+              }
+            });
+          } else {
+            allCitiesSelected = false;
+          }
+
+          // 如果所有市都被选择,禁用整个省
+          if (allCitiesSelected) {
+            that.$set(province, 'disabled', true);
+          }
+
+          // 标记已选择的市为禁用,并检查市下的县
+          if (province.children && province.children.length > 0) {
+            province.children.forEach((city, cityIndex) => {
+              if (selectedCityMap.has(city.cityId)) {
+                // 该市已被选择
+                let selectedCountyIds = selectedCityMap.get(city.cityId);
+
+                // 检查是否选择了整个市(没有选择具体的县,或者县列表为空)
+                let citySelectedData = null;
+                that.selectedCities.forEach(selectedCity => {
+                  if (selectedCity.cityId === province.cityId && selectedCity.children) {
+                    let foundCity = selectedCity.children.find(c => c.cityId === city.cityId);
+                    if (foundCity && (!foundCity.children || foundCity.children.length === 0)) {
+                      citySelectedData = foundCity;
+                    }
+                  }
+                });
+
+                if (citySelectedData) {
+                  // 选择了整个市,禁用该市和所有县
+                  that.$set(province.children[cityIndex], 'disabled', true);
+                  if (city.children && city.children.length > 0) {
+                    city.children.forEach((county, countyIndex) => {
+                      that.$set(province.children[cityIndex].children[countyIndex], 'disabled', true);
+                    });
+                  }
+                } else if (city.children && city.children.length > 0 && selectedCountyIds.size > 0) {
+                  // 检查该市下所有县是否都被选择
+                  let allCountiesSelected = true;
+                  city.children.forEach(county => {
+                    if (!selectedCountyIds.has(county.cityId)) {
+                      allCountiesSelected = false;
+                    }
+                  });
+
+                  // 如果所有县都被选择,禁用该市
+                  if (allCountiesSelected) {
+                    that.$set(province.children[cityIndex], 'disabled', true);
+                  }
+
+                  // 标记已选择的县为禁用
+                  city.children.forEach((county, countyIndex) => {
+                    if (selectedCountyIds.has(county.cityId)) {
+                      that.$set(province.children[cityIndex].children[countyIndex], 'disabled', true);
+                    }
+                  });
+                } else {
+                  // 选择了整个市(没有县的数据或没有选择县),禁用该市
+                  that.$set(province.children[cityIndex], 'disabled', true);
+                }
+              }
+            });
+          }
+        }
+      }
+    },
+    /**
+     * 全选或者反选
+     * @param checked
+     */
+    allCheckbox: function () {
+      let that = this, checked = this.iSselect;
+      that.cityList.forEach(function (item, key) {
+        // 跳过已禁用的省
+        if (item.disabled) {
+          return;
+        }
+        that.$set(that.cityList[key], 'checked', checked);
+        if (checked) {
+          // 只计算未禁用的市的数量
+          let enabledCount = that.cityList[key].children.filter(city => !city.disabled).length;
+          that.$set(that.cityList[key], 'count', enabledCount);
+        } else {
+          that.$set(that.cityList[key], 'count', 0);
+        }
+        that.cityList[key].children.forEach(function (val, k) {
+          // 跳过已禁用的市
+          if (!val.disabled) {
+            that.$set(that.cityList[key].children[k], 'checked', checked);
+          }
+        })
+      });
+    },
+    // 清空;
+    empty() {
+      let that = this;
+      that.cityList.forEach(function (item, key) {
+        // 跳过已禁用的省
+        if (item.disabled) {
+          return;
+        }
+        that.$set(that.cityList[key], 'checked', false);
+        that.cityList[key].children.forEach(function (val, k) {
+          // 跳过已禁用的市
+          if (!val.disabled) {
+            that.$set(that.cityList[key].children[k], 'checked', false);
+          }
+        });
+        that.$set(that.cityList[key], 'count', 0);
+      });
+      this.iSselect = false;
+    },
+    /**
+     * 点击省
+     * @param index
+     */
+    checkedClick: function (index) {
+      let that = this;
+      // 如果省被禁用,不允许操作
+      if (that.cityList[index].disabled) {
+        return;
+      }
+      if (that.cityList[index].checked) {
+        // 只选择未禁用的市
+        let enabledCount = 0;
+        that.cityList[index].children.forEach(function (item, key) {
+          if (!item.disabled) {
+            that.$set(that.cityList[index].children[key], 'checked', true);
+            enabledCount++;
+          }
+        });
+        that.$set(that.cityList[index], 'count', enabledCount);
+      } else {
+        that.$set(that.cityList[index], 'count', 0);
+        that.$set(that.cityList[index], 'checked', false);
+        that.cityList[index].children.forEach(function (item, key) {
+          // 只取消未禁用的市的选中状态
+          if (!item.disabled) {
+            that.$set(that.cityList[index].children[key], 'checked', false);
+          }
+        });
+        that.iSselect = false;
+      }
+    },
+    /**
+     * 点击市区
+     * @param index
+     * @param ind
+     */
+    primary: function (index, ind) {
+      // 如果市被禁用,不允许操作
+      if (this.cityList[index].children[ind].disabled) {
+        return;
+      }
+      let checked = false, count = 0;
+      this.cityList[index].children.forEach(function (item, key) {
+        console.log("item:" + item.checked)
+        if (item.checked) {
+          checked = true;
+          count++;
+        }
+      });
+      this.$set(this.cityList[index], 'count', count);
+      this.$set(this.cityList[index], 'checked', checked);
+    },
+    // 确定;
+    confirm() {
+      let that = this;
+      // 被选中的省市;
+      let selectList = [];
+      that.cityList.forEach(function (item, key) {
+        // 跳过已禁用的省
+        if (item.disabled) {
+          return;
+        }
+        let data = {};
+        if (item.checked) {
+          data = {
+            name: item.cityName,
+            cityId: item.cityId,
+            children: []
+          };
+
+        }
+        that.cityList[key].children.forEach(function (i, k) {
+          // 只添加未禁用且选中的市
+          if (i.checked && !i.disabled) {
+            let cityData = {
+              cityId: i.cityId
+            };
+
+            // 如果市下有县,检查是否有选中的县
+            if (i.children && i.children.length > 0) {
+              let selectedCounties = [];
+              i.children.forEach(function (county, countyIndex) {
+                if (county.checked && !county.disabled) {
+                  selectedCounties.push({
+                    cityId: county.cityId
+                  });
+                }
+              });
+
+              // 如果有选中的县,添加到市的children中
+              if (selectedCounties.length > 0) {
+                cityData.children = selectedCounties;
+              }
+            }
+
+            data.children.push(cityData);
+          }
+        });
+        if (data.cityId !== undefined) {
+          selectList.push(data);
+        }
+      });
+      console.log(selectList);
+      if (selectList.length === 0) {
+        return this.$message({
+          message: '至少选择一个省份或者城市',
+          type: 'error'
+        });
+      } else {
+        this.$emit('selectCity', selectList, this.type);
+        that.addressView = false;
+        this.cityList = []
+      }
+    },
+    close() {
+      this.addressView = false;
+      this.cityList = [];
+      // 重置选中状态
+      this.iSselect = false;
+    }
+  },
+  mounted() {
+  }
+}
+</script>
+
+<style scoped>
+
+.modal .item {
+  position: relative;
+  margin-bottom: 20px;
+}
+
+.modal .item .city {
+  position: absolute;
+  z-index: 9;
+  top: 17px;
+  width: 100%;
+  padding-top: 18px;
+}
+
+.modal .item .city .checkBox {
+  width: 97%;
+  padding: 10px;
+  border: 1px solid #eee;
+  background-color: #fff;
+  max-height: 100px;
+  overflow-x: hidden;
+  overflow-y: auto;
+}
+
+.modal .item .city .checkBox .arrow {
+  position: absolute;
+  top: 3px;
+  width: 0;
+  height: 0;
+  border: 8px solid transparent;
+  border-bottom-color: #ddd;
+}
+
+.modal .item .city .checkBox .arrow:before {
+  position: absolute;
+  bottom: -8px;
+  right: -7px;
+  content: "";
+  width: 0;
+  height: 0;
+  border: 7px solid transparent;
+  border-bottom-color: #fff;
+}
+
+.modal .item .city .checkBox .itemn {
+  margin-bottom: 10px;
+}
+
+.radio {
+  padding: 5px 0;
+  font-size: 14px !important;
+}
+
+.red {
+  color: #ff0000;
+}
+
+.empty {
+  cursor: pointer;
+  margin-left: 10px
+}
+
+.check-btn {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: flex-end;
+}
+
+/* 禁用状态的复选框样式 */
+.disabled-checkbox {
+  opacity: 0.5;
+  cursor: not-allowed !important;
+}
+
+.disabled-checkbox /deep/ .el-checkbox__input.is-disabled .el-checkbox__inner {
+  background-color: #f5f7fa;
+  border-color: #e4e7ed;
+  cursor: not-allowed;
+}
+
+.disabled-checkbox /deep/ .el-checkbox__input.is-disabled + .el-checkbox__label {
+  color: #c0c4cc;
+  cursor: not-allowed;
+}
+</style>

+ 5 - 1
src/views/components/his/integralOrderDetails.vue

@@ -56,6 +56,10 @@
           <el-descriptions-item label="用户地址"><span v-if="item != null">{{ item.userAddress
               }}</span></el-descriptions-item>
           <el-descriptions-item label="支付积分"><span v-if="item != null">{{ item.integral }}</span></el-descriptions-item>
+          <el-descriptions-item label="优惠积分"><span v-if="item != null">{{ item.discountIntegral }}</span></el-descriptions-item>
+          <el-descriptions-item label="支付金额"><span v-if="item != null">{{ item.payMoney }}</span></el-descriptions-item>
+          <el-descriptions-item label="优惠金额"><span v-if="item != null">{{ item.discountMoney }}</span></el-descriptions-item>
+          <el-descriptions-item label="运费"><span v-if="item != null">{{ item.deliveryMoney }}</span></el-descriptions-item>
           <el-descriptions-item label="状态"><span v-if="item != null"> <dict-tag :options="statusOptions"
                 :value="item.status" /></span></el-descriptions-item>
           <el-descriptions-item label="快递公司编号"><span v-if="item != null">{{ item.deliveryCode
@@ -679,7 +683,7 @@ export default {
         });
       });
     },
-    
+
     // 执行完成订单请求
     executeFinishOrder() {
       const orderCode = this.item.orderCode;

+ 133 - 0
src/views/components/his/shippingTemplateComponent.vue

@@ -0,0 +1,133 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="模板名称" prop="name">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入模板名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-table  height="500" border v-loading="loading" :data="shippingTemplatesList">
+      <el-table-column label="模板ID" align="center" prop="id" />
+      <el-table-column label="模板名称" align="center" prop="name" />
+      <el-table-column label="计费方式" align="center" prop="type" >
+          <template slot-scope="scope">
+              <el-tag prop="type" v-for="(item, index) in typeOptions"    v-if="scope.row.type==item.dictValue">{{item.dictLabel}}</el-tag>
+          </template>
+      </el-table-column>
+      <el-table-column label="指定包邮开关" align="center" prop="appoint" >
+          <template slot-scope="scope">
+              <el-tag prop="type" v-for="(item, index) in appointOptions"    v-if="scope.row.appoint==item.dictValue">{{item.dictLabel}}</el-tag>
+          </template>
+      </el-table-column>
+      <el-table-column label="添加时间" align="center" prop="createTime" />
+      <el-table-column label="排序" align="center" prop="sort" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            @click="selectTemplate(scope.row)"
+          >选择
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { componentList, listShippingTemplates } from '@/api/hisStore/shippingTemplates'
+export default {
+  name: "ShippingTemplates",
+  data() {
+    return {
+      type:0,
+      appointList:[],
+      templateList:[],
+      appointOptions:[],
+      typeOptions:[],
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 运费模板表格数据
+      shippingTemplatesList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null,
+        type: null,
+        regionInfo: null,
+        appoint: null,
+        appointInfo: null,
+        isDel: 0,
+        sort: null
+      },
+    };
+  },
+  created() {
+    this.getDicts("store_shipping_type").then((response) => {
+      this.typeOptions = response.data;
+    });
+    this.getDicts("store_shipping_appoint").then((response) => {
+      this.appointOptions = response.data;
+    });
+    this.getList();
+  },
+  methods: {
+    selectTemplate(row) {
+      this.$emit("select-template", {"id": row.id, "name": row.name });
+    },
+    /** 查询运费模板列表 */
+    getList() {
+      this.loading = true;
+      componentList(this.queryParams).then(response => {
+        this.shippingTemplatesList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+  }
+};
+</script>

+ 65 - 3
src/views/course/rewardGoods/index.vue

@@ -214,6 +214,23 @@
           </el-col>
         </el-row>
 
+        <el-form-item label="运费模板" prop="tempId">
+          <el-select
+            ref="customSelectTemp"
+            v-model="form.tempId"
+            placeholder="请选择运费模板"
+            @click.native.stop="openTempDrawer"
+            clearable
+            style="width: 100%;">
+            <el-option
+              v-for="item in tempList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id">
+            </el-option>
+          </el-select>
+        </el-form-item>
+
         <el-form-item label="状态" prop="status">
           <el-radio-group v-model="form.status">
             <el-radio
@@ -240,6 +257,11 @@
       :title="show.title" :visible.sync="show.open">
       <GoodsDetail  ref="goodsDetail" />
     </el-drawer>
+
+    <!-- 选择运费模板 -->
+    <el-drawer :append-to-body="true" :with-header="false" size="75%" :visible.sync="tempDrawerOpen">
+      <template-component @select-template="selectTemplate"></template-component>
+    </el-drawer>
   </div>
 </template>
 
@@ -250,10 +272,12 @@ import { listStore } from '@/api/his/storeProduct'
 import Material from '@/components/Material/index.vue'
 import Editor from '@/components/Editor/wang.vue'
 import GoodsDetail from './goodsDetail.vue'
+import TemplateComponent from '@/views/components/his/shippingTemplateComponent.vue'
+import { getByIds } from '@/api/hisStore/shippingTemplates'
 
 export default {
   name: "RewardGoods",
-  components: { GoodsDetail, Material, ImageUpload, Editor },
+  components: { GoodsDetail, Material, ImageUpload, Editor, TemplateComponent },
   data() {
     return {
       // 遮罩层
@@ -284,6 +308,9 @@ export default {
       storeOptions: [],
       // 状态选项
       statusOptions: [],
+      // 运费模板列表
+      tempList: [],
+      tempDrawerOpen: false,
       activeName: '1',
       // 查询参数
       queryParams: {
@@ -310,7 +337,8 @@ export default {
         stock: 0,
         status: "1",
         sort: 1,
-        remark: null
+        remark: null,
+        tempId: null
       },
       // 表单校验
       rules: {
@@ -410,8 +438,11 @@ export default {
         stock: 0,
         status: "1",
         sort: 1,
-        remark: null
+        remark: null,
+        tempId: null
       }
+      this.imageArr = []
+      this.photoArr = []
       this.resetForm("form");
     },
     /** 搜索按钮操作 */
@@ -451,6 +482,10 @@ export default {
           this.photoArr = this.form.goodsImages.split(",");
         }
         this.form.status = this.form.status + ''
+
+        if (this.form.tempId) {
+          this.initTemp(this.form.tempId)
+        }
       });
     },
     /** 详情 */
@@ -497,6 +532,33 @@ export default {
     updateText(text) {
       this.form.goodsDesc = text
     },
+    // 打开选项弹窗
+    openTempDrawer() {
+      this.$nextTick(() => {
+        this.$refs.customSelectTemp?.blur?.()
+      })
+      this.tempDrawerOpen = true
+    },
+    selectTemplate(temp) {
+      this.form.tempId = temp.id
+      if (!this.tempList.some(item => item.id === temp.id)) {
+        this.tempList.push(temp)
+      }
+      this.tempDrawerOpen = false
+    },
+    initTemp(ids) {
+      if (!ids) {
+        return
+      }
+      getByIds({ids}).then(response => {
+        const {data} = response
+        data.forEach(t => {
+          if (!this.tempList.some(item => item.id === t.id)) {
+            this.tempList.push({"id": t.id, "name": t.name})
+          }
+        })
+      })
+    },
   }
 };
 </script>

+ 3 - 0
src/views/course/rewardGoodsOrder/goodsOrderDetail.vue

@@ -50,6 +50,9 @@
           <el-descriptions-item label="支付金额">
             <span class="color-danger">¥{{ item.payMoney }}</span>
           </el-descriptions-item>
+          <el-descriptions-item label="运费">
+            <span class="color-danger">¥{{ item.deliveryMoney || 0 }}</span>
+          </el-descriptions-item>
           <el-descriptions-item label="快递单号">
             <span>{{ item.deliverySn || '-' }}</span>
           </el-descriptions-item>

+ 63 - 4
src/views/his/integralGoods/index.vue

@@ -206,6 +206,22 @@
         <el-form-item label="库存" prop="stock">
           <el-input-number v-model="form.stock"  :min="0"  label="库存"></el-input-number>
         </el-form-item>
+        <el-form-item label="运费模板" prop="tempId">
+          <el-select
+            ref="customSelectTemp"
+            v-model="form.tempId"
+            placeholder="请选择运费模板"
+            @click.native.stop="openTempDrawer"
+            clearable
+            style="width: 100%;">
+            <el-option
+              v-for="item in tempList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id">
+            </el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label="状态">
           <el-radio-group v-model="form.status">
             <el-radio
@@ -256,7 +272,10 @@
           </div>
         </el-dialog>
 
-
+    <!-- 选择运费模板 -->
+    <el-drawer :append-to-body="true" :with-header="false" size="75%" :visible.sync="tempDrawerOpen">
+      <template-component @select-template="selectTemplate"></template-component>
+    </el-drawer>
   </div>
 </template>
 
@@ -266,9 +285,11 @@ import Material from '@/components/Material';
 import Editor from '@/components/Editor/wang';
 import { getToken } from "@/utils/auth";
 import integralGoodsDetails from '../../components/his/integralGoodsDetails';
+import TemplateComponent from '@/views/components/his/shippingTemplateComponent.vue'
+import { getByIds } from '@/api/hisStore/shippingTemplates'
 export default {
   name: "IntegralGoods",
-  components: {Material,Editor,integralGoodsDetails},
+  components: { TemplateComponent, Material,Editor,integralGoodsDetails},
   watch: {
     imageArr: function(val) {
       this.form.imgUrl = val.join(',')
@@ -342,7 +363,10 @@ export default {
         goodsName: [
           { required: true, message: "商品名称不能为空", trigger: "blur" }
         ],
-      }
+      },
+      // 运费模板列表
+      tempList: [],
+      tempDrawerOpen: false
     };
   },
   created() {
@@ -420,8 +444,11 @@ export default {
         sort: null,
         stock: null,
         descs: null,
-        createTime: null
+        createTime: null,
+        tempId: null
       };
+      this.imageArr = []
+      this.photoArr = []
       this.resetForm("form");
     },
     /** 搜索按钮操作 */
@@ -465,6 +492,11 @@ export default {
          if(this.form.images!=null){
              this.photoArr=this.form.images.split(",");
            }
+
+        if (this.form.tempId) {
+          this.initTemp(this.form.tempId)
+        }
+
         //修改按钮
         setTimeout(() => {
                   if(this.form.descs==null){
@@ -476,6 +508,19 @@ export default {
                 }, 1);
       });
     },
+    initTemp(ids) {
+      if (!ids) {
+        return
+      }
+      getByIds({ids}).then(response => {
+        const {data} = response
+        data.forEach(t => {
+          if (!this.tempList.some(item => item.id === t.id)) {
+            this.tempList.push({"id": t.id, "name": t.name});
+          }
+        })
+      })
+    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
@@ -524,6 +569,20 @@ export default {
           this.download(response.msg);
           this.exportLoading = false;
         }).catch(() => {});
+    },
+    // 打开选项弹窗
+    openTempDrawer() {
+      this.$nextTick(() => {
+        this.$refs.customSelectTemp?.blur?.()
+      })
+      this.tempDrawerOpen = true
+    },
+    selectTemplate(temp) {
+      this.form.tempId = temp.id
+      if (!this.tempList.some(item => item.id === temp.id)) {
+        this.tempList.push(temp)
+      }
+      this.tempDrawerOpen = false
     }
   }
 };

+ 38 - 7
src/views/hisStore/shippingTemplates/index.vue

@@ -1,6 +1,20 @@
 <template>
   <div class="app-container">
-
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="模板名称" prop="name">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入模板名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
@@ -131,7 +145,7 @@
                 </el-table-column>
                 <el-table-column  label="操作">
                   <template slot-scope="scope">
-                    <a v-if="scope.row.regionName!=='默认全国'" @click="delCity(scope.row.index,1)">删除</a>
+                    <a  @click="delCity(scope.$index,1)">删除</a>
                   </template>
                 </el-table-column>
 
@@ -175,7 +189,7 @@
                 </el-table-column>
                 <el-table-column  label="操作">
                   <template slot-scope="scope">
-                    <a v-if="scope.row.regionName!=='默认全国'" @click="delCity(scope.row.index,2)">删除</a>
+                    <a  @click="delCity(scope.$index ,2)">删除</a>
                   </template>
                 </el-table-column>
 
@@ -197,17 +211,17 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
-    <city ref="city" @selectCity="selectCity" :type="type"></city>
+    <CityZm ref="city" @selectCity="selectCity" :type="type"></CityZm>
   </div>
 </template>
 
 <script>
 import { listShippingTemplates, getShippingTemplates, delShippingTemplates, addShippingTemplates, updateShippingTemplates, exportShippingTemplates } from "@/api/hisStore/shippingTemplates";
-import City from '@/components/City'
+import CityZm from '@/components/City/indexZm'
 export default {
   name: "ShippingTemplates",
   components: {
-    City
+    CityZm
   },
   data() {
     return {
@@ -267,7 +281,6 @@ export default {
   },
   methods: {
     delCity (index,type) {
-      console.log(index)
       if (type === 1) {
         this.templateList.splice(index, 1);
       } else {
@@ -301,8 +314,26 @@ export default {
     },
     // 单独添加配送区域
     addCity (type) {
+      // 获取已选择的城市数据
+      let selectedCities = [];
+      if (type === 1) {
+        // 配送区域
+        this.templateList.forEach(item => {
+          if (item.region && item.region.length > 0) {
+            selectedCities = selectedCities.concat(item.region);
+          }
+        });
+      } else {
+        // 指定包邮
+        this.appointList.forEach(item => {
+          if (item.place && item.place.length > 0) {
+            selectedCities = selectedCities.concat(item.place);
+          }
+        });
+      }
       this.$refs.city.addressView = true;
       this.type = type;
+      this.$refs.city.selectedCities = selectedCities;
       this.$refs.city.getCityList()
     },
     /** 查询运费模板列表 */