123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843 |
- <template>
- <div class="subPage">
- <form class="mainForm">
- <!-- <h1 style="font-size:22px;">{{isEdit === 0 ? '新建' : '编辑'}}{{couponInfo.CouponType === 'goods' ? '饮品优惠券' : '课程优惠券'}}</h1> -->
- <ul>
- <li class="flex-h">
- <span>选择案场:<em>*</em></span>
- <div class="flex-item">
- <div style="width:50%">
- <el-select v-model="couponInfo.CaseId" placeholder="请选择" @change="caseChange" :disabled="isEdit">
- <el-option
- v-for="item in cases"
- :key="item.CaseId"
- :label="item.CaseName"
- :value="item.CaseId">
- </el-option>
- </el-select>
- </div>
- </div>
- </li>
- <li class="flex-h">
- <span>券图片:<em>*</em></span>
- <div class="flex-item">
- <div>
- <el-upload
- :disabled="isEdit"
- class="avatar-uploader"
- action='string'
- :http-request="toolClass.upload"
- :show-file-list="false"
- :on-success="handleAvatarSuccess">
- <img v-if="couponInfo.Images[0].CouponImageUrl" :src="couponInfo.Images[0].CouponImageUrl" class="avatar">
- <i v-else class="el-icon-plus avatar-uploader-icon"></i>
- </el-upload>
- </div>
- </div>
- </li>
- <li class="flex-h">
- <span>券名称:<em>*</em></span>
- <div class="flex-item">
- <div style="width:200px;">
- <el-input
- placeholder="请输入"
- v-model="couponInfo.CouponName"
- clearable>
- </el-input>
- </div>
- </div>
- </li>
- <li class="flex-h">
- <span>券类型:<em>*</em></span>
- <div class="flex-item">
- <div style="width:50%">
- <el-select v-model="couponInfo.CouponType" placeholder="请选择" @change="couponTypeChange" :disabled="isEdit">
- <el-option
- v-for="item in TypeList"
- :key="item.id"
- :label="item.value"
- :value="item.id">
- </el-option>
- </el-select>
- </div>
- </div>
- </li>
- <li class="flex-h">
- <span>券价格:<em>*</em></span>
- <div class="flex-item">
- <div style="width:200px;">
- <el-input
- :disabled="isEdit"
- placeholder="请输入"
- v-model="couponInfo.Price"
- clearable>
- </el-input>
- </div>
- </div>
- </li>
- <li class="flex-h">
- <span>总张数:<em>*</em></span>
- <div class="flex-item">
- <div style="width:200px;">
- <el-input
- :disabled="isEdit"
- placeholder="请输入"
- v-model="couponInfo.TotalCount"
- clearable>
- </el-input>
- </div>
- </div>
- </li>
- <li class="flex-h">
- <span>发送类型:<em>*</em></span>
- <div class="flex-item">
- <div>
- <el-radio v-model="couponInfo.SendType" label="channel" :disabled="isEdit">渠道</el-radio>
- <el-radio v-if="couponInfo.CouponType === 'course'" v-model="couponInfo.SendType" label="case" :disabled="isEdit">案场</el-radio>
- <el-radio v-model="couponInfo.SendType" label="system" :disabled="isEdit">系统</el-radio>
- </div>
- </div>
- </li>
- <li class="flex-h" v-if="couponInfo.SendType === 'channel'">
- <span>选择渠道:<em>*</em></span>
- <div class="flex-item">
- <div style="width:50%">
- <el-select v-model="couponInfo.ChannelId" placeholder="请选择" :disabled="isEdit">
- <el-option
- v-for="item in channelList"
- :key="item.ChannelId"
- :label="item.ChannelName"
- :value="item.ChannelId">
- </el-option>
- </el-select>
- </div>
- </div>
- </li>
- <li class="flex-h">
- <span>目标商品:<em>*</em></span>
- <div class="flex-item">
- <div>
- <el-radio v-model="couponInfo.IsAll" label="1" :disabled="isEdit">全部商品</el-radio>
- <el-radio v-model="couponInfo.IsAll" label="0" :disabled="isEdit">指定商品</el-radio>
- </div>
- </div>
- </li>
- <li class="flex-h" v-if="couponInfo.IsAll === '0'">
- <div class="flex-item">
- <div style="border: 1px solid #eee;">
- <el-table
- :data="couponInfo.Targets"
- stripe
- style="width: 100%">
- <el-table-column
- prop="TargetName"
- label="商品">
- </el-table-column>
- <el-table-column
- prop="TargetType"
- label="分类">
- <template slot-scope="scope">
- {{returnGoodsType(scope.row.TargetType)}}
- </template>
- </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="warning"
- @click="deleteGoodsItem(scope.$index, scope.row)" :disabled="isEdit">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align:center;padding:10px 0;">
- <el-button type="success" size="mini" @click="addGoods" :disabled="isEdit">添加商品</el-button>
- </div>
- </div>
- </div>
- </li>
- <li class="flex-h" v-if="couponInfo.CouponType === 'goods'">
- <span>券有效时间:<em>*</em></span>
- <div class="flex-item">
- <div>
- <div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
- <el-radio v-model="postData.TimeType" label="1" :disabled="isEdit">固定时间</el-radio>
- <el-date-picker
- value-format="yyyy-MM-ddT00:00:00+08:00"
- :disabled="isEdit"
- v-model="couponInfo.StartDate"
- :picker-options="pickerOptions"
- type="date"
- placeholder="选择起始日期">
- </el-date-picker>
- <span style="line-height:40px;">至</span>
- <el-date-picker
- value-format="yyyy-MM-ddT23:59:59+08:00"
- :disabled="isEdit"
- v-model="couponInfo.EndDate"
- :picker-options="pickerOptions"
- type="date"
- placeholder="选择截止日期">
- </el-date-picker>
- </div>
- <div class="addLine flex-h" style="align-item:center;">
- <el-radio v-model="postData.TimeType" label="2" :disabled="isEdit">领取后</el-radio>
- <span style="width:100px;">
- <el-input
- :disabled="isEdit"
- placeholder="请输入"
- v-model="couponInfo.ValidDays"
- clearable>
- </el-input>
- </span>
- <span style="line-height:40px;">天</span>
- </div>
- </div>
- </div>
- </li>
- <li class="flex-h" v-if="couponInfo.CouponType === 'course'">
- <span>券有效时间:<em>*</em></span>
- <div class="flex-item">
- <div>
- <el-date-picker
- value-format="yyyy-MM-ddT00:00:00+08:00"
- :disabled="isEdit"
- v-model="couponInfo.StartDate"
- :picker-options="pickerOptions"
- type="date"
- placeholder="选择起始日期">
- </el-date-picker>
- <span style="line-height:40px;">至</span>
- <el-date-picker
- value-format="yyyy-MM-ddT23:59:59+08:00"
- :disabled="isEdit"
- v-model="couponInfo.EndDate"
- :picker-options="pickerOptions"
- type="date"
- placeholder="选择截止日期">
- </el-date-picker>
- </div>
- </div>
- </li>
- <li class="flex-h" v-if="couponInfo.SendType !== 'case' && couponInfo.SendType !== 'system'">
- <span>视频:<em>*</em></span>
- <div class="flex-item">
- <div style="vertical-align: middle;">
- <a style="line-height: 40px;" v-if="videoOff" :href="couponInfo.VideoUrl" target="blank">{{couponInfo.VideoUrl}}</a>
- <el-upload
- class="avatar-uploader"
- action='string'
- :http-request="toolClass.upload"
- :show-file-list="false"
- :on-success="videoSuccess">
- <a style="line-height: 40px;padding: 0 10px;" :disabled="isEdit">{{videoOff ? '更换' : '添加'}}视频</a>
- </el-upload>
- <el-button v-if="videoOff" type="danger" @click="deleteVideo">删除视频</el-button>
- </div>
- </div>
- </li>
- <li class="flex-h">
- <span>分享描述:<em>*</em></span>
- <div class="flex-item">
- <div>
- <el-input
- type="textarea"
- :rows="2"
- placeholder="请输入"
- v-model="couponInfo.Share.CouponShareInfo">
- </el-input>
- </div>
- </div>
- </li>
- <li class="flex-h">
- <span>规则描述:<em>*</em></span>
- <div class="flex-item">
- <div>
- <el-input
- type="textarea"
- :rows="2"
- placeholder="请输入"
- v-model="couponInfo.Share.UseRule">
- </el-input>
- </div>
- </div>
- </li>
- <li class="flex-h">
- <span>使用说明:<em>*</em></span>
- <div class="flex-item">
- <div>
- <el-input
- type="textarea"
- :rows="2"
- placeholder="请输入"
- v-model="couponInfo.Share.UseInstruction">
- </el-input>
- </div>
- </div>
- </li>
- <li style="text-align:center">
- <el-button type="primary" size="mini" @click="submit">保存</el-button>
- <el-button type="danger" size="mini" @click="cancel">取消</el-button>
- </li>
- </ul>
- </form>
- <el-dialog
- title="选择指定商品"
- :visible.sync="centerDialogVisible"
- @close="postData.page=1;total=1"
- width="650px"
- center>
- <div>
- <div v-if="couponInfo.CouponType === 'goods'">
- <el-table
- ref="multipleTable1"
- :data="goodsList"
- tooltip-effect="dark"
- style="width: 100%"
- @selection-change="handleGoodsChange">
- <el-table-column
- type="selection">
- </el-table-column>
- <el-table-column
- prop="GoodsName"
- label="商品名称">
- </el-table-column>
- <el-table-column
- prop="TypeId"
- label="类别">
- </el-table-column>
- <el-table-column
- prop="Price"
- label="价格">
- </el-table-column>
- </el-table>
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page.sync="postData.page"
- :page-size="postData.pagesize"
- layout="prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- <div v-if="couponInfo.CouponType === 'course'">
- <el-table
- ref="multipleTable2"
- :data="courseList"
- tooltip-effect="dark"
- style="width: 100%"
- @selection-change="handleCourseChange">
- <el-table-column
- type="selection">
- </el-table-column>
- <el-table-column
- prop="CourseName"
- label="课程名称">
- </el-table-column>
- <el-table-column
- prop="BeginDate"
- label="开始时间">
- </el-table-column>
- <el-table-column
- prop="EndDate"
- label="结束时间">
- </el-table-column>
- <el-table-column
- prop="LocationName"
- label="类别">
- </el-table-column>
- <el-table-column
- prop="Price"
- label="价格">
- </el-table-column>
- </el-table>
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page.sync="postData.page"
- :page-size="postData.pagesize"
- layout="prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="centerDialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="sureAddItem">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
-
- <script>
- import { mapState, createNamespacedHelpers } from 'vuex'
- const { mapActions: mapCouponActions } = createNamespacedHelpers('coupon')
- const { mapState: mapChannelState, mapActions: mapChannelActions } = createNamespacedHelpers('channel')
- const { mapState: mapGoodsState, mapActions: mapGoodsActions } = createNamespacedHelpers('goods')
- const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
-
- export default {
- name: '',
- data () {
- return {
- courseList: [],
- goodsList: [],
- videoOff: false,
- total: 0,
- centerDialogVisible: false,
- type: this.$route.query.type || '', // goods、course
- isEdit: !!this.$route.query.id,
- ChannelList: [], // 渠道列表
- TypeList: [{ // 类型列表
- value: '商品券',
- id: 'goods'
- }, {
- value: '课程券',
- id: 'course'
- }],
- currentList: [{
- Name: 'ccc',
- Type: 'xxx'
- }], // 指定商品数据
- couponInfo: {
- CaseId: '',
- CouponName: '',
- CouponType: '',
- Price: '',
- TotalCount: '',
- SendType: '',
- IsAll: 1,
- StartDate: '',
- EndDate: '',
- ValidDays: '',
- VideoUrl: '',
- ChannelId: '',
- Images: [{
- CouponImageUrl: ''
- }],
- Share: {
- CouponShareInfo: '',
- UseRule: '',
- UseInstruction: ''
- },
- Targets: []
- },
- postData: {
- page: 1,
- pagesize: 6,
- },
- currentSelectArr: [],
- }
- },
- mounted () {
- this.$nextTick(function () {
- this.GetChannelListList({
- caseid: this.defaultCaseId,
- page: 1,
- pagesize: 10000
- }).then(() => {
- this.GetGoodTypes({ pagesize: 1000, caseid: this.$route.query.caseid }).then(() => {
- if (this.$route.query.id) {
- this.getCouponById({
- id: this.$route.query.id
- }).then((res) => {
- // console.log(JSON.stringify(res))
- if (res.coupon.CaseId !== '') {
- var aRes = res
- this.GetChannelListList({
- caseid: res.coupon.CaseId,
- page: 1,
- pagesize: 10000
- }).then((res) => {
- aRes.coupon.IsAll = String(aRes.coupon.IsAll)
- if (aRes.coupon.VideoUrl !== '') {
- this.videoOff = true
- }
- this.couponInfo = aRes.coupon
- })
- } else {
- res.coupon.IsAll = String(res.coupon.IsAll)
- if (res.coupon.VideoUrl !== '') {
- this.videoOff = true
- }
- this.couponInfo = res.coupon
- }
- })
- }
- })
- })
- })
- },
- computed: {
- ...mapState({
- cases: x => x.app.cases.list,
- defaultCaseId: x => x.app.cases.default
- }),
- ...mapChannelState({
- channelList: x => x.channelList,
- }),
- ...mapGoodsState({
- // goodsList: x => x.goodsList,
- goodsTypes: x => x.goodsTypes.list,
- }),
- ...mapCourseState({
- // courseList: x => x.courseLister,
- }),
- CaseId: {
- get () {
- return this.couponInfo.caseid || this.defaultCaseId
- },
- set (val) {
- this.couponInfo.caseid = val
- }
- },
- pickerOptions () {
- var beginDate = Date.now() - 24 * 60 * 60 * 1000
- return {
- disabledDate (time) {
- return time.getTime() < beginDate
- }
- }
- },
- },
- methods: {
- ...mapGoodsActions([
- 'GetGoodsList',
- 'GetGoodTypes',
- ]),
- ...mapCouponActions([
- 'addCoupon',
- 'getCouponById',
- 'editCoupon',
- ]),
- ...mapChannelActions([
- 'GetChannelListList',
- ]),
- ...mapCourseActions([
- 'getCourseLister',
- ]),
- returnGoodsType (val) {
- for (var n = 0; n < this.goodsTypes.length; n++) {
- if (this.goodsTypes[n].TypeId === val) {
- return this.goodsTypes[n].TypeName
- }
- }
- },
- deleteVideo () { // 删除视频
- this.couponInfo.VideoUrl = ''
- this.videoOff = false
- },
- caseChange () { // 选择案场
- this.couponInfo.ChannelId = ''
- this.GetChannelListList({
- caseid: this.couponInfo.CaseId,
- page: 1,
- pagesize: 10000
- })
- },
- sureAddItem () { // 确定添加指定商品
- var bool = true
- this.couponInfo.Targets = this.couponInfo.Targets || []
- if (this.couponInfo.CouponType === 'goods') {
- for (var n = 0; n < this.currentSelectArr.length; n++) {
- if (this.couponInfo.Targets.length) {
- bool = true
- for (var a = 0; a < this.couponInfo.Targets.length; a++) {
- if (this.currentSelectArr[n].GoodsId === this.couponInfo.Targets[a].TargetId) {
- bool = false
- }
- }
- if (bool) {
- this.couponInfo.Targets.push({
- TargetName: this.currentSelectArr[n].GoodsName,
- TargetId: this.currentSelectArr[n].GoodsId,
- TargetType: this.currentSelectArr[n].TypeId
- })
- }
- } else {
- this.couponInfo.Targets.push({
- TargetName: this.currentSelectArr[n].GoodsName,
- TargetId: this.currentSelectArr[n].GoodsId,
- TargetType: this.currentSelectArr[n].TypeId
- })
- }
- }
- } else if (this.couponInfo.CouponType === 'course') {
- for (var x = 0; x < this.currentSelectArr.length; x++) {
- if (this.couponInfo.Targets.length) {
- bool = true
- for (var y = 0; y < this.couponInfo.Targets.length; y++) {
- if (this.currentSelectArr[x].CourseId === this.couponInfo.Targets[y].TargetId) {
- bool = false
- }
- }
- if (bool) {
- this.couponInfo.Targets.push({
- TargetName: this.currentSelectArr[x].CourseName,
- TargetId: this.currentSelectArr[x].CourseId,
- TargetType: this.currentSelectArr[x].CourseType
- })
- }
- } else {
- this.couponInfo.Targets.push({
- TargetName: this.currentSelectArr[x].CourseName,
- TargetId: this.currentSelectArr[x].CourseId,
- TargetType: this.currentSelectArr[x].CourseType
- })
- }
- }
- }
- this.centerDialogVisible = false
- },
- handleGoodsChange (val) {
- this.currentSelectArr = val
- },
- handleCourseChange (val) {
- this.currentSelectArr = val
- },
- couponTypeChange () {
- this.couponInfo.Targets = []
- },
- addGoods () { // 添加指定商品
- if (this.couponInfo.CouponType === 'goods') {
- this.postData.page = 1
- this.total = 1
- this.GetGoodsList({
- ...this.postData,
- caseid: this.couponInfo.CaseId
- }).then((res) => {
- this.goodsList = []
- for (var n = 0; n < res.list.length; n++) {
- this.goodsList.push({ ...res.list[n], TypeId: this.returnGoodsType(res.list[n].TypeId) })
- }
- this.total = res.pagenum
- this.centerDialogVisible = true
- })
- } else if (this.couponInfo.CouponType === 'course') {
- this.postData.page = 1
- this.total = 1
- this.getCourseLister({
- ...this.postData,
- caseid: this.couponInfo.CaseId
- }).then((res) => {
- this.courseList = []
- for (var n = 0; n < (res.list || []).length; n++) {
- this.courseList.push({ ...res.list[n], BeginDate: this.toolClass.dateFormat(res.list[n].BeginDate), EndDate: this.toolClass.dateFormat(res.list[n].EndDate) })
- }
- this.total = res.pagenum
- this.centerDialogVisible = true
- // console.log(JSON.stringify(this.courseList))
- })
- }
- },
- checkInfo () { // 校验表单信息
- if (this.couponInfo.CaseId === '') {
- this.$message({
- type: 'error',
- message: '案场不能为空'
- })
- return false
- }
- if (this.couponInfo.Images[0].CouponImageUrl === '') {
- this.$message({
- type: 'error',
- message: '券图片不能为空'
- })
- return false
- }
- if (this.couponInfo.CouponName === '') {
- this.$message({
- type: 'error',
- message: '券名称不能为空'
- })
- return false
- }
- if (this.couponInfo.CouponType === '') {
- this.$message({
- type: 'error',
- message: '券类型不能为空'
- })
- return false
- }
- if (this.couponInfo.Price === '') {
- this.$message({
- type: 'error',
- message: '券价格不能为空'
- })
- return false
- }
- if (this.couponInfo.TotalCount === '') {
- this.$message({
- type: 'error',
- message: '总张数不能为空'
- })
- return false
- }
- if (this.couponInfo.SendType === '') {
- this.$message({
- type: 'error',
- message: '发送类型不能为空'
- })
- return false
- }
- if (this.couponInfo.SendType === 'channel' && this.couponInfo.ChannelId === '') {
- this.$message({
- type: 'error',
- message: '渠道不能为空'
- })
- return false
- }
- if (!(this.couponInfo.IsAll - 0) && !this.courseList.length && !this.goodsList.length) {
- this.$message({
- type: 'error',
- message: '目标商品不能为空'
- })
- return false
- }
- if (this.couponInfo.SendType === 'channel' && this.couponInfo.VideoUrl === '') {
- this.$message({
- type: 'error',
- message: '视频不能为空'
- })
- return false
- }
- if (this.couponInfo.Share.CouponShareInfo === '') {
- this.$message({
- type: 'error',
- message: '分享描述不能为空'
- })
- return false
- }
- if (this.couponInfo.Share.UseRule === '') {
- this.$message({
- type: 'error',
- message: '使用规则不能为空'
- })
- return false
- }
- if (this.couponInfo.Share.UseInstruction === '') {
- this.$message({
- type: 'error',
- message: '使用说明不能为空'
- })
- return false
- }
- return true
- },
- submit () { // 保存
- if (this.$route.query.id) {
- if (this.couponInfo.ValidDays) {
- this.couponInfo.StartDate = undefined
- this.couponInfo.EndDate = undefined
- }
- if (!this.checkInfo()) {
- return false
- }
- this.editCoupon({
- ...this.couponInfo,
- IsAll: this.couponInfo.IsAll - 0,
- TotalCount: this.couponInfo.TotalCount - 0,
- ValidDays: this.couponInfo.ValidDays - 0 || 0
- }).then((res) => {
- this.$alert('操作成功', '提示', {
- confirmButtonText: '确定',
- callback: action => {
- this.$router.push({ name: 'couponList' })
- }
- })
- })
- } else {
- if (!this.checkInfo()) {
- return false
- }
- if (this.couponInfo.ValidDays) {
- this.couponInfo.StartDate = undefined
- this.couponInfo.EndDate = undefined
- } else {
- if (this.couponInfo.StartDate === '') {
- this.$message({
- type: 'error',
- message: '开始时间不能为空'
- })
- return false
- }
- if (this.couponInfo.EndDate === '') {
- this.$message({
- type: 'error',
- message: '截止时间不能为空'
- })
- return false
- }
- if (new Date(this.couponInfo.StartDate).getTime() > new Date(this.couponInfo.EndDate).getTime()) {
- this.$message({
- type: 'error',
- message: '开始时间不能大于截止时间'
- })
- return false
- }
- }
- this.addCoupon({
- ...this.couponInfo,
- IsAll: this.couponInfo.IsAll - 0,
- TotalCount: this.couponInfo.TotalCount - 0,
- ValidDays: this.couponInfo.ValidDays - 0 || 0
- }).then((res) => {
- this.$message({
- type: 'success',
- message: '操作成功'
- })
- this.$router.push({ name: 'couponList' })
- })
- }
- },
- cancel () { // 取消
- this.$router.push({ name: 'couponList' })
- },
- deleteGoodsItem (index, row) { // 删除指定商品item
- this.couponInfo.Targets.splice(index, 1)
- },
- handleAvatarSuccess (res, file) {
- this.couponInfo.Images[0].CouponImageUrl = res.result.url
- },
- videoSuccess (res, file) {
- this.videoOff = true
- this.couponInfo.VideoUrl = res.result.url
- },
- handleCurrentChange (val) { // 跳转到分页
- this.postData.page = val
- if (this.couponInfo.CouponType === 'goods') {
- this.GetGoodsList({
- ...this.postData,
- caseid: this.couponInfo.CaseId
- }).then((res) => {
- this.goodsList = []
- for (var n = 0; n < res.list.length; n++) {
- this.goodsList.push({ ...res.list[n], TypeId: this.returnGoodsType(res.list[n].TypeId) })
- }
- this.total = res.pagenum
- })
- } else if (this.couponInfo.CouponType === 'course') {
- this.getCourseLister({
- ...this.postData,
- caseid: this.couponInfo.CaseId
- }).then((res) => {
- this.courseList = []
- for (var n = 0; n < res.list.length; n++) {
- this.courseList.push({ ...res.list[n], BeginDate: this.toolClass.dateFormat(res.list[n].BeginDate), EndDate: this.toolClass.dateFormat(res.list[n].EndDate) })
- }
- this.total = res.pagenum
- })
- }
- }
- }
- }
- </script>
-
- <!-- Add "scoped" attribute to limit CSS to this component only -->
- <style lang="scss" scoped>
- .addLine {
- > * {
- margin-right: 10px;
- }
- }
- .mainForm > ul > li > div > div > button {
- margin-top: 0;
- }
- </style>
|