lilei 4 éve
szülő
commit
60f9d32026

+ 32 - 0
src/config/router.config.js

@@ -241,6 +241,38 @@ export const asyncRouterMap = [{
       }
     ]
   },
+  {
+    path: '/market',
+    redirect: '/market/winingRecord',
+    component: PageView,
+    meta: {
+      title: '营销',
+      icon: 'gift'
+      // permission: 'M_winingRecord_list'
+    },
+    children: [
+      {
+        path: '/market/winingRecord',
+        name: 'winingRecord',
+        component: () => import(/* webpackChunkName: "market" */ '@/views/market/winingRecord.vue'),
+        meta: {
+          title: '中奖记录',
+          icon: 'file-done'
+          // permission: 'M_winingRecord_list'
+        }
+      },
+      {
+        path: '/market/lotterySettings',
+        name: 'lotterySettings',
+        component: () => import(/* webpackChunkName: "market" */ '@/views/market/lotterySettings.vue'),
+        meta: {
+          title: '大转盘设置',
+          icon: 'edit'
+          // permission: 'M_lotterySettings'
+        }
+      }
+    ]
+  },
   {
     path: '/shopSetting',
     redirect: '/shopSetting/bannerSetting',

+ 246 - 0
src/views/market/GoodsLogistics.vue

@@ -0,0 +1,246 @@
+<template>
+  <a-modal
+    centered
+    class="modalBox"
+    :footer="null"
+    :maskClosable="false"
+    title="发货"
+    v-model="isShow"
+    @cancle="isShow=false"
+    :width="1000">
+    <a-form
+      id="logistics-form"
+      :form="form"
+      ref="form"
+      v-bind="formItemLayout"
+      @submit="handleSubmit">
+      <h4>物流信息:</h4>
+      <a-form-item label="快递公司" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+        <a-select
+          id="logistics-expressName"
+          allowClear
+          v-decorator="[
+            'formData.expressName',
+            { initialValue: formData.expressName,
+              rules: [{ required: true, message: '请选择快递公司' }] },
+          ]"
+          placeholder="请选择快递公司"
+        >
+          <a-select-option v-for="(item,index) in expressCompany" :key="index" :value="item.expressName">
+            {{ item.expressName }}
+          </a-select-option>
+        </a-select>
+      </a-form-item>
+      <a-form-item label="运单编号" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+        <a-input
+          id="logistics-expressNum"
+          :maxLength="30"
+          v-decorator="[
+            'formData.expressNum',
+            { initialValue: formData.expressNum, getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入运单编号' }] }
+          ]"
+          placeholder="请输入运单编号(最多30个字符)"
+          allowClear />
+      </a-form-item>
+      <h4>收货人信息:</h4>
+      <a-form-item label="收货人姓名" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+        <a-input
+          id="network-edit-name"
+          :maxLength="30"
+          v-decorator="[
+            'formData.name',
+            { initialValue: formData.name, getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入收货人姓名' }] }
+          ]"
+          placeholder="请输入收货人姓名(最多30个字符)"
+          allowClear />
+      </a-form-item>
+      <a-form-item label="收货人电话" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+        <a-input
+          id="network-edit-name"
+          :maxLength="30"
+          v-decorator="[
+            'formData.name',
+            { initialValue: formData.name, getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入收货人电话' }] }
+          ]"
+          placeholder="请输入收货人电话"
+          allowClear />
+      </a-form-item>
+      <a-form-item label="省市区" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" required style="margin: 0;">
+        <a-row :gutter="20">
+          <!-- 地址 -->
+          <a-col span="8">
+            <a-form-item>
+              <a-select id="network-edit-provinceCode" @change="getCityList" v-decorator="['formData.provinceCode', { initialValue: formData.provinceCode, rules: [{ required: true, message: '请选择省' }] }]" placeholder="请选择省">
+                <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+          <a-col span="8">
+            <a-form-item prop="cityCode">
+              <a-select id="network-edit-cityCode" v-decorator="['formData.cityCode', { initialValue: formData.cityCode, rules: [{ required: true, message: '请选择市' }] }]" @change="getAreaList" placeholder="请选择市">
+                <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+          <a-col span="8">
+            <a-form-item prop="districtCode">
+              <a-select id="network-edit-districtCode" v-decorator="['formData.districtCode', { initialValue: formData.districtCode, rules: [{ required: true, message: '请选择区' }] }]" @change="areaCharged" placeholder="请选择区/县">
+                <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+        </a-row>
+      </a-form-item>
+      <a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="详细地址">
+        <a-input
+          id="network-edit-address"
+          :maxLength="30"
+          v-decorator="[
+            'formData.address',
+            { initialValue: formData.address, getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入详细地址' }] }
+          ]"
+          placeholder="请输入详细地址(最多30个字符)"
+          allowClear />
+      </a-form-item>
+      <a-form-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
+        <a-button type="primary" html-type="submit" id="logistics-submit" style="margin-right: 15px">保存</a-button>
+        <a-button @click="isShow=false" style="margin-left: 15px" id="logistics-close">取消</a-button>
+      </a-form-item>
+    </a-form>
+  </a-modal>
+</template>
+
+<script>
+import { VSelect } from '@/components'
+import { stationSave, stationFind, getProvince, getCityByPro, getDistrictByCity } from '@/api/station'
+import { expressCompanyQuery } from '@/api/order'
+export default {
+  name: 'GoodsLogistics',
+  components: { VSelect },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      form: this.$form.createForm(this),
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 16 }
+      },
+      formData: {
+        expressName: undefined, //  快递公司
+        expressNum: '', //  运单编号
+        provinceCode: undefined, //  省
+        provinceName: '',
+        cityCode: undefined, // 市
+        cityName: '',
+        districtCode: undefined, // 区
+        districtName: '',
+        address: '' //  详细地址
+      },
+      addrProvinceList: [], //  省下拉
+      addrCityList: [], //  市下拉
+      addrDistrictList: [], //  区下拉
+      isShow: this.openModal, //  是否填写物流信息
+      expressCompany: [] //  快递公司
+    }
+  },
+  mounted () {
+    this.getExpressCompany()
+  },
+  methods: {
+    // 获取省列表'
+    getProvinceList () {
+      getProvince().then(res => {
+        if (res.status == 200) {
+          this.addrProvinceList = res.data || []
+        } else {
+          this.addrProvinceList = []
+        }
+      })
+    },
+    // 获取城市列表
+    getCityList (val) {
+      this.addrCityList = []
+      this.addrDistrictList = []
+      this.form.setFieldsValue({ 'formData.cityCode': undefined })
+      this.form.setFieldsValue({ 'formData.districtCode': undefined })
+      this.form.setFieldsValue({ 'formData.address': '' })
+      this.getCityListRequest(val)
+    },
+    getCityListRequest (val) {
+      getCityByPro({
+        id: val
+      }).then(res => {
+        if (res.status == 200) {
+          this.addrCityList = res.data || []
+        } else {
+          this.addrCityList = []
+        }
+      })
+    },
+    // 获取区县列表
+    getAreaList (val) {
+      this.addrDistrictList = []
+      this.form.setFieldsValue({ 'formData.districtCode': undefined })
+      this.form.setFieldsValue({ 'formData.address': '' })
+      this.getAreaListRequest(val)
+    },
+    getAreaListRequest (val) {
+      getDistrictByCity({
+        id: val
+      }).then(res => {
+        if (res.status == 200) {
+          this.addrDistrictList = res.data || []
+        } else {
+          this.addrDistrictList = []
+        }
+      })
+    },
+    // 区县变更
+    areaCharged (val) {
+      this.form.setFieldsValue({ 'formData.address': '' })
+    },
+    //  物流信息  保存
+    handleSubmit (e) {
+      e.preventDefault()
+      this.form.validateFields((err, values) => {
+        if (!err) {
+          this.$emit('submit', values.formData)
+        }
+      })
+    },
+    //  获取快递公司
+    getExpressCompany () {
+      expressCompanyQuery({}).then(res => {
+        if (res.status == 200) {
+          this.expressCompany = res.data
+        } else {
+          this.expressCompany = []
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (val) {
+      if (!val) {
+        this.$emit('close')
+      } else {
+        this.getProvinceList()
+        this.form.resetFields()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+</style>

+ 9 - 0
src/views/market/lotterySettings.vue

@@ -0,0 +1,9 @@
+<template>
+  <div>sdfsdf</div>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>

+ 194 - 0
src/views/market/winingRecord.vue

@@ -0,0 +1,194 @@
+<template>
+  <a-card :bordered="false" class="winRecord-table-page-search-wrapper">
+    <div class="winRecord-searchForm">
+      <a-form layout="inline" v-bind="formItemLayout" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="20">
+          <a-col :span="6">
+            <a-form-item label="中奖时间" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+              <a-range-picker
+                id="winRecord-time"
+                v-model="time"
+                :format="dateFormat"
+                :placeholder="['开始时间','结束时间']"
+                :disabledDate="disabledDate"
+                @change="onChange" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-form-item label="奖品名称" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+              <a-input id="winRecord-customerMobile" allowClear :maxLength="11" v-model="queryParam.customerMobile" placeholder="请输入奖品名称" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="4">
+            <a-form-item label="状态" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+              <v-select
+                v-model="queryParam.orderState"
+                ref="orderState"
+                id="winRecord-status"
+                code="ORDER_STATE"
+                placeholder="请选择状态"
+                allowClear></v-select>
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-button class="handle-btn serach-btn" id="winRecord-btn-serach" type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+            <a-button class="handle-btn" type="" id="winRecord-btn-reset" @click="handleReset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <s-table
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-icon
+          type="rocket"
+          id="winRecord-sendGood"
+          title="发货"
+          class="actionBtn icon-blues"
+          @click="sendGood(record)" />
+        <a-icon
+          type="eye"
+          id="winRecord-handleView"
+          title="详情"
+          class="actionBtn icon-green"
+          @click="handleView(record)" />
+
+      </template>
+    </s-table>
+    <!-- 物流信息 -->
+    <GoodsLogistics :openModal="openModal" @submit="handleSubmit" @close="openModal=false" />
+  </a-card>
+
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import GoodsLogistics from './GoodsLogistics.vue'
+import getDate from '@/libs/getDate.js'
+import moment from 'moment'
+import { orderList } from '@/api/order'
+export default {
+  name: 'WinRecord',
+  components: { STable, VSelect, GoodsLogistics },
+  data () {
+    return {
+      openModal: false, //  是否填写物流信息
+      formItemLayout: {
+        labelCol: { span: 7 },
+        wrapperCol: { span: 17 }
+      },
+      // 查询参数
+      queryParam: {
+        beginDate: null, // 开始时间
+        endDate: null, // 结束时间
+        customerMobile: '', //  用户手机
+        orderSn: '', //  订单编号
+        orderState: null // 订单状态
+      },
+      loading: false, // 导出loading
+      // 表头
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
+        { title: '中奖时间', dataIndex: 'orderTime', width: 200, align: 'center' },
+        { title: '活动名称', dataIndex: 'customerMobile', align: 'center' },
+        { title: '奖品', dataIndex: 'orderSn', width: 200, align: 'center' },
+        { title: '中奖用户', dataIndex: 'customerMobile', width: 200, align: 'center' },
+        { title: '状态', dataIndex: 'orderStateDictValue', width: 200, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        const searchData = Object.assign(parameter, this.queryParam)
+        if (this.time && this.time.length) {
+          searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
+          searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD')
+        } else {
+          searchData.beginDate = ''
+          searchData.endDate = ''
+        }
+        return orderList(searchData).then(res => {
+          if (res.status == 200) {
+            const no = (res.data.pageNo - 1) * res.data.pageSize
+            for (let i = 0; i < res.data.list.length; i++) {
+              const _item = res.data.list[i]
+              _item.no = no + i + 1
+              _item.status = _item.status + '' === '1'
+            }
+            return res.data
+          }
+        })
+      },
+      // 将默认当天时间日期回显在时间选择框中
+      time: [
+        moment(getDate.getToday().starttime, this.dateFormat),
+        moment(getDate.getToday().endtime, this.dateFormat)
+      ],
+      dateFormat: 'YYYY-MM-DD'
+    }
+  },
+  methods: {
+    moment,
+    // 不可选日期
+    disabledDate (date, dateStrings) {
+      return date && date.valueOf() > Date.now()
+    },
+    // 创建时间change
+    onChange (dates, dateStrings) {
+      if ((dates, dateStrings)) {
+        this.queryParam.beginDate = dateStrings[0]
+        this.queryParam.endDate = dateStrings[1]
+      }
+    },
+    // 重置
+    handleReset () {
+      this.queryParam.beginDate = getDate.getToday().starttime
+      this.queryParam.endDate = getDate.getToday().endtime
+      this.time = [
+        moment(getDate.getToday().starttime, this.dateFormat),
+        moment(getDate.getToday().endtime, this.dateFormat)
+      ]
+      this.queryParam.customerMobile = ''
+      this.queryParam.orderSn = ''
+      this.queryParam.orderState = null
+      this.$refs.table.refresh(true)
+    },
+    //  查看物流详情
+    handleView (row) {
+      this.$router.push({ path: `/order/orderManage/detail/${row.id}` })
+    },
+    // 发货
+    sendGood () {
+      this.openModal = true
+    },
+    // 提交发货
+    handleSubmit () {
+
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+  .winRecord-table-page-search-wrapper{
+    .winRecord-searchForm{
+      .ant-form-inline .ant-form-item{
+        width: 100%;
+      }
+      // 搜索框的下间距
+      .ant-form-item {
+      	margin-bottom: 10px;
+      }
+      .handle-btn{
+        margin-top: 4px;
+      }
+      .serach-btn{
+        margin-right: 10px;
+      }
+    }
+  }
+</style>