Procházet zdrojové kódy

统一登录平台用户管理

kk.shi před 3 roky
rodič
revize
3807df0cbc

+ 55 - 1
src/router/index.js

@@ -58,7 +58,7 @@ export const asyncRoutes = [
       {
         path: '',
         name: '',
-        component: () => import('@/views/coupon/activityList'),
+        component: () => import('@/views/rubik/rubikList'),
         meta: {
           title: '首页',
         },
@@ -100,6 +100,60 @@ export const asyncRoutes = [
     ],
   },
   {
+    path: '/application',
+    component: Layout,
+    redirect: 'noRedirect',
+    name: 'application',
+    alwaysShow: true,
+    meta: { title: '应用管理', icon: 'credit-card' },
+    children: [
+      {
+        path: 'applicationList',
+        name: 'applicationList',
+        component: () => import('@/views/application/applicationList'),
+        meta: {
+          title: '应用列表',
+        },
+      },
+      {
+        path: 'addApplication',
+        name: 'addApplication',
+        hidden: true,
+        component: () => import('@/views/application/addApplication'),
+        meta: {
+          title: '编辑应用',
+        },
+      },
+    ],
+  },
+  {
+    path: '/userInfo',
+    component: Layout,
+    redirect: 'noRedirect',
+    name: 'userInfo',
+    alwaysShow: true,
+    meta: { title: '用户管理', icon: 'credit-card' },
+    children: [
+      {
+        path: 'userinfoList',
+        name: 'userinfoList',
+        component: () => import('@/views/userInfo/userinfoList'),
+        meta: {
+          title: '用户列表',
+        },
+      },
+      {
+        path: 'addUserInfo',
+        name: 'addUserInfo',
+        hidden: true,
+        component: () => import('@/views/userInfo/addUserInfo'),
+        meta: {
+          title: '编辑用户',
+        },
+      },
+    ],
+  },
+  {
     path: '/error',
     component: EmptyLayout,
     redirect: 'noRedirect',

+ 607 - 0
src/views/application/addApplication.vue

@@ -0,0 +1,607 @@
+<template>
+  <div class="app-container">
+    <el-form
+      ref="form"
+      :rules="rules"
+      :model="form"
+      label-position="left"
+      label-width="100px"
+    >
+      <el-form-item label="应用名称" class="is-required" prop="name">
+        <el-input
+          v-model="form.name"
+          type="text"
+          :disabled="disable"
+          style="width: 300px"
+        />
+      </el-form-item>
+      <el-form-item label="图片" class="is-required" prop="coverImg">
+        <el-upload
+          class="upload-demo"
+          drag
+          :show-file-list="false"
+          :auto-upload="false"
+          action=""
+          :on-change="handleChange"
+        >
+          <i class="el-icon-upload"></i>
+          <div class="el-upload__text">
+            将文件拖到此处,或
+            <em>点击上传</em>
+          </div>
+        </el-upload>
+        <el-image
+          v-if="showCoverImg != ''"
+          :src="showCoverImg"
+          style="width: 300px"
+        ></el-image>
+      </el-form-item>
+
+      <el-form-item label="备注" class="is-required" prop="remark">
+        <el-input
+          v-model="form.remark"
+          type="textarea"
+          :disabled="disable"
+          style="width: 300px"
+          autocomplete="off"
+          maxlength="500"
+          show-word-limit
+        />
+      </el-form-item>
+
+      <el-form-item label="url" class="is-required" prop="remark">
+        <el-input
+          v-model="form.remark"
+          type="textarea"
+          :disabled="disable"
+          style="width: 300px"
+          autocomplete="off"
+          maxlength="500"
+          show-word-limit
+        />
+      </el-form-item>
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <div v-if="$route.query.editType === '1'">
+        <el-button type="primary" :hidden="disable" @click="updateData('form')">
+          保存
+        </el-button>
+        <el-button @click="resetUpdateForm('form')">重置</el-button>
+        <el-button @click="closePage()">关闭</el-button>
+      </div>
+      <div v-else>
+        <el-button
+          type="primary"
+          :hidden="disable"
+          @click="saveEditData('form')"
+        >
+          保存
+        </el-button>
+        <el-button @click="resetForm('form')">重置</el-button>
+        <el-button @click="closePage()">关闭</el-button>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+  import {
+    getCouponList,
+    getCouponPageList,
+    getEventInfo,
+    getSourceListApi,
+    saveEventInfo,
+    updateEventInfo,
+    uploadPic,
+  } from '../../axios/api'
+  import * as CouponPageListVo from '../../axios/vo/coupon-list-vo.js'
+  import { Message } from 'element-ui'
+  import { activity } from '@/api'
+
+  const toolbarOptions = [
+    ['bold', 'italic', 'underline', 'strike'], // toggled buttons
+    ['blockquote', 'code-block'],
+
+    [{ header: 1 }, { header: 2 }], // custom button values
+    [{ list: 'ordered' }, { list: 'bullet' }],
+    [{ script: 'sub' }, { script: 'super' }], // superscript/subscript
+    [{ indent: '-1' }, { indent: '+1' }], // outdent/indent
+    [{ direction: 'rtl' }], // text direction
+
+    [{ size: ['small', false, 'large', 'huge'] }], // custom dropdown
+    [{ header: [1, 2, 3, 4, 5, 6, false] }],
+
+    [{ color: [] }, { background: [] }], // dropdown with defaults from theme
+    [{ font: [] }],
+    [{ align: [] }],
+    ['link', 'image'],
+    ['clean'], // remove formatting button
+  ]
+  export default {
+    name: 'CouponList',
+    components: {},
+    data() {
+      return {
+        editorOption: {
+          placeholder: '',
+          theme: 'snow', // or 'bubble'
+          modules: {
+            toolbar: {
+              container: toolbarOptions, // 工具栏
+              handlers: {
+                image: function (value) {
+                  if (value) {
+                    document.querySelector('#quill-upload input').click()
+                  } else {
+                    this.quill.format('image', false)
+                  }
+                },
+              },
+            },
+          },
+        },
+
+        quillUpdateImg: false, // 根据图片上传状态来确定是否显示loading动画,刚开始是false,不显示
+
+        activityId: null,
+        listLoading: true,
+        dialogFormVisibleChoose: false,
+        disable: false,
+        timestamp: '',
+        useLimitType: 0,
+        costLimitType: 0,
+        showCoverImg: '',
+        couponList: [],
+
+        optionsMerchant: [
+          {
+            merchantId: '1605064954',
+            merchantName: '厐睿',
+          },
+          {
+            merchantId: '1609190004',
+            merchantName: '庞嘉',
+          },
+        ],
+        typeSource: [],
+
+        form: {
+          showPrice: 1,
+          name: '',
+          balanceMchid: '',
+          coverImg: '',
+          stock: '',
+          getLimit: '',
+          timestamp: '',
+          beginTimestamp: '',
+          endTimestamp: '',
+          isPay: 0,
+          isForever: 0,
+          price: 1,
+          remark: '',
+          buyRemark: '',
+          refundType: 1,
+          status: 1,
+          script: 0,
+          supplement: 0,
+          couponIdList: [
+            {
+              couponId: '',
+              num: '1',
+              price: '1',
+            },
+          ],
+
+          payMainType: 1,
+          merchantId: '',
+          source: '',
+        },
+        rules: {
+          name: [
+            { required: true, message: '请输入活动名称', trigger: 'blur' },
+            {
+              min: 1,
+              max: 80,
+              message: '长度在 1 到 80 个字符',
+              trigger: 'blur',
+            },
+          ],
+          coverImg: [
+            { required: true, message: '请上传图片', trigger: 'change' },
+          ],
+          remark: [
+            { required: true, message: '请输入活动备注', trigger: 'blur' },
+          ],
+        },
+      }
+    },
+    async created() {
+      ;(this.form = {
+        showPrice: 1,
+        name: '',
+        coverImg: '',
+        stock: '',
+        getLimit: '',
+        timestamp: '',
+        beginTimestamp: '',
+        endTimestamp: '',
+        isPay: 0,
+        isForever: 0,
+        price: 1,
+        remark: '',
+        status: 1,
+        refundType: 1,
+        script: 0,
+        supplement: 0,
+        couponIdList: [
+          {
+            couponId: '',
+            num: '1',
+            price: '1',
+          },
+        ],
+
+        payMainType: 1,
+        merchantId: '',
+      }),
+        this.loadCouponList()
+      let copyActivityId = this.$route.query.copyActivityId
+
+      if (copyActivityId) {
+        let copyActivity = await activity.getDetail(copyActivityId)
+        let editType = this.$route.query.editType
+        if (editType && editType === '1') {
+          console.log(editType)
+          this.dealUpdateAct(copyActivity)
+        } else {
+          console.log(123)
+          this.dealCopyActivity(copyActivity)
+        }
+      }
+
+      this.geSourceList()
+    },
+
+    methods: {
+      geSourceList() {
+        const data = {
+          page: 1,
+          pageSize: 1000,
+        }
+        getSourceListApi(data)
+          .then((res) => {
+            let result = res.data.data
+            console.log(result)
+            let sourceList = result.list
+            let typeSource = []
+
+            for (let i in sourceList) {
+              typeSource.push({
+                value: sourceList[i]['sourceValue'],
+                label: sourceList[i]['sourceValue'],
+              })
+            }
+            this.typeSource = typeSource
+            console.log(this.typeSource)
+          })
+          .catch((err) => Message.error(err))
+      },
+      uploadQuillImg(file) {
+        let formData = new window.FormData()
+        formData.append('file', file.raw)
+        formData.append('isPublic', 'true')
+        this.quillUpdateImg = true
+        uploadPic(formData)
+          .then((res) => {
+            this.quillUpdateImg = false
+            if (res.data.code != 200) {
+              Message.error(res.data.msg)
+            } else {
+              Message.success('上传成功')
+              this.uploadSuccess(res.data.data.destPath)
+            }
+          })
+          .catch((err) => Message.error(err))
+      },
+
+      // 上传图片成功
+      uploadSuccess(res) {
+        // res为图片服务器返回的数据
+        // 获取富文本组件实例
+        let quill = this.$refs.myQuillEditor.quill
+        // 获取光标所在位置
+        let length = quill.getSelection().index
+        // 插入图片  res.info为服务器返回的图片地址
+        quill.insertEmbed(length, 'image', res)
+        // 调整光标到最后
+        quill.setSelection(length + 1)
+      },
+
+      loadCouponList() {
+        let pageQuery = new CouponPageListVo.CouponPageListVo()
+        let condition = new CouponPageListVo.Condition()
+        condition.state = { value: '2', text: '' }
+
+        pageQuery.condition = condition
+        // 以后优化
+        pageQuery.pageSize = 1000
+        getCouponPageList(pageQuery)
+          .then((res) => {
+            this.couponList = res.data.data.list
+          })
+          .catch((err) => Message.error(err))
+      },
+      resetForm(formName) {
+        this.$refs[formName].resetFields()
+      },
+      resetUpdateForm() {
+        ;(this.form.name = ''),
+          (this.form.coverImg = ''),
+          (this.form.remark = ''),
+          (this.form.buyRemark = '')
+      },
+      saveEditData(formName) {
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            var couponIdList = this.form.couponIdList
+
+            var obj = {}
+            var numIsEmpty = false
+            var mustPrice = false
+            var couponTotalPrice = 0
+            for (var i in couponIdList) {
+              console.log(couponIdList[i].couponId)
+              obj[couponIdList[i].couponId] = couponIdList[i].couponId
+              if (!couponIdList[i].num) {
+                numIsEmpty = true
+              }
+              if (!couponIdList[i].price) {
+                mustPrice = true
+              } else {
+                couponTotalPrice += couponIdList[i].price * 100
+              }
+            }
+            couponTotalPrice = couponTotalPrice / 100
+
+            console.log(couponTotalPrice)
+            console.log(this.form.price)
+            if (numIsEmpty) {
+              this.$message({
+                message: '券的数量必须要填写',
+                type: 'warning',
+              })
+
+              return
+            }
+            if (mustPrice && this.form.isPay == 1) {
+              this.$message({
+                message: '付费活动中券的价格需要填写',
+                type: 'warning',
+              })
+
+              return
+            }
+
+            if (Object.keys(obj).length != couponIdList.length) {
+              this.$message({
+                message: '选择的券不能重复',
+                type: 'warning',
+              })
+              return
+            }
+            if (!this.form.price && this.form.isPay == 1) {
+              this.$message({
+                message: '付费活动需要设置活动金额',
+                type: 'warning',
+              })
+              return
+            }
+            if (this.form.isPay == 1 && this.form.price != couponTotalPrice) {
+              this.$message({
+                message: '券的总价格和活动金额不相等',
+                type: 'warning',
+              })
+
+              return
+            }
+            if (!this.form.merchantId && this.form.isPay == 1) {
+              this.$message({
+                message: '付费活动需要设置默认商户号',
+                type: 'warning',
+              })
+              return
+            }
+            this.saveEditData1()
+          } else {
+            console.log('error submit!!')
+            return false
+          }
+        })
+      },
+      saveEditData1: function () {
+        let coupon = JSON.parse(JSON.stringify(this.form))
+        // copy数据
+        // 格式化时间条件
+        // 把数字解析成时间格式
+
+        coupon.price = (this.form.price * 100).toFixed(0)
+        coupon.showPrice = (this.form.showPrice * 100).toFixed(0)
+        for (var i in coupon.couponIdList) {
+          coupon.couponIdList[i].price = (
+            coupon.couponIdList[i].price * 100
+          ).toFixed(0)
+        }
+        coupon.beginTimestamp = this.form.timestamp[0]
+        coupon.endTimestamp = this.form.timestamp[1]
+        console.log(coupon)
+
+        saveEventInfo(coupon)
+          .then((res) => {
+            if (res.data.code == 200) {
+              Message.success('保存成功')
+              this.closePage()
+            } else {
+              Message.error(res.data.msg)
+            }
+            // this.loadData()
+          })
+          .catch((err) => Message.error(err))
+      },
+      updateData(formName) {
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            this.updateData1()
+          } else {
+            console.log('error submit!!')
+            return false
+          }
+        })
+      },
+      updateData1: function () {
+        let coupon = JSON.parse(JSON.stringify(this.form))
+        let data = {
+          activityId: this.$route.query.copyActivityId,
+          name: coupon.name,
+          coverImg: coupon.coverImg,
+          remark: coupon.remark,
+          buyRemark: coupon.buyRemark,
+          script: coupon.script,
+          supplement: coupon.supplement,
+          beginTimestamp: this.form.timestamp[0],
+          endTimestamp: this.form.timestamp[1],
+        }
+
+        updateEventInfo(data)
+          .then((res) => {
+            if (res.data.code == 200) {
+              Message.success('修改成功')
+              this.closePage()
+            } else {
+              Message.error(res.data.msg)
+            }
+            // this.loadData()
+          })
+          .catch((err) => Message.error(err))
+      },
+      handleChange(file) {
+        let formData = new window.FormData()
+        formData.append('file', file.raw)
+        formData.append('isPublic', 'true')
+        uploadPic(formData)
+          .then((res) => {
+            if (res.data.code != 200) {
+              Message.error(res.data.msg)
+            } else {
+              Message.success('上传成功')
+              this.showCoverImg = res.data.data.destPath
+              this.form.coverImg = res.data.data.url
+            }
+          })
+          .catch((err) => Message.error(err))
+      },
+      removeDomain(item) {
+        var index = this.form.couponIdList.indexOf(item)
+        if (index !== -1) {
+          this.form.couponIdList.splice(index, 1)
+        }
+        this.updateFormPrice()
+      },
+      addDomain() {
+        this.form.couponIdList.push({
+          couponId: '',
+          num: '1',
+          price: '1',
+          key: Date.now(),
+        })
+        this.updateFormPrice()
+      },
+      closePage() {
+        this.$router.go(-1)
+      },
+      updateFormPrice() {
+        let couponIdList = this.form.couponIdList
+        let total = 0
+        for (let i in couponIdList) {
+          let price = couponIdList[i]['price'] ? couponIdList[i]['price'] : 1
+          total += Number(price)
+        }
+        this.form.price = Number(total)
+      },
+
+      //处理修改的数据
+      dealUpdateAct(copyActivity) {
+        console.log(copyActivity)
+        this.showCoverImg = copyActivity.fullCoverImg
+        let date1 = new Date(copyActivity.beginTimestamp)
+        let beginTimestamp = date1.getTime()
+
+        let date2 = new Date(copyActivity.endTimestamp)
+        let endTimestamp = date2.getTime()
+        this.form = {
+          name: copyActivity.name,
+          coverImg: copyActivity.coverImg,
+          remark: copyActivity.remark,
+          buyRemark: copyActivity.buyRemark,
+          script: copyActivity.script || 0,
+          supplement: copyActivity.supplement || 0,
+          timestamp: [beginTimestamp, endTimestamp],
+          beginTimestamp: beginTimestamp,
+          endTimestamp: endTimestamp,
+        }
+      },
+
+      /**
+       * 活动源改变活动类型
+       * @param e
+       */
+      changeFormSource(e) {
+        let _self = this
+        if (e == 'FREE_MINI_APP') {
+          _self.form.isPay = 0
+        }
+      },
+    },
+  }
+</script>
+<style>
+  .active {
+    display: inline-block;
+  }
+  .timeActive {
+    display: block;
+    line-height: 50px;
+  }
+  .pTitle {
+    border-left: 3px solid #1890ff;
+    padding-left: 5px;
+    line-height: 25px;
+    font-size: 15px;
+    font-weight: bold;
+  }
+  .coupon_num {
+    width: 100px;
+    margin-left: 10px;
+    margin-right: 20px;
+  }
+  .coupon_price {
+    width: 100px;
+    margin-left: 10px;
+    margin-right: 20px;
+  }
+  .coupon_name {
+    margin-left: 10px;
+    margin-right: 20px;
+  }
+  .coupon_p {
+    display: flex;
+    flex-flow: row nowrap;
+    justify-content: left;
+    align-items: center;
+  }
+  .ql-editor {
+    min-height: 360px;
+  }
+  .el-upload-list--text {
+    width: 300px;
+  }
+</style>

