doum
14 小时以前 28db820caf0ed90f4326d29cb0fa7a19cba92775
admin/src/views/business/shop.vue
@@ -5,19 +5,52 @@
      <el-form-item label="名称" prop="name">
        <el-input v-model="searchForm.name" placeholder="请输入名称" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="门店ID" prop="code">
        <el-input v-model="searchForm.code" placeholder="请输入门店ID" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="登录账号" prop="name">
        <el-input v-model="searchForm.username" placeholder="请输入登录账号" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="销售模式" prop="saleType" >
        <!-- 0正常 1禁用 -->
        <el-select     v-model="searchForm.saleType"  placeholder="销售模式"  @change="search"  >
        <el-select     v-model="searchForm.saleType"  placeholder="销售模式"  style="width: 100px"  @change="search"  >
          <el-option  :key="0" :value="0"  label="平台铺货"  ></el-option>
          <el-option   :key="1" :value="1" label="自主采购"  ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="省市区" prop="provinceId" >
      <el-select v-model="searchForm.provinceId" placeholder="省份" style="width: 100px" filterable @change="selectProvince">
        <el-option
            v-for="item in provinces"
            :key="item.id"
            :value="item.id"
            :label="item.name"
        ></el-option>
      </el-select>
      </el-form-item>
      <el-form-item label="" prop="cityId" >
      <el-select v-model="searchForm.cityId" filterable placeholder="城市"  @change="selectCity" style="width: 100px" >
        <el-option
            v-for="item in cities"
            :key="item.id"
            :value="item.id"
            :label="item.name"
        ></el-option>
      </el-select>
      </el-form-item>
      <el-form-item label="" prop="areaId" >
      <el-select v-model="searchForm.areaId" filterable placeholder="区域"  style="width: 100px" >
        <el-option
            v-for="item in areas"
            :key="item.id"
            :value="item.id"
            :label="item.name"
        ></el-option>
      </el-select>
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <!-- 0正常 1禁用 -->
        <el-select     v-model="searchForm.status"  placeholder="请选择状态"    @change="search"   >
        <el-select     v-model="searchForm.status"  placeholder="请选择状态"  style="width: 100px"    @change="search"   >
          <el-option  :key="0" :value="0"  label="正常"  ></el-option>
          <el-option   :key="1" :value="1" label="禁用"  ></el-option>
        </el-select>
@@ -29,9 +62,10 @@
    </el-form>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <ul class="toolbar" v-permissions="['business:shop:create', 'business:shop:delete']">
        <li><el-button type="primary" @click="$refs.operaShopWindow.open('新建店铺')" icon="el-icon-plus" v-permissions="['business:shop:create']">新建</el-button></li>
      <ul class="toolbar" >
        <li><el-button type="primary" @click="$refs.operaShopWindow.open('新建经销商')" icon="el-icon-plus" v-permissions="['business:shop:create']">新建</el-button></li>
        <!-- <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:shop:delete']">删除</el-button></li> -->
        <li><p class="tip-warn" style="width: 100%;margin-left: 20px;"><i class="el-icon-warning"></i>提示:【供货价设置】只统计上架状态的商品价格设置数据,(已定价商品数/全部商品数)</p></li>
      </ul>
      <el-table
        v-loading="isWorking.search"
@@ -77,6 +111,11 @@
            {{ row.saleType == 1?'自主采购':'平台铺货'}}
          </template>
        </el-table-column>
        <el-table-column prop="shopPrice" label="供货价设置" min-width="100px" align="center">
          <template slot-scope="{row}" >
            <div title="针对上架商品价格设置统计" @click="goPriceSet(row)" style="cursor:pointer;"><span  class="red"> {{row.pricedGoodsNum||0}}</span> / <span class="green"> {{row.goodsNum||0}}</span>  </div>
          </template>
        </el-table-column>
        <el-table-column prop="createDate" label="创建时间" align="center" min-width="140px"></el-table-column>
        <el-table-column prop="status" label="状态" align="center" min-width="100px" fixed="right">
          <template slot-scope="{row}">
