yuantianjiao преди 6 години
родител
ревизия
25602f1fd7
променени са 3 файла, в които са добавени 838 реда и са изтрити 2 реда
  1. 1
    1
      dist/index.html
  2. 1
    1
      dist/static/js/manifest.3ad1d5771e9b13dbdad2.js.map
  3. 836
    0
      src/pages/system/cardAndCouponManager/couponManager/edit.vue

+ 1
- 1
dist/index.html Целия файл

@@ -1 +1 @@
1
-<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=//at.alicdn.com/t/font_775069_dwqa9wy3lkh.css><title>城的空间后台管理系统</title><link href=./static/css/app.9da93fc0afa1628cf2ccaf4da55cc10e.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.992319e39e0ff64940a3.js></script><script type=text/javascript src=./static/js/app.d18f63f8de3ea0e97eda.js></script></body></html>
1
+<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=//at.alicdn.com/t/font_775069_dwqa9wy3lkh.css><title>城的空间后台管理系统</title><link href=./static/css/app.c72e82dbd56f92c21a5127ed820199b2.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.7e921535e20f729cf046.js></script><script type=text/javascript src=./static/js/app.67bd92433c64967e2329.js></script></body></html>

+ 1
- 1
dist/static/js/manifest.3ad1d5771e9b13dbdad2.js.map Целия файл

@@ -1 +1 @@
1
-{"version":3,"sources":["webpack:///webpack/bootstrap ec401281f26b415a60ed"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA,IAAAA,EAAAC,OAAA,aACAA,OAAA,sBAAAC,EAAAC,EAAAC,GAIA,IADA,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,EAAAC,KACQD,EAAAN,EAAAQ,OAAoBF,IAC5BF,EAAAJ,EAAAM,GACAG,EAAAL,IACAG,EAAAG,KAAAD,EAAAL,GAAA,IAEAK,EAAAL,GAAA,EAEA,IAAAD,KAAAF,EACAU,OAAAC,UAAAC,eAAAC,KAAAb,EAAAE,KACAY,EAAAZ,GAAAF,EAAAE,IAIA,IADAL,KAAAE,EAAAC,EAAAC,GACAK,EAAAC,QACAD,EAAAS,OAAAT,GAEA,GAAAL,EACA,IAAAI,EAAA,EAAYA,EAAAJ,EAAAM,OAA2BF,IACvCD,EAAAY,IAAAC,EAAAhB,EAAAI,IAGA,OAAAD,GAIA,IAAAc,KAGAV,GACAW,EAAA,GAIA,SAAAH,EAAAd,GAGA,GAAAgB,EAAAhB,GACA,OAAAgB,EAAAhB,GAAAkB,QAGA,IAAAC,EAAAH,EAAAhB,IACAG,EAAAH,EACAoB,GAAA,EACAF,YAUA,OANAN,EAAAZ,GAAAW,KAAAQ,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAT,EAGAE,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACAhB,OAAAmB,eAAAT,EAAAM,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMAX,EAAAiB,EAAA,SAAAZ,GACA,IAAAM,EAAAN,KAAAa,WACA,WAA2B,OAAAb,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAO,EAAAC,GAAsD,OAAA1B,OAAAC,UAAAC,eAAAC,KAAAsB,EAAAC,IAGtDpB,EAAAqB,EAAA,KAGArB,EAAAsB,GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.3ad1d5771e9b13dbdad2.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"./\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ec401281f26b415a60ed"],"sourceRoot":""}
1
+{"version":3,"sources":["webpack:///webpack/bootstrap 18bbcc8e6447707fb936"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA,IAAAA,EAAAC,OAAA,aACAA,OAAA,sBAAAC,EAAAC,EAAAC,GAIA,IADA,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,EAAAC,KACQD,EAAAN,EAAAQ,OAAoBF,IAC5BF,EAAAJ,EAAAM,GACAG,EAAAL,IACAG,EAAAG,KAAAD,EAAAL,GAAA,IAEAK,EAAAL,GAAA,EAEA,IAAAD,KAAAF,EACAU,OAAAC,UAAAC,eAAAC,KAAAb,EAAAE,KACAY,EAAAZ,GAAAF,EAAAE,IAIA,IADAL,KAAAE,EAAAC,EAAAC,GACAK,EAAAC,QACAD,EAAAS,OAAAT,GAEA,GAAAL,EACA,IAAAI,EAAA,EAAYA,EAAAJ,EAAAM,OAA2BF,IACvCD,EAAAY,IAAAC,EAAAhB,EAAAI,IAGA,OAAAD,GAIA,IAAAc,KAGAV,GACAW,EAAA,GAIA,SAAAH,EAAAd,GAGA,GAAAgB,EAAAhB,GACA,OAAAgB,EAAAhB,GAAAkB,QAGA,IAAAC,EAAAH,EAAAhB,IACAG,EAAAH,EACAoB,GAAA,EACAF,YAUA,OANAN,EAAAZ,GAAAW,KAAAQ,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAT,EAGAE,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACAhB,OAAAmB,eAAAT,EAAAM,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMAX,EAAAiB,EAAA,SAAAZ,GACA,IAAAM,EAAAN,KAAAa,WACA,WAA2B,OAAAb,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAO,EAAAC,GAAsD,OAAA1B,OAAAC,UAAAC,eAAAC,KAAAsB,EAAAC,IAGtDpB,EAAAqB,EAAA,KAGArB,EAAAsB,GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.3ad1d5771e9b13dbdad2.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"./\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 18bbcc8e6447707fb936"],"sourceRoot":""}