+ 372 - 0
src/views/application/applicationList.vue

@@ -0,0 +1,372 @@
+<template>
+  <div class="app-container">
+    <div class="filter-container" style="margin-bottom: 20px">
+      应用名称:
+      <el-input
+        v-model="condition.name"
+        clearable
+        placeholder="用户名称"
+        style="width: 200px; margin-right: 20px"
+        class="filter-item"
+      />
+      <el-button
+        class="filter-item"
+        type="primary"
+        icon="el-icon-search"
+        @click="search"
+      >
+        搜索
+      </el-button>
+      <el-button
+        class="filter-item"
+        type="primary"
+        icon="el-icon-refresh-right"
+        @click="resetInput"
+      >
+        重置
+      </el-button>
+
+      <el-button
+        class="filter-item"
+        type="danger"
+        icon="el-icon-circle-plus-outline"
+        @click="add"
+      >
+        新增应用
+      </el-button>
+    </div>
+    <el-table
+      :key="tableKey"
+      v-loading="listLoading"
+      :data="couponEventList"
+      border
+      fit
+      highlight-current-row
+      style="width: 100%"
+    >
+      <el-table-column label="应用ID" align="center" width="150" fixed="left">
+        <template slot-scope="{ row }">
+          <span>{{ row.activityId }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="名称" align="center" fixed="left">
+        <template slot-scope="{ row }">
+          <span>{{ row.name }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="图片" align="center" fixed="left">
+        <template slot-scope="{ row }">
+          <el-avatar
+            class="avatar-style"
+            shape="square"
+            :size="50"
+            :src="row.fullCoverImg"
+          ></el-avatar>
+        </template>
+      </el-table-column>
+      <el-table-column label="备注" align="center" fixed="left">
+        <template slot-scope="{ row }">
+          <span>{{ row.name }}测试</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="url" align="center" fixed="left">
+        <template slot-scope="{ row }">
+          <span>{{ row.name }}url</span>
+        </template>
+      </el-table-column>
+
+      <el-table-column
+        label="操作"
+        align="center"
+        width="300"
+        class-name="small-padding fixed-width"
+      >
+        <template slot-scope="{ row }">
+          <el-button type="success" size="mini" @click="updateDetail(row)">
+            修改
+          </el-button>
+          <el-button type="danger" size="mini" @click="deleteButton(row)">
+            删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      :background="background"
+      :current-page="queryForm.pageNo"
+      :layout="layout"
+      :page-size="queryForm.pageSize"
+      :total="total"
+      @current-change="handleCurrentChange"
+      @size-change="handleSizeChange"
+    ></el-pagination>
+  </div>
+</template>
+
+<script>
+  import {
+    getCouponEventList,
+    changeCouponEventStatus,
+    activityCacheRefresh,
+    getCouponSNInfo,
+    getSourceListApi,
+    editActivityOnlineStatus,
+    sendCouponSn,
+    editActivity,
+    updateScript,
+    executeCript,
+  } from '../../axios/api'
+  import { Message } from 'element-ui'
+  import http from '../../axios/http'
+  import { isPhone } from '@/utils/validate'
+
+  export default {
+    name: 'ApplicationList',
+    components: {},
+    data() {
+      return {
+        tableKey: 0,
+        couponEventListString: '',
+        couponEventList: [],
+        listLoading: true,
+        layout: 'total, sizes, prev, pager, next, jumper',
+        total: 0,
+        dialogFormVisible: false,
+        dialogFormScript: false,
+        condition: {
+          name: null,
+          source: null,
+          activityId: null,
+        },
+        queryForm: {
+          pageNo: 1,
+          pageSize: 20,
+          title: '',
+        },
+        timeRange: [],
+        background: true,
+        form: {
+          weight: 0,
+          addStock: 0,
+          round: 0,
+          supplement: 0,
+          sn: '',
+          couponId: '',
+          beginTimestamp: '',
+          endTimestamp: '',
+          coupon: {
+            title: '',
+          },
+          mobile: '',
+          state: {
+            showText: '',
+          },
+        },
+        typeSource: [],
+        rowData: {},
+      }
+    },
+    async created() {
+      this.loadData()
+      this.geSourceList()
+    },
+    methods: {
+      geSourceList() {
+        const data = {
+          page: 1,
+          pageSize: 1000,
+        }
+        getSourceListApi(data)
+          .then((res) => {
+            let result = res.data.data
+            console.log(result)
+            let sourceList = result.list
+            let typeSource = [
+              {
+                value: null,
+                label: '全部',
+              },
+            ]
+
+            for (let i in sourceList) {
+              typeSource.push({
+                value: sourceList[i]['sourceValue'],
+                label: sourceList[i]['sourceValue'],
+              })
+            }
+            this.typeSource = typeSource
+          })
+          .catch((err) => Message.error(err))
+      },
+      loadData() {
+        for (let key in this.condition) {
+          this.condition[key] = this.condition[key] ? this.condition[key] : null
+        }
+        const data = {
+          nextPage: this.queryForm.pageNo,
+          pageSize: this.queryForm.pageSize,
+          condition: this.condition,
+        }
+        let couponEventList = []
+        if (this.couponEventListString !== '') {
+          couponEventList = this.couponEventListString.split(',')
+          data.couponEventList = couponEventList
+        }
+        getCouponEventList(data)
+          .then((res) => {
+            let result = res.data.data
+            this.couponEventList = result.list
+            this.total = result.count
+            this.listLoading = false
+          })
+          .catch((err) => Message.error(err))
+      },
+      resetData() {
+        this.condition.name = null
+        this.condition.source = null
+      },
+      search: function () {
+        this.loadData()
+      },
+      resetInput: function () {
+        this.resetData()
+      },
+      handleSizeChange(val) {
+        this.queryForm.pageSize = val
+        this.loadData()
+      },
+      handleCurrentChange(val) {
+        this.queryForm.pageNo = val
+        this.loadData()
+      },
+      deleteButton(row) {
+        this.$confirm('此操作将永久删除活动, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning',
+        })
+          .then(() => {
+            this.handleEdit(row)
+          })
+          .catch(() => {
+            // this.$message({
+            //   type: 'info',
+            //   message: '已取消删除',
+            // })
+          })
+      },
+      handleEdit(row) {
+        let data = {
+          activityId: row.activityId,
+        }
+        changeCouponEventStatus(data)
+          .then((res) => {
+            this.loadData()
+            Message.success('删除成功')
+          })
+          .catch((err) => Message.error(err))
+      },
+      //修改活动的上下架的流程
+      editOnLine(row) {
+        let data = {
+          activityId: row.activityId,
+        }
+        this.listLoading = true
+        editActivityOnlineStatus(data)
+          .then((res) => {
+            this.loadData()
+            Message.success('更新成功')
+          })
+          .catch((err) => Message.error(err))
+      },
+      add() {
+        this.$router.push('/application/addApplication')
+      },
+      updateDetail(row) {
+        this.$router.push({
+          path: '/application/addApplication',
+          query: { copyActivityId: row.activityId, editType: '1' },
+        })
+      },
+      formatTime: function (timeStamp) {
+        if (!timeStamp || timeStamp.length === 0) {
+          return ''
+        }
+        let time = new Date(timeStamp)
+        let y = time.getFullYear()
+        let m = time.getMonth() + 1
+        let d = time.getDate()
+        let h = time.getHours()
+        let mm = time.getMinutes()
+        let s = time.getSeconds()
+        return (
+          y +
+          '-' +
+          this.fixed0(m) +
+          '-' +
+          this.fixed0(d) +
+          ' ' +
+          this.fixed0(h) +
+          ':' +
+          this.fixed0(mm) +
+          ':' +
+          this.fixed0(s)
+        )
+      },
+      fixed0: function (m) {
+        return m < 10 ? '0' + m : m
+      },
+      editScript(row) {
+        this.rowData = Object.assign(row)
+        this.dialogFormScript = true
+        this.$nextTick(() => {
+          this.$refs['dataForm'].clearValidate()
+        })
+      },
+      renderHeader(h, { column }) {
+        const paymentContent = h(
+          'div',
+          {
+            slot: 'content',
+          },
+          '0不显示,1-99更多,>99首页'
+        )
+        return h('div', [
+          h('span', column.label),
+          h(
+            'el-tooltip',
+            {
+              props: {
+                placement: 'bottom',
+              },
+            },
+            [
+              column.label != '权重' ? '' : paymentContent,
+              h('i', {
+                class: 'el-icon-warning-outline',
+                style: 'color:orange;margin-left:5px;',
+              }),
+            ]
+          ),
+        ])
+      },
+    },
+  }
+</script>
+<style scoped>
+  .cell {
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    /*width: 200px;*/
+    height: 50px;
+  }
+
+  .el-dropdown-style {
+    margin-bottom: 10px;
+  }
+
+  .avatar-style {
+    background: none !important;
+  }
+</style>

+ 1 - 1
src/views/login/login.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="login-container">
     <div class="login-form">
-      <div class="title">Welcome to Hsay Super System Login Page</div>
+      <div class="title">统一登录平台</div>
       <div class="input-btn-group">
         <span>用户名:</span>
         <input v-model="loginForm.username" class="form-control" type="text" />

+ 255 - 0
src/views/rubik/rubikList.vue

@@ -0,0 +1,255 @@
+<template>
+  <div class="app-container">
+    <div class="table-style">
+      <div
+        v-for="item in couponEventList"
+        :key="item.id"
+        class="system-style"
+        @click="getUrl()"
+      >
+        <el-avatar
+          class="avatar-style"
+          shape="square"
+          :size="50"
+          :src="item.fullCoverImg"
+        ></el-avatar>
+        <div class="text-style">
+          <div class="name-style">{{ item.name }}</div>
+          <div>统一登录平台</div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+  import {
+    getCouponEventList,
+    getSourceListApi,
+    editActivityOnlineStatus,
+    editActivity,
+    updateScript,
+  } from '../../axios/api'
+  import { Message } from 'element-ui'
+
+  export default {
+    name: 'CouponEventList',
+    components: {},
+    data() {
+      return {
+        tableKey: 0,
+        couponEventListString: '',
+        couponEventList: [],
+        listLoading: true,
+        layout: 'total, sizes, prev, pager, next, jumper',
+        total: 0,
+        condition: {
+          name: null,
+          source: null,
+          activityId: null,
+        },
+        queryForm: {
+          pageNo: 1,
+          pageSize: 20,
+          title: '',
+        },
+        timeRange: [],
+        background: true,
+        form: {
+          weight: 0,
+          addStock: 0,
+          round: 0,
+          supplement: 0,
+          sn: '',
+          couponId: '',
+          beginTimestamp: '',
+          endTimestamp: '',
+          coupon: {
+            title: '',
+          },
+          mobile: '',
+          state: {
+            showText: '',
+          },
+        },
+        typeSource: [],
+        rowData: {},
+        dialogFormCouponRound: false,
+      }
+    },
+    async created() {
+      this.loadData()
+      this.geSourceList()
+    },
+    methods: {
+      geSourceList() {
+        const data = {
+          page: 1,
+          pageSize: 1000,
+        }
+        getSourceListApi(data)
+          .then((res) => {
+            let result = res.data.data
+            console.log(result)
+            let sourceList = result.list
+            let typeSource = [
+              {
+                value: null,
+                label: '全部',
+              },
+            ]
+
+            for (let i in sourceList) {
+              typeSource.push({
+                value: sourceList[i]['sourceValue'],
+                label: sourceList[i]['sourceValue'],
+              })
+            }
+            this.typeSource = typeSource
+          })
+          .catch((err) => Message.error(err))
+      },
+      loadData() {
+        for (let key in this.condition) {
+          this.condition[key] = this.condition[key] ? this.condition[key] : null
+        }
+        const data = {
+          nextPage: this.queryForm.pageNo,
+          pageSize: this.queryForm.pageSize,
+          condition: this.condition,
+        }
+        let couponEventList = []
+        if (this.couponEventListString !== '') {
+          couponEventList = this.couponEventListString.split(',')
+          data.couponEventList = couponEventList
+        }
+        getCouponEventList(data)
+          .then((res) => {
+            let result = res.data.data
+            this.couponEventList = result.list
+            this.total = result.count
+            this.listLoading = false
+          })
+          .catch((err) => Message.error(err))
+      },
+      search: function () {
+        this.loadData()
+      },
+      handleSizeChange(val) {
+        this.queryForm.pageSize = val
+        this.loadData()
+      },
+      handleCurrentChange(val) {
+        this.queryForm.pageNo = val
+        this.loadData()
+      },
+      getUrl() {
+        let url = ''
+        url += '?API-TOKEN-V1=' + localStorage.getItem('TOKEN-V1')
+        window.location.href = 'https://coupons-admin-pre.shpr.top/#/index'
+      },
+      editScriptClose(row) {
+        let data = {
+          activityId: row.activityId,
+          script: 0,
+        }
+        this.listLoading = true
+        updateScript(data)
+          .then((res) => {
+            this.loadData()
+            Message.success('脚本关闭成功')
+          })
+          .catch((err) => Message.error(err))
+      },
+      formatTime: function (timeStamp) {
+        if (!timeStamp || timeStamp.length === 0) {
+          return ''
+        }
+        let time = new Date(timeStamp)
+        let y = time.getFullYear()
+        let m = time.getMonth() + 1
+        let d = time.getDate()
+        let h = time.getHours()
+        let mm = time.getMinutes()
+        let s = time.getSeconds()
+        return (
+          y +
+          '-' +
+          this.fixed0(m) +
+          '-' +
+          this.fixed0(d) +
+          ' ' +
+          this.fixed0(h) +
+          ':' +
+          this.fixed0(mm) +
+          ':' +
+          this.fixed0(s)
+        )
+      },
+      fixed0: function (m) {
+        return m < 10 ? '0' + m : m
+      },
+    },
+  }
+</script>
+<style scoped>
+  .cell {
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    /*width: 200px;*/
+    height: 50px;
+  }
+
+  .el-dropdown-style {
+    margin-bottom: 10px;
+  }
+
+  .flex-column {
+    display: flex;
+    flex-flow: column nowrap;
+    align-items: center;
+    justify-content: left;
+  }
+
+  /* 水平方向布局,垂直居中 **/
+  .flex-row {
+    display: flex;
+    flex-flow: row nowrap;
+    align-items: center;
+    justify-content: center;
+  }
+
+  .table-style {
+    width: 100%;
+    display: flex;
+    flex-flow: row wrap;
+    align-items: center;
+    justify-items: center;
+  }
+  .system-style {
+    width: 280px;
+    height: 80px;
+    display: inline-block;
+    border: 2px solid;
+    margin: 10px;
+    border-radius: 10px;
+    display: flex;
+    align-items: center;
+  }
+
+  .avatar-style {
+    background: none !important;
+    display: inline-block;
+    border-radius: 10px;
+    margin-left: 10px;
+  }
+
+  .text-style {
+    margin-left: 10px;
+  }
+
+  .name-style {
+    display: inline-block;
+  }
+</style>

+ 596 - 0
src/views/userInfo/addUserInfo.vue

@@ -0,0 +1,596 @@
+<template>
+  <div class="app-container">
+    <el-form
+      ref="form"
+      :rules="rules"
+      :model="form"
+      label-position="left"
+      label-width="100px"
+    >
+      <el-form-item label="用户名称" class="is-required" prop="name">
+        <el-input
+          v-model="form.name"
+          type="text"
+          :disabled="disable"
+          style="width: 300px"
+        />
+      </el-form-item>
+      <el-form-item label="账号" class="is-required" prop="name">
+        <el-input
+          v-model="form.name"
+          type="text"
+          :disabled="disable"
+          style="width: 300px"
+        />
+      </el-form-item>
+      <el-form-item label="密码" class="is-required" prop="name">
+        <el-input
+          v-model="form.name"
+          type="text"
+          :disabled="disable"
+          style="width: 300px"
+        />
+      </el-form-item>
+
+      <el-form-item label="备注" class="is-required" prop="remark">
+        <el-input
+          v-model="form.remark"
+          type="textarea"
+          :disabled="disable"
+          style="width: 300px"
+          autocomplete="off"
+          maxlength="500"
+          show-word-limit
+        />
+      </el-form-item>
+
+      <el-form-item label="角色" class="is-required" prop="name">
+        <el-input
+          v-model="form.name"
+          type="text"
+          :disabled="disable"
+          style="width: 300px"
+        />
+      </el-form-item>
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <div v-if="$route.query.editType === '1'">
+        <el-button type="primary" :hidden="disable" @click="updateData('form')">
+          保存
+        </el-button>
+        <el-button @click="resetUpdateForm('form')">重置</el-button>
+        <el-button @click="closePage()">关闭</el-button>
+      </div>
+      <div v-else>
+        <el-button
+          type="primary"
+          :hidden="disable"
+          @click="saveEditData('form')"
+        >
+          保存
+        </el-button>
+        <el-button @click="resetForm('form')">重置</el-button>
+        <el-button @click="closePage()">关闭</el-button>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+  import {
+    getCouponList,
+    getCouponPageList,
+    getEventInfo,
+    getSourceListApi,
+    saveEventInfo,
+    updateEventInfo,
+    uploadPic,
+  } from '../../axios/api'
+  import * as CouponPageListVo from '../../axios/vo/coupon-list-vo.js'
+  import { Message } from 'element-ui'
+  import { activity } from '@/api'
+
+  const toolbarOptions = [
+    ['bold', 'italic', 'underline', 'strike'], // toggled buttons
+    ['blockquote', 'code-block'],
+
+    [{ header: 1 }, { header: 2 }], // custom button values
+    [{ list: 'ordered' }, { list: 'bullet' }],
+    [{ script: 'sub' }, { script: 'super' }], // superscript/subscript
+    [{ indent: '-1' }, { indent: '+1' }], // outdent/indent
+    [{ direction: 'rtl' }], // text direction
+
+    [{ size: ['small', false, 'large', 'huge'] }], // custom dropdown
+    [{ header: [1, 2, 3, 4, 5, 6, false] }],
+
+    [{ color: [] }, { background: [] }], // dropdown with defaults from theme
+    [{ font: [] }],
+    [{ align: [] }],
+    ['link', 'image'],
+    ['clean'], // remove formatting button
+  ]
+  export default {
+    name: 'CouponList',
+    components: {},
+    data() {
+      return {
+        editorOption: {
+          placeholder: '',
+          theme: 'snow', // or 'bubble'
+          modules: {
+            toolbar: {
+              container: toolbarOptions, // 工具栏
+              handlers: {
+                image: function (value) {
+                  if (value) {
+                    document.querySelector('#quill-upload input').click()
+                  } else {
+                    this.quill.format('image', false)
+                  }
+                },
+              },
+            },
+          },
+        },
+
+        quillUpdateImg: false, // 根据图片上传状态来确定是否显示loading动画,刚开始是false,不显示
+
+        activityId: null,
+        listLoading: true,
+        dialogFormVisibleChoose: false,
+        disable: false,
+        timestamp: '',
+        useLimitType: 0,
+        costLimitType: 0,
+        showCoverImg: '',
+        couponList: [],
+
+        optionsMerchant: [
+          {
+            merchantId: '1605064954',
+            merchantName: '厐睿',
+          },
+          {
+            merchantId: '1609190004',
+            merchantName: '庞嘉',
+          },
+        ],
+        typeSource: [],
+
+        form: {
+          showPrice: 1,
+          name: '',
+          balanceMchid: '',
+          coverImg: '',
+          stock: '',
+          getLimit: '',
+          timestamp: '',
+          beginTimestamp: '',
+          endTimestamp: '',
+          isPay: 0,
+          isForever: 0,
+          price: 1,
+          remark: '',
+          buyRemark: '',
+          refundType: 1,
+          status: 1,
+          script: 0,
+          supplement: 0,
+          couponIdList: [
+            {
+              couponId: '',
+              num: '1',
+              price: '1',
+            },
+          ],
+
+          payMainType: 1,
+          merchantId: '',
+          source: '',
+        },
+        rules: {
+          name: [
+            { required: true, message: '请输入活动名称', trigger: 'blur' },
+            {
+              min: 1,
+              max: 80,
+              message: '长度在 1 到 80 个字符',
+              trigger: 'blur',
+            },
+          ],
+          remark: [
+            { required: true, message: '请输入活动备注', trigger: 'blur' },
+          ],
+        },
+      }
+    },
+    async created() {
+      ;(this.form = {
+        showPrice: 1,
+        name: '',
+        coverImg: '',
+        stock: '',
+        getLimit: '',
+        timestamp: '',
+        beginTimestamp: '',
+        endTimestamp: '',
+        isPay: 0,
+        isForever: 0,
+        price: 1,
+        remark: '',
+        status: 1,
+        refundType: 1,
+        script: 0,
+        supplement: 0,
+        couponIdList: [
+          {
+            couponId: '',
+            num: '1',
+            price: '1',
+          },
+        ],
+
+        payMainType: 1,
+        merchantId: '',
+      }),
+        this.loadCouponList()
+      let copyActivityId = this.$route.query.copyActivityId
+
+      if (copyActivityId) {
+        let copyActivity = await activity.getDetail(copyActivityId)
+        let editType = this.$route.query.editType
+        if (editType && editType === '1') {
+          console.log(editType)
+          this.dealUpdateAct(copyActivity)
+        } else {
+          console.log(123)
+          this.dealCopyActivity(copyActivity)
+        }
+      }
+
+      this.geSourceList()
+    },
+
+    methods: {
+      geSourceList() {
+        const data = {
+          page: 1,
+          pageSize: 1000,
+        }
+        getSourceListApi(data)
+          .then((res) => {
+            let result = res.data.data
+            console.log(result)
+            let sourceList = result.list
+            let typeSource = []
+
+            for (let i in sourceList) {
+              typeSource.push({
+                value: sourceList[i]['sourceValue'],
+                label: sourceList[i]['sourceValue'],
+              })
+            }
+            this.typeSource = typeSource
+            console.log(this.typeSource)
+          })
+          .catch((err) => Message.error(err))
+      },
+      uploadQuillImg(file) {
+        let formData = new window.FormData()
+        formData.append('file', file.raw)
+        formData.append('isPublic', 'true')
+        this.quillUpdateImg = true
+        uploadPic(formData)
+          .then((res) => {
+            this.quillUpdateImg = false
+            if (res.data.code != 200) {
+              Message.error(res.data.msg)
+            } else {
+              Message.success('上传成功')
+              this.uploadSuccess(res.data.data.destPath)
+            }
+          })
+          .catch((err) => Message.error(err))
+      },
+
+      // 上传图片成功
+      uploadSuccess(res) {
+        // res为图片服务器返回的数据
+        // 获取富文本组件实例
+        let quill = this.$refs.myQuillEditor.quill
+        // 获取光标所在位置
+        let length = quill.getSelection().index
+        // 插入图片  res.info为服务器返回的图片地址
+        quill.insertEmbed(length, 'image', res)
+        // 调整光标到最后
+        quill.setSelection(length + 1)
+      },
+
+      loadCouponList() {
+        let pageQuery = new CouponPageListVo.CouponPageListVo()
+        let condition = new CouponPageListVo.Condition()
+        condition.state = { value: '2', text: '' }
+
+        pageQuery.condition = condition
+        // 以后优化
+        pageQuery.pageSize = 1000
+        getCouponPageList(pageQuery)
+          .then((res) => {
+            this.couponList = res.data.data.list
+          })
+          .catch((err) => Message.error(err))
+      },
+      resetForm(formName) {
+        this.$refs[formName].resetFields()
+      },
+      resetUpdateForm() {
+        ;(this.form.name = ''),
+          (this.form.coverImg = ''),
+          (this.form.remark = ''),
+          (this.form.buyRemark = '')
+      },
+      saveEditData(formName) {
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            var couponIdList = this.form.couponIdList
+
+            var obj = {}
+            var numIsEmpty = false
+            var mustPrice = false
+            var couponTotalPrice = 0
+            for (var i in couponIdList) {
+              console.log(couponIdList[i].couponId)
+              obj[couponIdList[i].couponId] = couponIdList[i].couponId
+              if (!couponIdList[i].num) {
+                numIsEmpty = true
+              }
+              if (!couponIdList[i].price) {
+                mustPrice = true
+              } else {
+                couponTotalPrice += couponIdList[i].price * 100
+              }
+            }
+            couponTotalPrice = couponTotalPrice / 100
+
+            console.log(couponTotalPrice)
+            console.log(this.form.price)
+            if (numIsEmpty) {
+              this.$message({
+                message: '券的数量必须要填写',
+                type: 'warning',
+              })
+
+              return
+            }
+            if (mustPrice && this.form.isPay == 1) {
+              this.$message({
+                message: '付费活动中券的价格需要填写',
+                type: 'warning',
+              })
+
+              return
+            }
+
+            if (Object.keys(obj).length != couponIdList.length) {
+              this.$message({
+                message: '选择的券不能重复',
+                type: 'warning',
+              })
+              return
+            }
+            if (!this.form.price && this.form.isPay == 1) {
+              this.$message({
+                message: '付费活动需要设置活动金额',
+                type: 'warning',
+              })
+              return
+            }
+            if (this.form.isPay == 1 && this.form.price != couponTotalPrice) {
+              this.$message({
+                message: '券的总价格和活动金额不相等',
+                type: 'warning',
+              })
+
+              return
+            }
+            if (!this.form.merchantId && this.form.isPay == 1) {
+              this.$message({
+                message: '付费活动需要设置默认商户号',
+                type: 'warning',
+              })
+              return
+            }
+            this.saveEditData1()
+          } else {
+            console.log('error submit!!')
+            return false
+          }
+        })
+      },
+      saveEditData1: function () {
+        let coupon = JSON.parse(JSON.stringify(this.form))
+        // copy数据
+        // 格式化时间条件
+        // 把数字解析成时间格式
+
+        coupon.price = (this.form.price * 100).toFixed(0)
+        coupon.showPrice = (this.form.showPrice * 100).toFixed(0)
+        for (var i in coupon.couponIdList) {
+          coupon.couponIdList[i].price = (
+            coupon.couponIdList[i].price * 100
+          ).toFixed(0)
+        }
+        coupon.beginTimestamp = this.form.timestamp[0]
+        coupon.endTimestamp = this.form.timestamp[1]
+        console.log(coupon)
+
+        saveEventInfo(coupon)
+          .then((res) => {
+            if (res.data.code == 200) {
+              Message.success('保存成功')
+              this.closePage()
+            } else {
+              Message.error(res.data.msg)
+            }
+            // this.loadData()
+          })
+          .catch((err) => Message.error(err))
+      },
+      updateData(formName) {
+        this.$refs[formName].validate((valid) => {
+          if (valid) {
+            this.updateData1()
+          } else {
+            console.log('error submit!!')
+            return false
+          }
+        })
+      },
+      updateData1: function () {
+        let coupon = JSON.parse(JSON.stringify(this.form))
+        let data = {
+          activityId: this.$route.query.copyActivityId,
+          name: coupon.name,
+          coverImg: coupon.coverImg,
+          remark: coupon.remark,
+          buyRemark: coupon.buyRemark,
+          script: coupon.script,
+          supplement: coupon.supplement,
+          beginTimestamp: this.form.timestamp[0],
+          endTimestamp: this.form.timestamp[1],
+        }
+
+        updateEventInfo(data)
+          .then((res) => {
+            if (res.data.code == 200) {
+              Message.success('修改成功')
+              this.closePage()
+            } else {
+              Message.error(res.data.msg)
+            }
+            // this.loadData()
+          })
+          .catch((err) => Message.error(err))
+      },
+      handleChange(file) {
+        let formData = new window.FormData()
+        formData.append('file', file.raw)
+        formData.append('isPublic', 'true')
+        uploadPic(formData)
+          .then((res) => {
+            if (res.data.code != 200) {
+              Message.error(res.data.msg)
+            } else {
+              Message.success('上传成功')
+              this.showCoverImg = res.data.data.destPath
+              this.form.coverImg = res.data.data.url
+            }
+          })
+          .catch((err) => Message.error(err))
+      },
+      removeDomain(item) {
+        var index = this.form.couponIdList.indexOf(item)
+        if (index !== -1) {
+          this.form.couponIdList.splice(index, 1)
+        }
+        this.updateFormPrice()
+      },
+      addDomain() {
+        this.form.couponIdList.push({
+          couponId: '',
+          num: '1',
+          price: '1',
+          key: Date.now(),
+        })
+        this.updateFormPrice()
+      },
+      closePage() {
+        this.$router.go(-1)
+      },
+      updateFormPrice() {
+        let couponIdList = this.form.couponIdList
+        let total = 0
+        for (let i in couponIdList) {
+          let price = couponIdList[i]['price'] ? couponIdList[i]['price'] : 1
+          total += Number(price)
+        }
+        this.form.price = Number(total)
+      },
+
+      //处理修改的数据
+      dealUpdateAct(copyActivity) {
+        console.log(copyActivity)
+        this.showCoverImg = copyActivity.fullCoverImg
+        let date1 = new Date(copyActivity.beginTimestamp)
+        let beginTimestamp = date1.getTime()
+
+        let date2 = new Date(copyActivity.endTimestamp)
+        let endTimestamp = date2.getTime()
+        this.form = {
+          name: copyActivity.name,
+          coverImg: copyActivity.coverImg,
+          remark: copyActivity.remark,
+          buyRemark: copyActivity.buyRemark,
+          script: copyActivity.script || 0,
+          supplement: copyActivity.supplement || 0,
+          timestamp: [beginTimestamp, endTimestamp],
+          beginTimestamp: beginTimestamp,
+          endTimestamp: endTimestamp,
+        }
+      },
+
+      /**
+       * 活动源改变活动类型
+       * @param e
+       */
+      changeFormSource(e) {
+        let _self = this
+        if (e == 'FREE_MINI_APP') {
+          _self.form.isPay = 0
+        }
+      },
+    },
+  }
+</script>
+<style>
+  .active {
+    display: inline-block;
+  }
+  .timeActive {
+    display: block;
+    line-height: 50px;
+  }
+  .pTitle {
+    border-left: 3px solid #1890ff;
+    padding-left: 5px;
+    line-height: 25px;
+    font-size: 15px;
+    font-weight: bold;
+  }
+  .coupon_num {
+    width: 100px;
+    margin-left: 10px;
+    margin-right: 20px;
+  }
+  .coupon_price {
+    width: 100px;
+    margin-left: 10px;
+    margin-right: 20px;
+  }
+  .coupon_name {
+    margin-left: 10px;
+    margin-right: 20px;
+  }
+  .coupon_p {
+    display: flex;
+    flex-flow: row nowrap;
+    justify-content: left;
+    align-items: center;
+  }
+  .ql-editor {
+    min-height: 360px;
+  }
+  .el-upload-list--text {
+    width: 300px;
+  }
+</style>