@@ -93,15 +132,15 @@
        <el-table-column
          v-if="containPermissions(['business:shop:update', 'business:shop:delete'])"
          label="操作"
          min-width="200"
          min-width="280"
          fixed="right"
          align="center"
        >
          <template slot-scope="{row}">
            <el-button type="text" @click="$refs.operaShopWindow.open('编辑经销商', row)" icon="el-icon-edit" v-permissions="['business:shop:update']">编辑</el-button>
            <el-button type="text" v-permissions="['business:shop:update']" icon="el-icon-edit" @click="goPriceSet(row)">供货价</el-button>
            <el-button type="text" @click="resetPwd(row)" icon="el-icon-edit"  v-permissions="['business:shop:update']">重置密码</el-button>
            <el-button type="text" style="color: red" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:shop:delete']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -114,8 +153,9 @@
    </template>
    <!-- 新建/修改 -->
    <OperaShopWindow ref="operaShopWindow" @success="handlePageChange"/>
    <OperaShopDetailWindow ref="operaShopDetailWindow" />
    <OperaShopInfoWindow ref="OperaShopInfoWindow" />
    <ResetPwdShopWindow ref="resetPwdWindow"/>
    <OperaGoodsShopWindow ref="OperaGoodsShopWindow" @success="handlePageChange"/>
  </TableLayout>
</template>
@@ -124,36 +164,92 @@
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaShopWindow from '@/components/business/OperaShopWindow'
import OperaShopDetailWindow from '@/components/business/OperaShopDetailWindow'
import OperaShopInfoWindow from '@/components/business/OperaShopInfoWindow'
import OperaGoodsShopWindow from '@/components/business/OperaGoodsShopWindow'
import { resetPwd, updateIsRecById } from '@/api/business/shop'
import ResetPwdShopWindow from '@/components/business/ResetPwdShopWindow'
import { listByParentId } from '@/api/business/areas'
export default {
  name: 'Shop',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaShopWindow, OperaShopDetailWindow, ResetPwdShopWindow },
  components: { TableLayout, Pagination, OperaShopWindow, OperaShopInfoWindow, ResetPwdShopWindow, OperaGoodsShopWindow },
  data () {
    return {
      // 搜索
      searchForm: {
        name: '',
        code: '',
        username: '',
        status: '',
        saleType: '',
        isrec: ''
      }
        isrec: '',
        provinceId: '',
        cityId: '',
        areaId: ''
      },
      provinces: [],
      cities: [],
      areas: []
    }
  },
  created () {
    this.config({
      module: '店铺基本信息表',
      module: '经销商基本信息表',
      api: '/business/shop',
      'field.id': 'id',
      'field.main': 'id'
    })
    listByParentId({ type: 0, parentId: '' })
      .then(data => {
        this.provinces = data
      })
    this.search()
  },
  methods: {
    selectProvince (val) {
      this.searchForm.cityId = null
      this.searchForm.areaId = null
      this.cities = []
      this.areas = []
      listByParentId({ type: 1, parentId: val })
        .then(data => {
          this.cities = data
        })
        .catch(e => {
          this.$tip.error(e)
        })
    },
    selectCity (val) {
      this.searchForm.areaId = null
      this.areas = []
      listByParentId({ type: 2, parentId: val })
        .then(data => {
          this.areas = data
        })
        .catch(e => {
          this.$tip.error(e)
        })
    },
    initCityArea (proid, cityid) {
      listByParentId({ type: 1, parentId: proid })
        .then(data => {
          this.cities = data
        })
        .catch(e => {
          this.$tip.error(e)
        })
      listByParentId({ type: 2, parentId: cityid })
        .then(data => {
          this.areas = data
        })
        .catch(e => {
          this.$tip.error(e)
        })
    },
    goPriceSet (row) {
      this.$refs.OperaGoodsShopWindow.open('设置供货价 - ' + row.name, row)
    },
    resetPwd (row) {
      this.$dialog.messageWaring('确认重置该经销商【' + row.name + '】的登录密码吗?')
        .then(() => {
@@ -184,7 +280,7 @@
        })
    },
    showDetail (row) {
      this.$refs.operaShopDetailWindow.open('店铺详情', row)
      this.$refs.OperaShopInfoWindow.open('经销商详情【' + row.name + '】', row)
    }
  }
}