+ 836
- 0
src/pages/system/cardAndCouponManager/couponManager/edit.vue Целия файл

@@ -0,0 +1,836 @@
1
+<template>
2
+  <div class="subPage">
3
+    <form class="mainForm">
4
+      <!-- <h1 style="font-size:22px;">{{isEdit === 0 ? '新建' : '编辑'}}{{couponInfo.CouponType === 'goods' ? '饮品优惠券' : '课程优惠券'}}</h1> -->
5
+      <ul>
6
+        <li class="flex-h">
7
+          <span>选择案场:<em>*</em></span>
8
+          <div class="flex-item">
9
+            <div style="width:50%">
10
+              <el-select v-model="couponInfo.CaseId" placeholder="请选择" @change="caseChange" :disabled="isEdit">
11
+                <el-option
12
+                  v-for="item in cases"
13
+                  :key="item.CaseId"
14
+                  :label="item.CaseName"
15
+                  :value="item.CaseId">
16
+                </el-option>
17
+              </el-select>
18
+            </div>
19
+          </div>
20
+        </li>
21
+        <li class="flex-h">
22
+          <span>券图片:<em>*</em></span>
23
+          <div class="flex-item">
24
+            <div>
25
+              <el-upload
26
+                :disabled="isEdit"
27
+                class="avatar-uploader"
28
+                action='string'
29
+                :http-request="toolClass.upload"
30
+                :show-file-list="false"
31
+                :on-success="handleAvatarSuccess">
32
+                <img v-if="couponInfo.Images[0].CouponImageUrl" :src="couponInfo.Images[0].CouponImageUrl" class="avatar">
33
+                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
34
+              </el-upload>
35
+            </div>
36
+          </div>
37
+        </li>
38
+        <li class="flex-h">
39
+          <span>券名称:<em>*</em></span>
40
+          <div class="flex-item">
41
+            <div style="width:200px;">
42
+              <el-input
43
+                placeholder="请输入"
44
+                v-model="couponInfo.CouponName"
45
+                clearable>
46
+              </el-input>
47
+            </div>
48
+          </div>
49
+        </li>
50
+        <li class="flex-h">
51
+          <span>券类型:<em>*</em></span>
52
+          <div class="flex-item">
53
+            <div style="width:50%">
54
+              <el-select v-model="couponInfo.CouponType" placeholder="请选择" @change="couponTypeChange" :disabled="isEdit">
55
+                <el-option
56
+                  v-for="item in TypeList"
57
+                  :key="item.id"
58
+                  :label="item.value"
59
+                  :value="item.id">
60
+                </el-option>
61
+              </el-select>
62
+            </div>
63
+          </div>
64
+        </li>
65
+        <li class="flex-h">
66
+          <span>券价格:<em>*</em></span>
67
+          <div class="flex-item">
68
+            <div style="width:200px;">
69
+              <el-input
70
+                :disabled="isEdit"
71
+                placeholder="请输入"
72
+                v-model="couponInfo.Price"
73
+                clearable>
74
+              </el-input>
75
+            </div>
76
+          </div>
77
+        </li>
78
+        <li class="flex-h">
79
+          <span>总张数:<em>*</em></span>
80
+          <div class="flex-item">
81
+            <div style="width:200px;">
82
+              <el-input
83
+                :disabled="isEdit"
84
+                placeholder="请输入"
85
+                v-model="couponInfo.TotalCount"
86
+                clearable>
87
+              </el-input>
88
+            </div>
89
+          </div>
90
+        </li>
91
+        <li class="flex-h">
92
+          <span>发送类型:<em>*</em></span>
93
+          <div class="flex-item">
94
+            <div>
95
+              <el-radio v-model="couponInfo.SendType" label="channel" :disabled="isEdit">渠道</el-radio>
96
+              <el-radio v-if="couponInfo.CouponType === 'course'" v-model="couponInfo.SendType" label="case" :disabled="isEdit">案场</el-radio>
97
+              <el-radio v-model="couponInfo.SendType" label="system" :disabled="isEdit">系统</el-radio>
98
+            </div>
99
+          </div>
100
+        </li>
101
+        <li class="flex-h" v-if="couponInfo.SendType === 'channel'">
102
+          <span>选择渠道:<em>*</em></span>
103
+          <div class="flex-item">
104
+            <div style="width:50%">
105
+              <el-select v-model="couponInfo.ChannelId" placeholder="请选择" :disabled="isEdit">
106
+                <el-option
107
+                  v-for="item in channelList"
108
+                  :key="item.ChannelId"
109
+                  :label="item.ChannelName"
110
+                  :value="item.ChannelId">
111
+                </el-option>
112
+              </el-select>
113
+            </div>
114
+          </div>
115
+        </li>
116
+        <li class="flex-h">
117
+          <span>目标商品:<em>*</em></span>
118
+          <div class="flex-item">
119
+            <div>
120
+              <el-radio v-model="couponInfo.IsAll" label="1" :disabled="isEdit">全部商品</el-radio>
121
+              <el-radio v-model="couponInfo.IsAll" label="0" :disabled="isEdit">指定商品</el-radio>
122
+            </div>
123
+          </div>
124
+        </li>
125
+        <li class="flex-h" v-if="couponInfo.IsAll === '0'">
126
+          <div class="flex-item">
127
+            <div style="border: 1px solid #eee;">
128
+              <el-table
129
+                :data="couponInfo.Targets"
130
+                stripe
131
+                style="width: 100%">
132
+                <el-table-column
133
+                  prop="TargetName"
134
+                  label="商品">
135
+                </el-table-column>
136
+                <el-table-column
137
+                  prop="TargetType"
138
+                  label="分类">
139
+                  <template slot-scope="scope">
140
+                    {{returnGoodsType(scope.row.TargetType)}}
141
+                  </template>
142
+                </el-table-column>
143
+                <el-table-column label="操作">
144
+                  <template slot-scope="scope">
145
+                    <el-button
146
+                      size="mini"
147
+                      type="warning"
148
+                      @click="deleteGoodsItem(scope.$index, scope.row)" :disabled="isEdit">删除</el-button>
149
+                  </template>
150
+                </el-table-column>
151
+              </el-table>
152
+              <div style="text-align:center;padding:10px 0;">
153
+                <el-button type="success" size="mini" @click="addGoods" :disabled="isEdit">添加商品</el-button>
154
+              </div>
155
+            </div>
156
+          </div>
157
+        </li>
158
+        <li class="flex-h" v-if="couponInfo.CouponType === 'goods'">
159
+          <span>券有效时间:<em>*</em></span>
160
+          <div class="flex-item">
161
+            <div>
162
+              <div class="addLine flex-h" style="align-item:center;margin-bottom:20px;">
163
+                <el-radio v-model="postData.TimeType" label="1" :disabled="isEdit">固定时间</el-radio>
164
+                <el-date-picker
165
+                  value-format="yyyy-MM-ddT00:00:00Z"
166
+                  :disabled="isEdit"
167
+                  v-model="couponInfo.StartDate"
168
+                  :picker-options="pickerOptions"
169
+                  type="date"
170
+                  placeholder="选择起始日期">
171
+                </el-date-picker>
172
+                <span style="line-height:40px;">至</span>
173
+                <el-date-picker
174
+                  value-format="yyyy-MM-ddT23:59:59Z"
175
+                  :disabled="isEdit"
176
+                  v-model="couponInfo.EndDate"
177
+                  :picker-options="pickerOptions"
178
+                  type="date"
179
+                  placeholder="选择截止日期">
180
+                </el-date-picker>
181
+              </div>
182
+              <div class="addLine flex-h" style="align-item:center;">
183
+                <el-radio v-model="postData.TimeType" label="2" :disabled="isEdit">领取后</el-radio>
184
+                <span style="width:100px;">
185
+                  <el-input
186
+                    :disabled="isEdit"
187
+                    placeholder="请输入"
188
+                    v-model="couponInfo.ValidDays"
189
+                    clearable>
190
+                  </el-input>
191
+                </span>
192
+                <span style="line-height:40px;">天</span>
193
+              </div>
194
+            </div>
195
+          </div>
196
+        </li>
197
+        <li class="flex-h" v-if="couponInfo.CouponType === 'course'">
198
+          <span>券有效时间:<em>*</em></span>
199
+          <div class="flex-item">
200
+            <div>
201
+              <el-date-picker
202
+                value-format="yyyy-MM-ddT00:00:00Z"
203
+                :disabled="isEdit"
204
+                v-model="couponInfo.StartDate"
205
+                :picker-options="pickerOptions"
206
+                type="date"
207
+                placeholder="选择起始日期">
208
+              </el-date-picker>
209
+              <span style="line-height:40px;">至</span>
210
+              <el-date-picker
211
+                value-format="yyyy-MM-ddT23:59:59Z"
212
+                :disabled="isEdit"
213
+                v-model="couponInfo.EndDate"
214
+                :picker-options="pickerOptions"
215
+                type="date"
216
+                placeholder="选择截止日期">
217
+              </el-date-picker>
218
+            </div>
219
+          </div>
220
+        </li>
221
+        <li class="flex-h" v-if="couponInfo.SendType !== 'case' && couponInfo.SendType !== 'system'">
222
+          <span>视频:<em>*</em></span>
223
+          <div class="flex-item">
224
+            <div style="vertical-align: middle;">
225
+              <a style="line-height: 40px;" v-if="videoOff" :href="couponInfo.VideoUrl" target="blank">{{couponInfo.VideoUrl}}</a>
226
+              <el-upload
227
+                :disabled="isEdit"
228
+                class="avatar-uploader"
229
+                action='string'
230
+                :http-request="toolClass.upload"
231
+                :show-file-list="false"
232
+                :on-success="videoSuccess">
233
+                <a style="line-height: 40px;padding: 0 10px;" :disabled="isEdit">{{videoOff ? '更换' : '添加'}}视频</a>
234
+              </el-upload>
235
+              <el-button v-if="videoOff" type="danger" @click="deleteVideo" :disabled="isEdit">删除视频</el-button>
236
+            </div>
237
+          </div>
238
+        </li>
239
+        <li class="flex-h">
240
+          <span>分享描述:<em>*</em></span>
241
+          <div class="flex-item">
242
+            <div>
243
+              <el-input
244
+                type="textarea"
245
+                :rows="2"
246
+                placeholder="请输入"
247
+                v-model="couponInfo.Share.CouponShareInfo">
248
+              </el-input>
249
+            </div>
250
+          </div>
251
+        </li>
252
+        <li class="flex-h">
253
+          <span>规则描述:<em>*</em></span>
254
+          <div class="flex-item">
255
+            <div>
256
+              <el-input
257
+                type="textarea"
258
+                :rows="2"
259
+                placeholder="请输入"
260
+                v-model="couponInfo.Share.UseRule">
261
+              </el-input>
262
+            </div>
263
+          </div>
264
+        </li>
265
+        <li class="flex-h">
266
+          <span>使用说明:<em>*</em></span>
267
+          <div class="flex-item">
268
+            <div>
269
+              <el-input
270
+                type="textarea"
271
+                :rows="2"
272
+                placeholder="请输入"
273
+                v-model="couponInfo.Share.UseInstruction">
274
+              </el-input>
275
+            </div>
276
+          </div>
277
+        </li>
278
+        <li style="text-align:center">
279
+          <el-button type="primary" size="mini" @click="submit">保存</el-button>
280
+          <el-button type="danger" size="mini" @click="cancel">取消</el-button>
281
+        </li>
282
+      </ul>
283
+    </form>
284
+    <el-dialog
285
+      title="选择指定商品"
286
+      :visible.sync="centerDialogVisible"
287
+      width="650px"
288
+      center>
289
+      <div>
290
+        <div v-if="couponInfo.CouponType === 'goods'">
291
+          <el-table
292
+            ref="multipleTable"
293
+            :data="goodsList.list"
294
+            tooltip-effect="dark"
295
+            style="width: 100%"
296
+            @selection-change="handleGoodsChange">
297
+            <el-table-column
298
+              type="selection">
299
+            </el-table-column>
300
+            <el-table-column
301
+              prop="GoodsName"
302
+              label="商品名称">
303
+            </el-table-column>
304
+            <el-table-column
305
+              prop="TypeId"
306
+              label="类别">
307
+              <template slot-scope="scope">
308
+                <span>{{returnGoodsType(scope.row.TypeId)}}</span>
309
+              </template>
310
+            </el-table-column>
311
+            <el-table-column
312
+              prop="Price"
313
+              label="价格">
314
+            </el-table-column>
315
+          </el-table>
316
+          <el-pagination
317
+            @current-change="handleCurrentChange"
318
+            :current-page.sync="postData.page"
319
+            :page-size="postData.pagesize"
320
+            layout="prev, pager, next, jumper"
321
+            :total="total">
322
+          </el-pagination>
323
+        </div>
324
+        <div v-if="couponInfo.CouponType === 'course'">
325
+          <el-table
326
+            ref="multipleTable"
327
+            :data="courseList"
328
+            tooltip-effect="dark"
329
+            style="width: 100%"
330
+            @selection-change="handleCourseChange">
331
+            <el-table-column
332
+              type="selection">
333
+            </el-table-column>
334
+            <el-table-column
335
+              prop="CourseName"
336
+              label="课程名称">
337
+            </el-table-column>
338
+            <el-table-column
339
+              prop="BeginDate"
340
+              label="开始时间">
341
+              <template slot-scope="scope">
342
+                <span>{{toolClass.dateFormat(scope.row.BeginDate, 'yyyy-MM-dd')}}</span>
343
+              </template>
344
+            </el-table-column>
345
+            <el-table-column
346
+              prop="EndDate"
347
+              label="结束时间">
348
+              <template slot-scope="scope">
349
+                <span>{{toolClass.dateFormat(scope.row.EndDate, 'yyyy-MM-dd')}}</span>
350
+              </template>
351
+            </el-table-column>
352
+            <el-table-column
353
+              prop="LocationId"
354
+              label="类别">
355
+            </el-table-column>
356
+            <el-table-column
357
+              prop="Price"
358
+              label="价格">
359
+            </el-table-column>
360
+          </el-table>
361
+          <el-pagination
362
+            @current-change="handleCurrentChange"
363
+            :current-page.sync="postData.page"
364
+            :page-size="postData.pagesize"
365
+            layout="prev, pager, next, jumper"
366
+            :total="total">
367
+          </el-pagination>
368
+        </div>
369
+      </div>
370
+      <span slot="footer" class="dialog-footer">
371
+        <el-button @click="centerDialogVisible = false">取 消</el-button>
372
+        <el-button type="primary" @click="sureAddItem">确 定</el-button>
373
+      </span>
374
+    </el-dialog>
375
+  </div>
376
+</template>
377
+
378
+<script>
379
+import { mapState, createNamespacedHelpers } from 'vuex'
380
+const { mapActions: mapCouponActions } = createNamespacedHelpers('coupon')
381
+const { mapState: mapChannelState, mapActions: mapChannelActions } = createNamespacedHelpers('channel')
382
+const { mapState: mapGoodsState, mapActions: mapGoodsActions } = createNamespacedHelpers('goods')
383
+const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
384
+
385
+export default {
386
+  name: '',
387
+  data () {
388
+    return {
389
+      videoOff: false,
390
+      total: 0,
391
+      centerDialogVisible: false,
392
+      type: this.$route.query.type || '', // goods、course
393
+      isEdit: !!this.$route.query.id,
394
+      ChannelList: [], // 渠道列表
395
+      TypeList: [{ // 类型列表
396
+        value: '商品券',
397
+        id: 'goods'
398
+      }, {
399
+        value: '课程券',
400
+        id: 'course'
401
+      }],
402
+      currentList: [{
403
+        Name: 'ccc',
404
+        Type: 'xxx'
405
+      }], // 指定商品数据
406
+      couponInfo: {
407
+        CaseId: '',
408
+        CouponName: '',
409
+        CouponType: '',
410
+        Price: '',
411
+        TotalCount: '',
412
+        SendType: '',
413
+        IsAll: '',
414
+        StartDate: '',
415
+        EndDate: '',
416
+        ValidDays: '',
417
+        VideoUrl: '',
418
+        ChannelId: '',
419
+        Images: [{
420
+          CouponImageUrl: ''
421
+        }],
422
+        Share: {
423
+          CouponShareInfo: '',
424
+          UseRule: '',
425
+          UseInstruction: ''
426
+        },
427
+        Targets: []
428
+      },
429
+      postData: {
430
+        page: 1,
431
+        pagesize: 6,
432
+      },
433
+      currentSelectArr: [],
434
+    }
435
+  },
436
+  mounted () {
437
+    this.$nextTick(function () {
438
+      this.GetChannelListList({
439
+        caseid: this.defaultCaseId,
440
+        page: 1,
441
+        pagesize: 10000
442
+      }).then(() => {
443
+        this.GetGoodTypes({ pagesize: 1000, caseid: this.$route.query.caseid }).then(() => {
444
+          if (this.$route.query.id) {
445
+            this.getCouponById({
446
+              id: this.$route.query.id
447
+            }).then((res) => {
448
+              // console.log(JSON.stringify(res))
449
+              if (res.coupon.CaseId !== '') {
450
+                var aRes = res
451
+                this.GetChannelListList({
452
+                  caseid: res.coupon.CaseId,
453
+                  page: 1,
454
+                  pagesize: 10000
455
+                }).then((res) => {
456
+                  aRes.coupon.IsAll = String(aRes.coupon.IsAll)
457
+                  if (aRes.coupon.VideoUrl !== '') {
458
+                    this.videoOff = true
459
+                  }
460
+                  this.couponInfo = aRes.coupon
461
+                })
462
+              } else {
463
+                res.coupon.IsAll = String(res.coupon.IsAll)
464
+                if (res.coupon.VideoUrl !== '') {
465
+                  this.videoOff = true
466
+                }
467
+                this.couponInfo = res.coupon
468
+              }
469
+            })
470
+          }
471
+        })
472
+      })
473
+    })
474
+  },
475
+  computed: {
476
+    ...mapState({
477
+      cases: x => x.app.cases.list,
478
+      defaultCaseId: x => x.app.cases.default
479
+    }),
480
+    ...mapChannelState({
481
+      channelList: x => x.channelList,
482
+    }),
483
+    ...mapGoodsState({
484
+      goodsList: x => x.goodsList,
485
+      goodsTypes: x => x.goodsTypes.list,
486
+    }),
487
+    ...mapCourseState({
488
+      courseList: x => x.courseLister,
489
+    }),
490
+    CaseId: {
491
+      get () {
492
+        return this.couponInfo.caseid || this.defaultCaseId
493
+      },
494
+      set (val) {
495
+        this.couponInfo.caseid = val
496
+      }
497
+    },
498
+    pickerOptions () {
499
+      var beginDate = Date.now() - 24 * 60 * 60 * 1000
500
+      return {
501
+        disabledDate (time) {
502
+          return time.getTime() < beginDate
503
+        }
504
+      }
505
+    },
506
+  },
507
+  methods: {
508
+    ...mapGoodsActions([
509
+      'GetGoodsList',
510
+      'GetGoodTypes',
511
+    ]),
512
+    ...mapCouponActions([
513
+      'addCoupon',
514
+      'getCouponById',
515
+      'editCoupon',
516
+    ]),
517
+    ...mapChannelActions([
518
+      'GetChannelListList',
519
+    ]),
520
+    ...mapCourseActions([
521
+      'getCourseLister',
522
+    ]),
523
+    returnGoodsType (val) {
524
+      for (var n = 0; n < this.goodsTypes.length; n++) {
525
+        if (this.goodsTypes[n].TypeId === val) {
526
+          return this.goodsTypes[n].TypeName
527
+        }
528
+      }
529
+    },
530
+    deleteVideo () { // 删除视频
531
+      this.couponInfo.VideoUrl = ''
532
+      this.videoOff = false
533
+    },
534
+    caseChange () { // 选择案场
535
+      this.couponInfo.ChannelId = ''
536
+      this.GetChannelListList({
537
+        caseid: this.couponInfo.CaseId,
538
+        page: 1,
539
+        pagesize: 10000
540
+      })
541
+    },
542
+    sureAddItem () { // 确定添加指定商品
543
+      var bool = true
544
+      this.couponInfo.Targets = this.couponInfo.Targets || []
545
+      if (this.couponInfo.CouponType === 'goods') {
546
+        for (var n = 0; n < this.currentSelectArr.length; n++) {
547
+          if (this.couponInfo.Targets.length) {
548
+            bool = true
549
+            for (var a = 0; a < this.couponInfo.Targets.length; a++) {
550
+              if (this.currentSelectArr[n].GoodsId === this.couponInfo.Targets[a].TargetId) {
551
+                bool = false
552
+              }
553
+            }
554
+            if (bool) {
555
+              this.couponInfo.Targets.push({
556
+                TargetName: this.currentSelectArr[n].GoodsName,
557
+                TargetId: this.currentSelectArr[n].GoodsId,
558
+                TargetType: this.currentSelectArr[n].TypeId
559
+              })
560
+            }
561
+          } else {
562
+            this.couponInfo.Targets.push({
563
+              TargetName: this.currentSelectArr[n].GoodsName,
564
+              TargetId: this.currentSelectArr[n].GoodsId,
565
+              TargetType: this.currentSelectArr[n].TypeId
566
+            })
567
+          }
568
+        }
569
+      } else if (this.couponInfo.CouponType === 'course') {
570
+        for (var x = 0; x < this.currentSelectArr.length; x++) {
571
+          if (this.couponInfo.Targets.length) {
572
+            bool = true
573
+            for (var y = 0; y < this.couponInfo.Targets.length; y++) {
574
+              if (this.currentSelectArr[x].CourseId === this.couponInfo.Targets[y].TargetId) {
575
+                bool = false
576
+              }
577
+            }
578
+            if (bool) {
579
+              this.couponInfo.Targets.push({
580
+                TargetName: this.currentSelectArr[x].CourseName,
581
+                TargetId: this.currentSelectArr[x].CourseId,
582
+                TargetType: this.currentSelectArr[x].CourseType
583
+              })
584
+            }
585
+          } else {
586
+            this.couponInfo.Targets.push({
587
+              TargetName: this.currentSelectArr[x].CourseName,
588
+              TargetId: this.currentSelectArr[x].CourseId,
589
+              TargetType: this.currentSelectArr[x].CourseType
590
+            })
591
+          }
592
+        }
593
+      }
594
+      this.centerDialogVisible = false
595
+    },
596
+    handleGoodsChange (val) {
597
+      this.currentSelectArr = val
598
+    },
599
+    handleCourseChange (val) {
600
+      this.currentSelectArr = val
601
+    },
602
+    couponTypeChange () {
603
+      // if (this.goodsList.length) {
604
+      //   this.goodsList = []
605
+      // }
606
+      // if (this.courseList.length) {
607
+      //   this.courseList = []
608
+      // }
609
+      this.couponInfo.Targets = []
610
+    },
611
+    addGoods () { // 添加指定商品
612
+      if (this.couponInfo.CouponType === 'goods') {
613
+        this.GetGoodsList({
614
+          ...this.postData,
615
+          caseid: this.couponInfo.CaseId
616
+        }).then((res) => {
617
+          this.total = res.pagenum
618
+          this.centerDialogVisible = true
619
+        })
620
+      } else if (this.couponInfo.CouponType === 'course') {
621
+        this.getCourseLister({
622
+          ...this.postData,
623
+          caseid: this.couponInfo.CaseId
624
+        }).then((res) => {
625
+          this.total = res.pagenum
626
+          this.centerDialogVisible = true
627
+          // console.log(JSON.stringify(this.courseList))
628
+        })
629
+      }
630
+    },
631
+    checkInfo () { // 校验表单信息
632
+      if (this.couponInfo.CaseId === '') {
633
+        this.$message({
634
+          type: 'error',
635
+          message: '案场不能为空'
636
+        })
637
+        return false
638
+      }
639
+      if (this.couponInfo.Images[0].CouponImageUrl === '') {
640
+        this.$message({
641
+          type: 'error',
642
+          message: '券图片不能为空'
643
+        })
644
+        return false
645
+      }
646
+      if (this.couponInfo.CouponName === '') {
647
+        this.$message({
648
+          type: 'error',
649
+          message: '券名称不能为空'
650
+        })
651
+        return false
652
+      }
653
+      if (this.couponInfo.CouponType === '') {
654
+        this.$message({
655
+          type: 'error',
656
+          message: '券类型不能为空'
657
+        })
658
+        return false
659
+      }
660
+      if (this.couponInfo.Price === '') {
661
+        this.$message({
662
+          type: 'error',
663
+          message: '券价格不能为空'
664
+        })
665
+        return false
666
+      }
667
+      if (this.couponInfo.TotalCount === '') {
668
+        this.$message({
669
+          type: 'error',
670
+          message: '总张数不能为空'
671
+        })
672
+        return false
673
+      }
674
+      if (this.couponInfo.SendType === '') {
675
+        this.$message({
676
+          type: 'error',
677
+          message: '发送类型不能为空'
678
+        })
679
+        return false
680
+      }
681
+      if (this.couponInfo.SendType === 'channel' && this.couponInfo.ChannelId === '') {
682
+        this.$message({
683
+          type: 'error',
684
+          message: '渠道不能为空'
685
+        })
686
+        return false
687
+      }
688
+      if (this.couponInfo.IsAll === 0 && this.couponInfo.Targets[0].TargetId === '') {
689
+        this.$message({
690
+          type: 'error',
691
+          message: '目标商品不能为空'
692
+        })
693
+        return false
694
+      }
695
+      if (this.couponInfo.SendType === 'channel' && this.couponInfo.VideoUrl === '') {
696
+        this.$message({
697
+          type: 'error',
698
+          message: '视频不能为空'
699
+        })
700
+        return false
701
+      }
702
+      if (this.couponInfo.Share.CouponShareInfo === '') {
703
+        this.$message({
704
+          type: 'error',
705
+          message: '分享描述不能为空'
706
+        })
707
+        return false
708
+      }
709
+      if (this.couponInfo.Share.UseRule === '') {
710
+        this.$message({
711
+          type: 'error',
712
+          message: '使用规则不能为空'
713
+        })
714
+        return false
715
+      }
716
+      if (this.couponInfo.Share.UseInstruction === '') {
717
+        this.$message({
718
+          type: 'error',
719
+          message: '使用说明不能为空'
720
+        })
721
+        return false
722
+      }
723
+      return true
724
+    },
725
+    submit () { // 保存
726
+      if (this.$route.query.id) {
727
+        if (this.couponInfo.ValidDays) {
728
+          this.couponInfo.StartDate = undefined
729
+          this.couponInfo.EndDate = undefined
730
+        }
731
+        if (!this.checkInfo()) {
732
+          return false
733
+        }
734
+        this.editCoupon({
735
+          ...this.couponInfo,
736
+          IsAll: this.couponInfo.IsAll - 0,
737
+          TotalCount: this.couponInfo.TotalCount - 0,
738
+          ValidDays: this.couponInfo.ValidDays - 0 || 0
739
+        }).then((res) => {
740
+          this.$alert('操作成功', '提示', {
741
+            confirmButtonText: '确定',
742
+            callback: action => {
743
+              this.$router.push({ name: 'couponList' })
744
+            }
745
+          })
746
+        })
747
+      } else {
748
+        if (this.couponInfo.ValidDays) {
749
+          this.couponInfo.StartDate = undefined
750
+          this.couponInfo.EndDate = undefined
751
+        } else {
752
+          if (this.couponInfo.StartDate === '') {
753
+            this.$message({
754
+              type: 'error',
755
+              message: '开始时间不能为空'
756
+            })
757
+            return false
758
+          }
759
+          if (this.couponInfo.EndDate === '') {
760
+            this.$message({
761
+              type: 'error',
762
+              message: '截止时间不能为空'
763
+            })
764
+            return false
765
+          }
766
+          if (new Date(this.couponInfo.StartDate).getTime() > new Date(this.couponInfo.EndDate).getTime()) {
767
+            this.$message({
768
+              type: 'error',
769
+              message: '开始时间不能大于截止时间'
770
+            })
771
+            return false
772
+          }
773
+        }
774
+        if (!this.checkInfo()) {
775
+          return false
776
+        }
777
+        this.addCoupon({
778
+          ...this.couponInfo,
779
+          IsAll: this.couponInfo.IsAll - 0,
780
+          TotalCount: this.couponInfo.TotalCount - 0,
781
+          ValidDays: this.couponInfo.ValidDays - 0 || 0
782
+        }).then((res) => {
783
+          this.$message({
784
+            type: 'success',
785
+            message: '操作成功'
786
+          })
787
+          this.$router.push({ name: 'couponList' })
788
+        })
789
+      }
790
+    },
791
+    cancel () { // 取消
792
+      this.$router.push({ name: 'couponList' })
793
+    },
794
+    deleteGoodsItem (index, row) { // 删除指定商品item
795
+      this.couponInfo.Targets.splice(index, 1)
796
+    },
797
+    handleAvatarSuccess (res, file) {
798
+      this.couponInfo.Images[0].CouponImageUrl = res.result.url
799
+    },
800
+    videoSuccess (res, file) {
801
+      this.videoOff = true
802
+      this.couponInfo.VideoUrl = res.result.url
803
+    },
804
+    handleCurrentChange (val) { // 跳转到分页
805
+      this.postData.page = val
806
+      if (this.couponInfo.CouponType === 'goods') {
807
+        this.GetGoodsList({
808
+          ...this.postData,
809
+          caseid: this.couponInfo.CaseId
810
+        }).then((res) => {
811
+          this.total = res.pagenum
812
+        })
813
+      } else if (this.couponInfo.CouponType === 'course') {
814
+        this.getCourseLister({
815
+          ...this.postData,
816
+          caseid: this.couponInfo.CaseId
817
+        }).then((res) => {
818
+          this.total = res.pagenum
819
+        })
820
+      }
821
+    }
822
+  }
823
+}
824
+</script>
825
+
826
+<!-- Add "scoped" attribute to limit CSS to this component only -->
827
+<style lang="scss" scoped>
828
+.addLine {
829
+  > * {
830
+    margin-right: 10px;
831
+  }
832
+}
833
+.mainForm > ul > li > div > div > button {
834
+  margin-top: 0;
835
+}
836
+</style>