+ 674 - 0
src/views/userInfo/userinfoList.vue

@@ -0,0 +1,674 @@
+<template>
+  <div class="app-container">
+    <div class="filter-container" style="margin-bottom: 20px">
+      用户名称:
+      <el-input
+        v-model="condition.name"
+        clearable
+        placeholder="用户名称"
+        style="width: 200px; margin-right: 20px"
+        class="filter-item"
+      />
+      用户角色:
+      <el-input
+        v-model="condition.activityId"
+        clearable
+        placeholder="用户角色"
+        style="width: 200px; margin-right: 20px"
+        class="filter-item"
+      />
+      用户状态:
+      <el-select
+        v-model="condition.source"
+        clearable
+        filterable
+        value-key="value"
+        style="width: 200px; margin-right: 20px"
+        placeholder=""
+        class="filter-item"
+      >
+        <el-option
+          v-for="(item, index) in typeSource"
+          :key="index"
+          :label="item.label"
+          :value="item.value"
+        ></el-option>
+      </el-select>
+      <el-button
+        class="filter-item"
+        type="primary"
+        icon="el-icon-search"
+        @click="search"
+      >
+        搜索
+      </el-button>
+      <el-button
+        class="filter-item"
+        type="primary"
+        icon="el-icon-refresh-right"
+        @click="resetInput"
+      >
+        重置
+      </el-button>
+
+      <el-button
+        class="filter-item"
+        type="danger"
+        icon="el-icon-circle-plus-outline"
+        @click="add"
+      >
+        新增用户
+      </el-button>
+    </div>
+    <el-table
+      :key="tableKey"
+      v-loading="listLoading"
+      :data="couponEventList"
+      border
+      fit
+      highlight-current-row
+      style="width: 100%"
+    >
+      <el-table-column label="用户ID" align="center" width="150" fixed="left">
+        <template slot-scope="{ row }">
+          <span>{{ row.activityId }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="名称" align="center" fixed="left">
+        <template slot-scope="{ row }">
+          <span>{{ row.name }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="账号" align="center" fixed="left">
+        <template slot-scope="{ row }">
+          <span>{{ row.name }}hsay</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="密码" align="center" fixed="left">
+        <template slot-scope="{ row }">
+          <span>{{ row.name }}123456</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="状态" align="center">
+        <template slot-scope="{ row }">
+          {{ row.status.showText }}
+        </template>
+      </el-table-column>
+      <el-table-column label="备注" align="center" fixed="left">
+        <template slot-scope="{ row }">
+          <span>{{ row.name }}测试</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="角色" align="center" fixed="left">
+        <template slot-scope="{ row }">
+          <span>{{ row.name }}用户</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        label="创建时间"
+        align="center"
+        width="100"
+        class-name="small-padding fixed-width"
+      >
+        <template slot-scope="{ row }">
+          <span>{{ row.createdAt }}</span>
+        </template>
+      </el-table-column>
+
+      <el-table-column
+        label="操作"
+        align="center"
+        width="300"
+        class-name="small-padding fixed-width"
+      >
+        <template slot-scope="{ row }">
+          <el-button type="info" size="mini" @click="saveRowDataStock(row)">
+            绑定角色
+          </el-button>
+          <el-button type="primary" size="mini" @click="updateDetail(row)">
+            修改
+          </el-button>
+          <el-button
+            v-if="row.isOnline == 1"
+            type="success"
+            size="mini"
+            @click="editOnLine(row)"
+          >
+            已启用
+          </el-button>
+          <el-button v-else type="danger" size="mini" @click="editOnLine(row)">
+            已禁用
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      :background="background"
+      :current-page="queryForm.pageNo"
+      :layout="layout"
+      :page-size="queryForm.pageSize"
+      :total="total"
+      @current-change="handleCurrentChange"
+      @size-change="handleSizeChange"
+    ></el-pagination>
+    <el-dialog title="活动权重" :visible.sync="dialogFormCoupon" width="20%">
+      <el-form :model="form">
+        <el-form-item label="" label-width="10%">
+          <span>请输入活动权重: 权重大于0展示在首页</span>
+          <el-input
+            v-model="form.weight"
+            autocomplete="off"
+            type="number"
+            placeholder="请输入权重"
+            oninput="value=value.replace(/[^\d]/g,'');if(value.length>5)value=value.slice(0,5)"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogFormCoupon = false">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="
+            dialogFormCoupon = false
+            editWeight(form.weight)
+          "
+        >
+          确 定
+        </el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog
+      title="增加库存"
+      :visible.sync="dialogFormCouponStock"
+      width="20%"
+    >
+      <el-form :model="form">
+        <el-form-item label="" label-width="10%">
+          <span>输入要增加的库存数</span>
+          <el-input
+            v-model="form.addStock"
+            autocomplete="off"
+            type="number"
+            placeholder="请输入要增加的库存数"
+            oninput="value=value.replace(/[^\d]/g,'');if(value.length>9)value=value.slice(0,9)"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogFormCouponStock = false">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="
+            dialogFormCouponStock = false
+            editAddStock(form.addStock)
+          "
+        >
+          确 定
+        </el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog
+      title="设置轮次"
+      :visible.sync="dialogFormCouponRound"
+      width="20%"
+    >
+      <el-form :model="form">
+        <el-form-item label="" label-width="10%">
+          <span>设置轮次</span>
+          <el-input
+            v-model="form.round"
+            autocomplete="off"
+            type="number"
+            placeholder="请输入轮次"
+            oninput="value=value.replace(/[^\d]/g,'');if(value.length>4)value=value.slice(0,4)"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogFormCouponRound = false">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="
+            dialogFormCouponRound = false
+            editRound(form.round)
+          "
+        >
+          确 定
+        </el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog title="补货数量" :visible.sync="dialogFormScript" width="20%">
+      <el-form ref="dataForm" :model="form">
+        <el-form-item label="" label-width="10%">
+          <span>输入补货数量</span>
+          <el-input
+            v-model="form.supplement"
+            autocomplete="off"
+            type="number"
+            placeholder="请输入补货数量"
+            oninput="value=value.replace(/[^\d]/g,'');if(value.length>9)value=value.slice(0,9)"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogFormScript = false">取 消</el-button>
+        <el-button type="primary" @click="editAddScript(form.supplement)">
+          确 定
+        </el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import {
+    getCouponEventList,
+    changeCouponEventStatus,
+    activityCacheRefresh,
+    getCouponSNInfo,
+    getSourceListApi,
+    editActivityOnlineStatus,
+    sendCouponSn,
+    editActivity,
+    updateScript,
+    executeCript,
+  } from '../../axios/api'
+  import { Message } from 'element-ui'
+  import http from '../../axios/http'
+  import { isPhone } from '@/utils/validate'
+
+  export default {
+    name: 'UserinfoList',
+    components: {},
+    data() {
+      return {
+        tableKey: 0,
+        couponEventListString: '',
+        couponEventList: [],
+        listLoading: true,
+        layout: 'total, sizes, prev, pager, next, jumper',
+        total: 0,
+        dialogFormVisible: false,
+        dialogFormCoupon: false,
+        dialogFormCouponStock: false,
+        dialogFormScript: false,
+        condition: {
+          name: null,
+          source: null,
+          activityId: null,
+        },
+        queryForm: {
+          pageNo: 1,
+          pageSize: 20,
+          title: '',
+        },
+        timeRange: [],
+        background: true,
+        form: {
+          weight: 0,
+          addStock: 0,
+          round: 0,
+          supplement: 0,
+          sn: '',
+          couponId: '',
+          beginTimestamp: '',
+          endTimestamp: '',
+          coupon: {
+            title: '',
+          },
+          mobile: '',
+          state: {
+            showText: '',
+          },
+        },
+        typeSource: [],
+        rowData: {},
+        dialogFormCouponRound: false,
+      }
+    },
+    async created() {
+      this.loadData()
+      this.geSourceList()
+    },
+    methods: {
+      geSourceList() {
+        const data = {
+          page: 1,
+          pageSize: 1000,
+        }
+        getSourceListApi(data)
+          .then((res) => {
+            let result = res.data.data
+            console.log(result)
+            let sourceList = result.list
+            let typeSource = [
+              {
+                value: null,
+                label: '全部',
+              },
+            ]
+
+            for (let i in sourceList) {
+              typeSource.push({
+                value: sourceList[i]['sourceValue'],
+                label: sourceList[i]['sourceValue'],
+              })
+            }
+            this.typeSource = typeSource
+          })
+          .catch((err) => Message.error(err))
+      },
+      loadData() {
+        for (let key in this.condition) {
+          this.condition[key] = this.condition[key] ? this.condition[key] : null
+        }
+        const data = {
+          nextPage: this.queryForm.pageNo,
+          pageSize: this.queryForm.pageSize,
+          condition: this.condition,
+        }
+        let couponEventList = []
+        if (this.couponEventListString !== '') {
+          couponEventList = this.couponEventListString.split(',')
+          data.couponEventList = couponEventList
+        }
+        getCouponEventList(data)
+          .then((res) => {
+            let result = res.data.data
+            this.couponEventList = result.list
+            this.total = result.count
+            this.listLoading = false
+          })
+          .catch((err) => Message.error(err))
+      },
+      resetData() {
+        this.condition.name = null
+        this.condition.source = null
+      },
+      search: function () {
+        this.loadData()
+      },
+      resetInput: function () {
+        this.resetData()
+      },
+      handleSizeChange(val) {
+        this.queryForm.pageSize = val
+        this.loadData()
+      },
+      handleCurrentChange(val) {
+        this.queryForm.pageNo = val
+        this.loadData()
+      },
+      appletSet(row) {
+        this.$router.push({
+          path: '/signIn/appletCodeSet',
+          query: { activityId: row.activityId },
+        })
+      },
+      deleteButton(row) {
+        this.$confirm('此操作将永久删除活动, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning',
+        })
+          .then(() => {
+            this.handleEdit(row)
+          })
+          .catch(() => {
+            // this.$message({
+            //   type: 'info',
+            //   message: '已取消删除',
+            // })
+          })
+      },
+      handleEdit(row) {
+        let data = {
+          activityId: row.activityId,
+        }
+        changeCouponEventStatus(data)
+          .then((res) => {
+            this.loadData()
+            Message.success('删除成功')
+          })
+          .catch((err) => Message.error(err))
+      },
+      //修改活动的上下架的流程
+      editOnLine(row) {
+        let data = {
+          activityId: row.activityId,
+        }
+        this.listLoading = true
+        editActivityOnlineStatus(data)
+          .then((res) => {
+            this.loadData()
+            Message.success('更新成功')
+          })
+          .catch((err) => Message.error(err))
+      },
+      add() {
+        this.$router.push('/userInfo/addUserInfo')
+      },
+      updateDetail(row) {
+        this.$router.push({
+          path: '/userInfo/addUserInfo',
+          query: { copyActivityId: row.activityId, editType: '1' },
+        })
+      },
+      refresh(source) {
+        activityCacheRefresh(source)
+          .then((res) => {
+            this.loadData()
+            Message.success('刷新成功')
+          })
+          .catch((err) => Message.error(err))
+      },
+      editWeight(weight) {
+        if (null === weight || weight === '' || weight === undefined) {
+          this.$message({
+            message: '活动权重不能为空',
+            type: 'warning',
+          })
+
+          return
+        }
+        let data = {
+          activityId: this.rowData.activityId,
+          weight: weight,
+        }
+        editActivity(data)
+          .then((res) => {
+            this.loadData()
+            Message.success('活动权重设置成功!')
+          })
+          .catch((err) => Message.error(err))
+      },
+
+      editAddStock(addStock) {
+        if (null === addStock || addStock === '' || addStock === undefined) {
+          this.$message({
+            message: '添加库存不能为空',
+            type: 'warning',
+          })
+
+          return
+        }
+        let data = {
+          activityId: this.rowData.activityId,
+          addStock: addStock,
+        }
+        editActivity(data)
+          .then((res) => {
+            this.loadData()
+            Message.success('添加库存设置成功!')
+          })
+          .catch((err) => Message.error(err))
+      },
+      editRound(round) {
+        if (null === round || round === '' || round === undefined) {
+          this.$message({
+            message: '轮次不能为空',
+            type: 'warning',
+          })
+
+          return
+        }
+        let data = {
+          activityId: this.rowData.activityId,
+          round: round,
+        }
+        editActivity(data)
+          .then((res) => {
+            this.loadData()
+            Message.success('轮次设置成功!')
+          })
+          .catch((err) => Message.error(err))
+      },
+
+      editAddScript(supplement) {
+        if (
+          null === supplement ||
+          supplement === '' ||
+          supplement === undefined
+        ) {
+          this.$message({
+            message: '补货数量不能为空',
+            type: 'warning',
+          })
+
+          return
+        }
+        this.dialogFormScript = false
+        let data = {
+          activityId: this.rowData.activityId,
+          script: 1,
+          supplement: supplement,
+        }
+        updateScript(data)
+          .then((res) => {
+            this.loadData()
+            Message.success('脚本设置成功!')
+          })
+          .catch((err) => Message.error(err))
+      },
+      editScriptClose(row) {
+        let data = {
+          activityId: row.activityId,
+          script: 0,
+        }
+        this.listLoading = true
+        updateScript(data)
+          .then((res) => {
+            this.loadData()
+            Message.success('脚本关闭成功')
+          })
+          .catch((err) => Message.error(err))
+      },
+      // editInfo(row) {
+      //   let data = {
+      //     activityId: row.activityId,
+      //     script: 0,
+      //   }
+      //   this.listLoading = true
+      //   executeCript(data)
+      //     .then((res) => {
+      //       this.loadData()
+      //       Message.success('脚本关闭成功')
+      //     })
+      //     .catch((err) => Message.error(err))
+      // },
+      formatTime: function (timeStamp) {
+        if (!timeStamp || timeStamp.length === 0) {
+          return ''
+        }
+        let time = new Date(timeStamp)
+        let y = time.getFullYear()
+        let m = time.getMonth() + 1
+        let d = time.getDate()
+        let h = time.getHours()
+        let mm = time.getMinutes()
+        let s = time.getSeconds()
+        return (
+          y +
+          '-' +
+          this.fixed0(m) +
+          '-' +
+          this.fixed0(d) +
+          ' ' +
+          this.fixed0(h) +
+          ':' +
+          this.fixed0(mm) +
+          ':' +
+          this.fixed0(s)
+        )
+      },
+      fixed0: function (m) {
+        return m < 10 ? '0' + m : m
+      },
+      saveRowData(row) {
+        this.dialogFormCoupon = true
+        this.form.weight = row.weight
+        this.rowData = row
+      },
+      saveRowDataStock(row) {
+        this.dialogFormCouponStock = true
+
+        this.rowData = row
+      },
+      saveRowDataRound(row) {
+        this.dialogFormCouponRound = true
+        this.form.round = row.round
+        this.rowData = row
+      },
+      editScript(row) {
+        this.rowData = Object.assign(row)
+        this.dialogFormScript = true
+        this.$nextTick(() => {
+          this.$refs['dataForm'].clearValidate()
+        })
+      },
+      renderHeader(h, { column }) {
+        const paymentContent = h(
+          'div',
+          {
+            slot: 'content',
+          },
+          '0不显示,1-99更多,>99首页'
+        )
+        return h('div', [
+          h('span', column.label),
+          h(
+            'el-tooltip',
+            {
+              props: {
+                placement: 'bottom',
+              },
+            },
+            [
+              column.label != '权重' ? '' : paymentContent,
+              h('i', {
+                class: 'el-icon-warning-outline',
+                style: 'color:orange;margin-left:5px;',
+              }),
+            ]
+          ),
+        ])
+      },
+    },
+  }
+</script>
+<style>
+  .cell {
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    /*width: 200px;*/
+    height: 50px;
+  }
+
+  .el-dropdown-style {
+    margin-bottom: 10px;
+  }
+</style>