Bladeren bron

统一登录平台角色管理

kk.shi 3 jaren geleden
bovenliggende
commit
347202df4b

+ 1 - 1
src/views/nodeInfo/addNodeInfo.vue

@@ -103,7 +103,7 @@
     ['clean'], // remove formatting button
   ]
   export default {
-    name: 'UserInfoList',
+    name: 'NodeInfoList',
     components: {},
     data() {
       return {

+ 5 - 5
src/views/nodeInfo/nodeInfoList.vue

@@ -5,7 +5,7 @@
       <el-input
         v-model="condition.name"
         clearable
-        placeholder="用户名称"
+        placeholder="注解名称"
         style="width: 200px; margin-right: 20px"
         class="filter-item"
       />
@@ -102,6 +102,9 @@
           <el-button type="primary" size="mini" @click="updateDetail(row)">
             修改
           </el-button>
+          <el-button type="danger" size="mini" @click="deleteButton(row)">
+            删除
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -121,16 +124,13 @@
   import {
     getCouponEventList,
     changeCouponEventStatus,
-    activityCacheRefresh,
     getSourceListApi,
     editActivityOnlineStatus,
-    editActivity,
-    updateScript,
   } from '../../axios/api'
   import { Message } from 'element-ui'
 
   export default {
-    name: 'UserInfoList',
+    name: 'NodeInfoList',
     components: {},
     data() {
       return {

+ 615 - 0
src/views/roleInfo/addRoleInfo.vue

@@ -0,0 +1,615 @@
+<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="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-select
+          v-model="form.addStock"
+          clearable
+          filterable
+          value-key="value"
+          style="width: 300px; margin-right: 20px"
+          placeholder=""
+          class="filter-item"
+        >
+          <el-option
+            v-for="(item, index) in typeOption"
+            :key="index"
+            :label="item.label"
+            :value="item.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="绑定的应用" class="is-required" prop="name">
+        <el-select
+          v-model="form.addStock"
+          clearable
+          filterable
+          value-key="value"
+          style="width: 300px; margin-right: 20px"
+          placeholder=""
+          class="filter-item"
+        >
+          <el-option
+            v-for="(item, index) in typeOption"
+            :key="index"
+            :label="item.label"
+            :value="item.value"
+          ></el-option>
+        </el-select>
+      </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 {
+    getCouponPageList,
+    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: 'RoleInfoList',
+    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: [],
+        typeOption: [
+          {
+            value: '1',
+            label: '管理员',
+          },
+          {
+            value: '2',
+            label: '员工',
+          },
+        ],
+        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>

+ 566 - 0
src/views/roleInfo/roleInfoList.vue

@@ -0,0 +1,566 @@
+<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-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-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 }}测试</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 }}应用</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="warning" size="mini" @click="saveRowData(row)">
+            绑定的节点
+          </el-button>
+          <el-button type="info" size="mini" @click="saveRowDataStock(row)">
+            绑定的应用
+          </el-button>
+          <el-button type="primary" size="mini" @click="updateDetail(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%">
+          <el-select
+            v-model="form.weight"
+            clearable
+            filterable
+            value-key="value"
+            style="width: 200px; margin-right: 20px"
+            placeholder=""
+            class="filter-item"
+          >
+            <el-option
+              v-for="(item, index) in typeOption"
+              :key="index"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
+          </el-select>
+        </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%">
+          <el-select
+            v-model="form.addStock"
+            clearable
+            filterable
+            value-key="value"
+            style="width: 200px; margin-right: 20px"
+            placeholder=""
+            class="filter-item"
+          >
+            <el-option
+              v-for="(item, index) in typeOption"
+              :key="index"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
+          </el-select>
+        </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>
+  </div>
+</template>
+
+<script>
+  import {
+    getCouponEventList,
+    changeCouponEventStatus,
+    activityCacheRefresh,
+    getSourceListApi,
+    editActivityOnlineStatus,
+    editActivity,
+    updateScript,
+  } from '../../axios/api'
+  import { Message } from 'element-ui'
+
+  export default {
+    name: 'RoleInfoList',
+    components: {},
+    data() {
+      return {
+        tableKey: 0,
+        couponEventListString: '',
+        couponEventList: [],
+        listLoading: true,
+        layout: 'total, sizes, prev, pager, next, jumper',
+        total: 0,
+        dialogFormVisible: false,
+        dialogFormCoupon: false,
+        dialogFormCouponStock: false,
+        condition: {
+          name: null,
+          source: null,
+          activityId: null,
+        },
+        queryForm: {
+          pageNo: 1,
+          pageSize: 20,
+          title: '',
+        },
+        timeRange: [],
+        background: true,
+        form: {
+          weight: 0,
+          addStock: '2',
+          round: 0,
+          supplement: 0,
+          sn: '',
+          couponId: '',
+          beginTimestamp: '',
+          endTimestamp: '',
+          coupon: {
+            title: '',
+          },
+          mobile: '',
+          state: {
+            showText: '',
+          },
+        },
+        typeSource: [],
+        rowData: {},
+        typeOption: [
+          {
+            value: '1',
+            label: '管理员',
+          },
+          {
+            value: '2',
+            label: '员工',
+          },
+        ],
+      }
+    },
+    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('/roleInfo/addRoleInfo')
+      },
+      updateDetail(row) {
+        this.$router.push({
+          path: '/roleInfo/addRoleInfo',
+          query: { copyActivityId: row.activityId, editType: '1' },
+        })
+      },
+      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))
+      },
+      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
+      },
+      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>

+ 1 - 1
src/views/rubik/rubikList.vue

@@ -225,7 +225,7 @@
     display: flex;
     flex-flow: row wrap;
     align-items: center;
-    justify-items: center;
+    justify-content: center;
   }
   .system-style {
     width: 280px;

+ 1 - 146
src/views/userInfo/userInfoList.vue

@@ -122,7 +122,7 @@
         class-name="small-padding fixed-width"
       >
         <template slot-scope="{ row }">
-          <el-button type="info" size="mini" @click="saveRowDataStock(row)">
+          <el-button type="warning" size="mini" @click="saveRowDataStock(row)">
             绑定角色
           </el-button>
           <el-button type="primary" size="mini" @click="updateDetail(row)">
@@ -151,33 +151,6 @@
       @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"
@@ -216,58 +189,6 @@
         </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>
 
@@ -295,9 +216,7 @@
         layout: 'total, sizes, prev, pager, next, jumper',
         total: 0,
         dialogFormVisible: false,
-        dialogFormCoupon: false,
         dialogFormCouponStock: false,
-        dialogFormScript: false,
         condition: {
           name: null,
           source: null,
@@ -329,7 +248,6 @@
         },
         typeSource: [],
         rowData: {},
-        dialogFormCouponRound: false,
         typeOption: [
           {
             value: '1',
@@ -539,59 +457,6 @@
           })
           .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 ''
@@ -620,21 +485,11 @@
       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