Authored by 黄敬囿

Merge branch 'feature/ufo-v1202' into 'master'

Feature/ufo v1202

merge to master

See merge request !12
1 <template> 1 <template>
2 <div> 2 <div>
3 - <div v-show='templateName === "imageList"'> 3 + <div v-show="templateName === 'imageList'">
4 <label>显示样式:</label> 4 <label>显示样式:</label>
5 - <i-radio-group v-model.sync="type_" >  
6 - <i-radio label='4'>一行四个 5 + <i-radio-group v-model.sync="type_">
  6 + <i-radio label="4">
  7 + 一行四个
7 <!-- <span></span> --> 8 <!-- <span></span> -->
8 </i-radio> 9 </i-radio>
9 - <i-radio label='5'>一行五个 10 + <i-radio label="5">
  11 + 一行五个
10 <!-- <span></span> --> 12 <!-- <span></span> -->
11 </i-radio> 13 </i-radio>
12 </i-radio-group> 14 </i-radio-group>
@@ -19,19 +21,22 @@ @@ -19,19 +21,22 @@
19 21
20 <th valign="middle"> 22 <th valign="middle">
21 <div style="display: inline-block;"> 23 <div style="display: inline-block;">
22 -  
23 <file-upload 24 <file-upload
24 :default-file="i.src | removeImageParams" 25 :default-file="i.src | removeImageParams"
25 :id="index" 26 :id="index"
26 @success="onUploadSuccess" 27 @success="onUploadSuccess"
27 @remove="onUploadRemove" 28 @remove="onUploadRemove"
28 - >  
29 - </file-upload> 29 + ></file-upload>
30 </div> 30 </div>
31 </th> 31 </th>
32 32
33 <th class="banner-item" valign="middle"> 33 <th class="banner-item" valign="middle">
34 - <banner-params v-model="i.url" :type="type" :isSelectAction="isSelectAction"></banner-params> 34 + <banner-params
  35 + ref="addParams"
  36 + v-model="i.url"
  37 + :type="type"
  38 + :isSelectAction="isSelectAction"
  39 + ></banner-params>
35 </th> 40 </th>
36 41
37 <th valign="middle" v-if="!i.hideDeleteButton"> 42 <th valign="middle" v-if="!i.hideDeleteButton">
@@ -49,72 +54,80 @@ @@ -49,72 +54,80 @@
49 </template> 54 </template>
50 55
51 <script> 56 <script>
  57 +import fileUpload from "./drag-file-upload";
  58 +import bannerParams from "./banner-params";
  59 +import util from "@/libs/util";
52 60
53 -import fileUpload from './drag-file-upload';  
54 -import bannerParams from './banner-params';  
55 -import util from '@/libs/util';  
56 -  
57 -import draggable from 'vuedraggable'; 61 +import draggable from "vuedraggable";
58 62
59 export default { 63 export default {
60 - props: ['value', 'hideAddButton', 'hideDeleteButton','type', 'templateName', 'size', 'isSelectAction'], 64 + props: [
  65 + "value",
  66 + "hideAddButton",
  67 + "hideDeleteButton",
  68 + "type",
  69 + "templateName",
  70 + "size",
  71 + "isSelectAction"
  72 + ],
61 filters: { 73 filters: {
62 removeImageParams(url) { 74 removeImageParams(url) {
63 if (!url) { 75 if (!url) {
64 return; 76 return;
65 } 77 }
66 78
67 - return url.split('?')[0]; 79 + return url.split("?")[0];
68 } 80 }
69 }, 81 },
70 data() { 82 data() {
71 // console.log('====='+this.isSelectAction+"////==="+this.type); 83 // console.log('====='+this.isSelectAction+"////==="+this.type);
72 return { 84 return {
73 - type_: this.size || '0', 85 + type_: this.size || "0",
74 value_: this.handleData(util.clone(this.value)), 86 value_: this.handleData(util.clone(this.value)),
75 - itemStyle: '', 87 + itemStyle: ""
76 }; 88 };
77 }, 89 },
78 methods: { 90 methods: {
79 onDeleteBtnClick(i, index) { 91 onDeleteBtnClick(i, index) {
80 this.value_.splice(index, 1); 92 this.value_.splice(index, 1);
81 - this.$emit('input', this.handleSaveData(this.value_)); 93 + this.$emit("input", this.handleSaveData(this.value_));
82 }, 94 },
83 onAddBtnClick() { 95 onAddBtnClick() {
84 - let actionValue = 'go.h5';  
85 - let urlStr = '';  
86 - if(this.templateName === 'tabFloor') {  
87 - actionValue = 'go.channel'  
88 - }else if(this.templateName === 'guessLike'){  
89 - actionValue = 'go.pool',  
90 - urlStr = 'https://m.yohobuy.com/?pagename=productList' 96 + let actionValue = "go.h5";
  97 + let urlStr = "";
  98 + if (this.templateName === "tabFloor") {
  99 + actionValue = "go.channel";
  100 + } else if (this.templateName === "guessLike") {
  101 + (actionValue = "go.pool"),
  102 + (urlStr = "https://m.yohobuy.com/?pagename=productList");
91 } 103 }
92 104
93 this.value_.push({ 105 this.value_.push({
94 - alt: '',  
95 - bgColor: '',  
96 - imgId: '0',  
97 - isFocusRec:'0',  
98 - src: '',  
99 - title: '', 106 + alt: "",
  107 + bgColor: "",
  108 + imgId: "0",
  109 + isFocusRec: "0",
  110 + src: "",
  111 + title: "",
  112 + business: "new",
100 hideDeleteButton: false, 113 hideDeleteButton: false,
101 url: { 114 url: {
102 action: actionValue, 115 action: actionValue,
103 url: urlStr, 116 url: urlStr,
104 - islogin: 'Y', 117 + islogin: "Y",
105 headerid: 1 118 headerid: 1
106 } 119 }
107 }); 120 });
108 121
109 - this.$emit('input', this.handleSaveData(this.value_)); 122 + this.$emit("input", this.handleSaveData(this.value_));
110 }, 123 },
111 - onUploadSuccess(id, {url}) {  
112 - this.value_[id].src = url + '?imageView2/{mode}/w/{width}/h/{height}';  
113 - this.$emit('input', this.handleSaveData(this.value_)); 124 + onUploadSuccess(id, { url }) {
  125 + this.value_[id].src = url + "?imageView2/{mode}/w/{width}/h/{height}";
  126 + this.$emit("input", this.handleSaveData(this.value_));
114 }, 127 },
115 onUploadRemove(id) { 128 onUploadRemove(id) {
116 - this.value_[id].src = '';  
117 - this.$emit('input', this.handleSaveData(this.value_)); 129 + this.value_[id].src = "";
  130 + this.$emit("input", this.handleSaveData(this.value_));
118 }, 131 },
119 handleData(m) { 132 handleData(m) {
120 // console.log('===handleData===') 133 // console.log('===handleData===')
@@ -123,7 +136,7 @@ export default { @@ -123,7 +136,7 @@ export default {
123 // console.log(this.type_); 136 // console.log(this.type_);
124 let keys = Object.keys(m); 137 let keys = Object.keys(m);
125 138
126 - keys.sort((a,b) => { 139 + keys.sort((a, b) => {
127 a = +a; 140 a = +a;
128 b = +b; 141 b = +b;
129 142
@@ -138,43 +151,57 @@ export default { @@ -138,43 +151,57 @@ export default {
138 return 0; 151 return 0;
139 }); 152 });
140 153
141 -  
142 -  
143 let result = []; 154 let result = [];
144 155
145 for (const i of keys) { 156 for (const i of keys) {
146 let a = m[i]; 157 let a = m[i];
147 - if(!a.url){  
148 - let action = 'go.h5'; 158 + if (!a.url) {
  159 + let action = "go.h5";
149 let url = "https://m.yohobuy.com/"; 160 let url = "https://m.yohobuy.com/";
150 - if(this.templateName === 'tabFloor'){  
151 - action = 'go.channel';  
152 - url = "https://m.yohobuy.com/?pagename=home&tabName="+a.tabName+"&channelCode="+a.code+"&channelCode="+a.productPool;  
153 - }else if(this.templateName === 'guessLike'){  
154 - action = 'go.pool'; 161 + if (this.templateName === "tabFloor") {
  162 + action = "go.channel";
  163 + url =
  164 + "https://m.yohobuy.com/?pagename=home&tabName=" +
  165 + a.tabName +
  166 + "&channelCode=" +
  167 + a.code +
  168 + "&channelCode=" +
  169 + a.productPool;
  170 + } else if (this.templateName === "guessLike") {
  171 + action = "go.pool";
155 url = "https://m.yohobuy.com/?pagename=productList"; 172 url = "https://m.yohobuy.com/?pagename=productList";
156 } 173 }
157 a.url = { 174 a.url = {
158 - action ,  
159 - url,  
160 -  
161 - } 175 + action,
  176 + url
  177 + };
162 } 178 }
  179 +
163 this.addId(a); 180 this.addId(a);
164 181
165 - if (a.url && a.url.action && a.url.action === 'go.ufo') {  
166 - if (util.getUrlQueryString(a.url.url, 'pagename') === 'productDetail') {  
167 - a.url.action = 'go.detail';  
168 - } else if (util.getUrlQueryString(a.url.url, 'pagename') === 'productList') {  
169 - a.url.action = 'go.pool';  
170 - } else if(util.getUrlQueryString(a.url.url, 'pagename') === 'saleCalendar') {  
171 - a.url.action = 'go.calendar';  
172 - } else if(util.getUrlQueryString(a.url.url, 'pagename') === 'hotSale') {  
173 - a.url.action = 'go.hotlist';  
174 - } else if (util.getUrlQueryString(a.url.url, 'pagename') === 'productListNew') {  
175 - a.url.action = 'go.list'; 182 + if (a.url && a.url.action && a.url.action === "go.ufo") {
  183 + if (
  184 + util.getUrlQueryString(a.url.url, "pagename") === "productDetail"
  185 + ) {
  186 + a.url.action = "go.detail";
  187 + } else if (
  188 + util.getUrlQueryString(a.url.url, "pagename") === "productList"
  189 + ) {
  190 + a.url.action = "go.pool";
  191 + } else if (
  192 + util.getUrlQueryString(a.url.url, "pagename") === "saleCalendar"
  193 + ) {
  194 + a.url.action = "go.calendar";
  195 + } else if (
  196 + util.getUrlQueryString(a.url.url, "pagename") === "hotSale"
  197 + ) {
  198 + a.url.action = "go.hotlist";
  199 + } else if (
  200 + util.getUrlQueryString(a.url.url, "pagename") === "productListNew"
  201 + ) {
  202 + a.url.action = "go.list";
176 } else { 203 } else {
177 - a.url.action = 'go.list'; 204 + a.url.action = "go.list";
178 } 205 }
179 } 206 }
180 // console.log('a') 207 // console.log('a')
@@ -188,28 +215,44 @@ export default { @@ -188,28 +215,44 @@ export default {
188 let temp = util.clone(m); 215 let temp = util.clone(m);
189 216
190 for (const i of Object.keys(temp)) { 217 for (const i of Object.keys(temp)) {
191 - if (['go.pool', 'go.detail', 'go.list', 'go.calendar', 'go.hotlist', 'go.identifyList'].includes(temp[i].url.action)) {  
192 - temp[i].url.action = 'go.ufo'; 218 + if (
  219 + [
  220 + "go.pool",
  221 + "go.detail",
  222 + "go.list",
  223 + "go.calendar",
  224 + "go.hotlist",
  225 + "go.identifyList"
  226 + ].includes(temp[i].url.action)
  227 + ) {
  228 + temp[i].url.action = "go.ufo";
193 } 229 }
194 230
195 - if (util.getUrlQueryString(temp[i].url.url, 'headerid') === '-1') {  
196 - temp[i].url.headerid = '-1'; 231 + if (util.getUrlQueryString(temp[i].url.url, "headerid") === "-1") {
  232 + temp[i].url.headerid = "-1";
197 } 233 }
198 234
199 - if (util.getUrlQueryString(temp[i].url.url, 'islogin') === 'Y') {  
200 - temp[i].url.islogin = 'Y' 235 + if (util.getUrlQueryString(temp[i].url.url, "islogin") === "Y") {
  236 + temp[i].url.islogin = "Y";
201 } 237 }
202 - if (temp[i].url.action === 'go.channel') {  
203 - temp[i].tabName = util.getUrlQueryString(temp[i].url.url, 'tabName')  
204 - temp[i].code = util.getUrlQueryString(temp[i].url.url, 'channelCode')  
205 - temp[i].productPool = util.getUrlQueryString(temp[i].url.url, 'productPool') 238 + if (temp[i].url.action === "go.channel") {
  239 + temp[i].tabName = util.getUrlQueryString(temp[i].url.url, "tabName");
  240 + temp[i].code = util.getUrlQueryString(temp[i].url.url, "channelCode");
  241 + temp[i].productPool = util.getUrlQueryString(
  242 + temp[i].url.url,
  243 + "productPool"
  244 + );
  245 + temp[i].business = util.getUrlQueryString(
  246 + temp[i].url.url,
  247 + "business"
  248 + );
206 } else { 249 } else {
207 - temp[i].title = util.getUrlQueryString(temp[i].url.url, 'title')  
208 - temp[i].alt = util.getUrlQueryString(temp[i].url.url, 'title') 250 + temp[i].title = util.getUrlQueryString(temp[i].url.url, "title");
  251 + temp[i].alt = util.getUrlQueryString(temp[i].url.url, "title");
209 } 252 }
210 } 253 }
211 // array to object 254 // array to object
212 - const result = {} 255 + const result = {};
213 256
214 for (const i of Object.keys(temp)) { 257 for (const i of Object.keys(temp)) {
215 result[i] = temp[i]; 258 result[i] = temp[i];
@@ -217,11 +260,11 @@ export default { @@ -217,11 +260,11 @@ export default {
217 260
218 return result; 261 return result;
219 }, 262 },
220 - getValue(){ 263 + getValue() {
221 return this.handleSaveData(this.value_); 264 return this.handleSaveData(this.value_);
222 }, 265 },
223 - getType(){  
224 - return this.type_ || '0'; 266 + getType() {
  267 + return this.type_ || "0";
225 }, 268 },
226 addId(m) { 269 addId(m) {
227 m.id = this.$bus.genId(); 270 m.id = this.$bus.genId();
@@ -230,19 +273,17 @@ export default { @@ -230,19 +273,17 @@ export default {
230 this.value_ = this.handleData(util.clone(newVal)); 273 this.value_ = this.handleData(util.clone(newVal));
231 }, 274 },
232 reSetType() { 275 reSetType() {
233 - this.type_ = '0'; 276 + this.type_ = "0";
234 }, 277 },
235 reset() { 278 reset() {
236 this.value_ = []; 279 this.value_ = [];
237 } 280 }
238 -  
239 }, 281 },
240 watch: { 282 watch: {
241 -  
242 value(newVal) { 283 value(newVal) {
243 - // console.log('watch===newVal'+this.isSelectAction)  
244 - // console.log(newVal)  
245 - this.type_ = this.size || '0'; 284 + // console.log("watch===newVal" + this.isSelectAction);
  285 + // console.log(newVal);
  286 + this.type_ = this.size || "0";
246 this.value_ = this.handleData(util.clone(newVal)); 287 this.value_ = this.handleData(util.clone(newVal));
247 } 288 }
248 }, 289 },
@@ -256,7 +297,6 @@ export default { @@ -256,7 +297,6 @@ export default {
256 297
257 298
258 <style lang="scss" scoped> 299 <style lang="scss" scoped>
259 -  
260 .banner-table { 300 .banner-table {
261 width: 100%; 301 width: 100%;
262 border-collapse: collapse; 302 border-collapse: collapse;
@@ -281,6 +321,5 @@ tr:hover { @@ -281,6 +321,5 @@ tr:hover {
281 padding: 20px; 321 padding: 20px;
282 min-width: 320px; 322 min-width: 320px;
283 } 323 }
284 -  
285 </style> 324 </style>
286 325
@@ -2,6 +2,15 @@ @@ -2,6 +2,15 @@
2 <div> 2 <div>
3 <Form> 3 <Form>
4 <FormItem> 4 <FormItem>
  5 + <div>
  6 + <label>业务线:</label>
  7 + <i-radio-group v-model.sync="lob_">
  8 + <i-radio label="new">新品</i-radio>
  9 + <i-radio label="used">二手</i-radio>
  10 + </i-radio-group>
  11 + </div>
  12 + </FormItem>
  13 + <FormItem>
5 <Select v-model="action_" :disabled="isSelectAction"> 14 <Select v-model="action_" :disabled="isSelectAction">
6 <Option v-for="item in actionList" :value="item.value" :label="item.label"></Option> 15 <Option v-for="item in actionList" :value="item.value" :label="item.label"></Option>
7 </Select> 16 </Select>
@@ -14,107 +23,117 @@ @@ -14,107 +23,117 @@
14 <list-url v-else-if="action_ === 'go.list'" v-model="url_"></list-url> 23 <list-url v-else-if="action_ === 'go.list'" v-model="url_"></list-url>
15 <calendar-url v-else-if="action_ === 'go.calendar'" v-model="url_"></calendar-url> 24 <calendar-url v-else-if="action_ === 'go.calendar'" v-model="url_"></calendar-url>
16 <hotlist-url v-else-if="action_ === 'go.hotlist'" v-model="url_"></hotlist-url> 25 <hotlist-url v-else-if="action_ === 'go.hotlist'" v-model="url_"></hotlist-url>
17 - <tab-url v-else-if="action_ === 'go.channel'" v-model="url_" ></tab-url> 26 + <tab-url v-else-if="action_ === 'go.channel'" v-model="url_"></tab-url>
18 </FormItem> 27 </FormItem>
19 </Form> 28 </Form>
20 </div> 29 </div>
21 </template> 30 </template>
22 31
23 <script> 32 <script>
  33 +import h5 from "./banner-h5";
  34 +import pool from "./banner-pool";
  35 +import detail from "./banner-detail";
  36 +import list from "./banner-list";
  37 +import calendar from "./banner-calendar";
  38 +import tab from "./tab-editor-new";
  39 +import hotlist from "./banner-hotlist";
  40 +import util from "@/libs/util";
24 41
25 - import h5 from './banner-h5';  
26 - import pool from './banner-pool';  
27 - import detail from './banner-detail';  
28 - import list from './banner-list';  
29 - import calendar from './banner-calendar';  
30 - import tab from './tab-editor-new';  
31 - import hotlist from './banner-hotlist';  
32 - import util from '@/libs/util';  
33 -  
34 - export default {  
35 - props: ['value','type', 'isSelectAction'], 42 +export default {
  43 + props: ["value", "type", "isSelectAction"],
36 44
37 data() { 45 data() {
38 - // console.log('this.value')  
39 - // console.log(this.value) 46 + // console.log("this.value");
  47 + // console.log(this.value);
40 return { 48 return {
41 - url_: this.value.url? this.value.url : '',  
42 - action_: this.value.action ? this.value.action : 'go.h5', 49 + url_: this.value.url ? this.value.url : "",
  50 + action_: this.value.action ? this.value.action : "go.h5",
43 islogin: this.value.islogin, 51 islogin: this.value.islogin,
44 headerid: this.value.headerid, 52 headerid: this.value.headerid,
45 actionList: this.initAction(), 53 actionList: this.initAction(),
  54 + lob_: this.getLob() || "new"
46 }; 55 };
47 }, 56 },
48 methods: { 57 methods: {
49 initAction() { 58 initAction() {
50 let action = []; 59 let action = [];
51 - if(this.type === 'H5'){ 60 + if (this.type === "H5") {
52 action = [ 61 action = [
53 { 62 {
54 - value: 'go.h5',  
55 - label: 'H5网页', 63 + value: "go.h5",
  64 + label: "H5网页"
56 }, 65 },
57 { 66 {
58 - value: 'go.pool',  
59 - label: '商品池', 67 + value: "go.pool",
  68 + label: "商品池"
60 }, 69 },
61 { 70 {
62 - value: 'go.list',  
63 - label: '商品列表', 71 + value: "go.list",
  72 + label: "商品列表"
64 }, 73 },
65 { 74 {
66 - value: 'go.detail',  
67 - label: '商品详情', 75 + value: "go.detail",
  76 + label: "商品详情"
68 }, 77 },
69 { 78 {
70 - value: 'go.channel',  
71 - label: '首页频道Tab',  
72 - },  
73 - ]  
74 - }else { 79 + value: "go.channel",
  80 + label: "首页频道Tab"
  81 + }
  82 + ];
  83 + } else {
75 action = [ 84 action = [
76 { 85 {
77 - value: 'go.h5',  
78 - label: 'H5网页', 86 + value: "go.h5",
  87 + label: "H5网页"
79 }, 88 },
80 { 89 {
81 - value: 'go.pool',  
82 - label: '商品池', 90 + value: "go.pool",
  91 + label: "商品池"
83 }, 92 },
84 { 93 {
85 - value: 'go.detail',  
86 - label: '商品详情', 94 + value: "go.detail",
  95 + label: "商品详情"
87 }, 96 },
88 { 97 {
89 - value: 'go.list',  
90 - label: '商品列表', 98 + value: "go.list",
  99 + label: "商品列表"
91 }, 100 },
92 { 101 {
93 - value: 'go.calendar',  
94 - label: '发售日历页', 102 + value: "go.calendar",
  103 + label: "发售日历页"
95 }, 104 },
96 { 105 {
97 - value: 'go.hotlist',  
98 - label: '热卖列表页', 106 + value: "go.hotlist",
  107 + label: "热卖列表页"
99 }, 108 },
100 { 109 {
101 - value: 'go.bargainlist',  
102 - label: '砍价列表页', 110 + value: "go.bargainlist",
  111 + label: "砍价列表页"
103 }, 112 },
104 { 113 {
105 - value: 'go.identifyList',  
106 - label: '鉴定服务', 114 + value: "go.identifyList",
  115 + label: "鉴定服务"
107 }, 116 },
108 { 117 {
109 - value: 'go.channel',  
110 - label: '首页频道Tab', 118 + value: "go.channel",
  119 + label: "首页频道Tab"
111 } 120 }
112 - ] 121 + ];
113 } 122 }
114 return action; 123 return action;
115 }, 124 },
  125 + getLob() {
  126 + // console.log("getLob(url)" + this.value.url);
  127 + let params = util.qsParse(this.value.url);
  128 + // console.log("getLob()");
  129 + // console.log(params);
  130 + return params.business || "new";
  131 + },
116 updateStatus() { 132 updateStatus() {
117 - const data = {url: this.url_, action: this.action_}; 133 + // console.log("=updateStatus=this.url==");
  134 + // console.log(this.url_);
  135 + // console.log(this.lob_);
  136 + const data = { url: this.url_, action: this.action_ };
118 137
119 if (this.islogin) { 138 if (this.islogin) {
120 data.islogin = this.islogin; 139 data.islogin = this.islogin;
@@ -124,35 +143,54 @@ @@ -124,35 +143,54 @@
124 data.headerid = this.headerid; 143 data.headerid = this.headerid;
125 } 144 }
126 145
127 - this.$emit('input', data); 146 + this.$emit("input", data);
128 } 147 }
129 }, 148 },
130 watch: { 149 watch: {
131 url_(newVal) { 150 url_(newVal) {
  151 + // console.log('url_(newVal)')
  152 + let host = util.getLink(newVal)
  153 + // console.log(host)
  154 +
  155 + let params = util.qsParse(newVal);
  156 + // console.log(params)
  157 + params.business = this.lob_;
  158 + let queryStr = util.qsStringify(params);
  159 + // console.log(queryStr)
  160 + this.url_ = host+"?" + queryStr;
132 this.updateStatus(); 161 this.updateStatus();
133 }, 162 },
134 action_(newVal) { 163 action_(newVal) {
135 - if (newVal === 'go.detail') {  
136 - this.url_ = 'https://m.yohobuy.com/?pagename=productDetail';  
137 - } else if (newVal === 'go.pool') {  
138 - this.url_ = 'https://m.yohobuy.com/?pagename=productList';  
139 - } else if (newVal === 'go.list') {  
140 - this.url_ = '';  
141 - } else if (newVal === 'go.h5') {  
142 - this.url_ = '';  
143 - } else if (newVal === 'go.calendar') {  
144 - this.url_ = 'https://m.yohobuy.com/?pagename=saleCalendar';  
145 - } else if (newVal === 'go.hotlist') {  
146 - this.url_ = 'https://m.yohobuy.com/?pagename=hotSale';  
147 - } else if (newVal === 'go.bargainlist') { // 砍价列表  
148 - this.url_ = 'https://m.yohobuy.com/';  
149 - } else if('go.identifyList') {  
150 - this.url_ = 'https://m.yohobuy.com/?pagename=identifyList';  
151 - } else if (newVal === 'go.channel') {  
152 - this.url_ = 'https://m.yohobuy.com/?pagename=home'; 164 + if (newVal === "go.detail") {
  165 + this.url_ = "https://m.yohobuy.com/?pagename=productDetail";
  166 + } else if (newVal === "go.pool") {
  167 + this.url_ = "https://m.yohobuy.com/?pagename=productList";
  168 + } else if (newVal === "go.list") {
  169 + this.url_ = "";
  170 + } else if (newVal === "go.h5") {
  171 + this.url_ = "";
  172 + } else if (newVal === "go.calendar") {
  173 + this.url_ = "https://m.yohobuy.com/?pagename=saleCalendar";
  174 + } else if (newVal === "go.hotlist") {
  175 + this.url_ = "https://m.yohobuy.com/?pagename=hotSale";
  176 + } else if (newVal === "go.bargainlist") {
  177 + // 砍价列表
  178 + this.url_ = "https://m.yohobuy.com/";
  179 + } else if ("go.identifyList") {
  180 + this.url_ = "https://m.yohobuy.com/?pagename=identifyList";
  181 + } else if (newVal === "go.channel") {
  182 + this.url_ = "https://m.yohobuy.com/?pagename=home";
153 } 183 }
154 184
155 this.updateStatus(); 185 this.updateStatus();
  186 + },
  187 + lob_(newVal) {
  188 + let host = util.getLink(this.value.url)
  189 + let params = util.qsParse(this.value.url);
  190 + params.business = newVal;
  191 + let queryStr = util.qsStringify(params);
  192 + this.url_ = host+"?" + queryStr;
  193 + // this.updateStatus();
156 } 194 }
157 }, 195 },
158 components: { 196 components: {
@@ -164,9 +202,8 @@ @@ -164,9 +202,8 @@
164 hotlistUrl: hotlist, 202 hotlistUrl: hotlist,
165 tabUrl: tab 203 tabUrl: tab
166 } 204 }
167 - }; 205 +};
168 </script> 206 </script>
169 207
170 <style> 208 <style>
171 -  
172 </style> 209 </style>
1 <template> 1 <template>
2 - <i-modal v-model="visiable" :loading="posting" :title="allreadonly ? '查看优惠券' : '创建/编辑优惠券'" @on-ok="onOk" width="600"> 2 + <i-modal
  3 + v-model="visiable"
  4 + :loading="posting"
  5 + :title="allreadonly ? '查看优惠券' : '创建/编辑优惠券'"
  6 + @on-ok="onOk"
  7 + width="600"
  8 + >
3 <i-spin v-if="loading"></i-spin> 9 <i-spin v-if="loading"></i-spin>
4 <i-form v-else ref="formCoupon" :rules="ruleValidate" :model="formData" :label-width="80"> 10 <i-form v-else ref="formCoupon" :rules="ruleValidate" :model="formData" :label-width="80">
5 <i-form-item class="form-group" label="优惠券类型"></i-form-item> 11 <i-form-item class="form-group" label="优惠券类型"></i-form-item>
@@ -12,26 +18,53 @@ @@ -12,26 +18,53 @@
12 </i-form-item> 18 </i-form-item>
13 19
14 <i-form-item class="form-group" label="基本信息"></i-form-item> 20 <i-form-item class="form-group" label="基本信息"></i-form-item>
15 - <i-form-item label="Token" v-if="couponToken">  
16 - {{couponToken}}  
17 - </i-form-item> 21 + <i-form-item label="Token" v-if="couponToken">{{couponToken}}</i-form-item>
18 <i-form-item label="名称" prop="couponName"> 22 <i-form-item label="名称" prop="couponName">
19 - <i-input placeholder="名称建议30字以内" v-model="formData.couponName" :disabled="allreadonly" style="width: 200px"></i-input> 23 + <i-input
  24 + placeholder="名称建议30字以内"
  25 + v-model="formData.couponName"
  26 + :disabled="allreadonly"
  27 + style="width: 200px"
  28 + ></i-input>
20 </i-form-item> 29 </i-form-item>
21 <i-form-item label="数量" prop="couponNum"> 30 <i-form-item label="数量" prop="couponNum">
22 - <i-input-number placeholder="数量" v-model="formData.couponNum" :disabled="allreadonly" style="width: 100px;"></i-input-number> 31 + <i-input-number
  32 + placeholder="数量"
  33 + v-model="formData.couponNum"
  34 + :disabled="allreadonly"
  35 + style="width: 100px;"
  36 + ></i-input-number>
23 </i-form-item> 37 </i-form-item>
24 <i-form-item label="使用次数" prop="useNum"> 38 <i-form-item label="使用次数" prop="useNum">
25 <i-input placeholder="使用次数" v-model="formData.useNum" disabled style="width: 100px;"></i-input> 39 <i-input placeholder="使用次数" v-model="formData.useNum" disabled style="width: 100px;"></i-input>
26 </i-form-item> 40 </i-form-item>
27 <i-form-item label="使用期限" prop="time"> 41 <i-form-item label="使用期限" prop="time">
28 - <i-date-picker type="datetimerange" v-model="formData.time" :disabled="allreadonly" placeholder="使用期限" format="yyyy-MM-dd HH:mm:ss" style="width: 250px"></i-date-picker> 42 + <i-date-picker
  43 + type="datetimerange"
  44 + v-model="formData.time"
  45 + :disabled="allreadonly"
  46 + placeholder="使用期限"
  47 + format="yyyy-MM-dd HH:mm:ss"
  48 + style="width: 250px"
  49 + ></i-date-picker>
29 </i-form-item> 50 </i-form-item>
30 <i-form-item label="领券期限" prop="receiveTime"> 51 <i-form-item label="领券期限" prop="receiveTime">
31 - <i-date-picker type="datetimerange" v-model="formData.receiveTime" :disabled="readonly" placeholder="领券期限" format="yyyy-MM-dd HH:mm:ss" style="width: 250px"></i-date-picker> 52 + <i-date-picker
  53 + type="datetimerange"
  54 + v-model="formData.receiveTime"
  55 + :disabled="readonly"
  56 + placeholder="领券期限"
  57 + format="yyyy-MM-dd HH:mm:ss"
  58 + style="width: 250px"
  59 + ></i-date-picker>
32 </i-form-item> 60 </i-form-item>
33 <i-form-item label="优惠券说明" prop="remark"> 61 <i-form-item label="优惠券说明" prop="remark">
34 - <i-input type="textarea" placeholder="优惠券使用条件简介" :disabled="allreadonly" v-model="formData.remark"></i-input> 62 + <i-input
  63 + type="textarea"
  64 + placeholder="优惠券使用条件简介"
  65 + :disabled="allreadonly"
  66 + v-model="formData.remark"
  67 + ></i-input>
35 </i-form-item> 68 </i-form-item>
36 <i-form-item class="form-group" label="使用条件"></i-form-item> 69 <i-form-item class="form-group" label="使用条件"></i-form-item>
37 <i-form-item label="优惠条件" prop="useLimitType" style="display: inline-block; width: 100%"> 70 <i-form-item label="优惠条件" prop="useLimitType" style="display: inline-block; width: 100%">
@@ -42,13 +75,21 @@ @@ -42,13 +75,21 @@
42 <div style="display: inline-block" v-if="formData.useLimitType === 2"> 75 <div style="display: inline-block" v-if="formData.useLimitType === 2">
43 &nbsp; 76 &nbsp;
44 金额满: 77 金额满:
45 - <i-input-number style="width: 100px" :disabled="readonly" placeholder="限制金额" v-model="formData.useLimitValue">  
46 - </i-input-number> 78 + <i-input-number
  79 + style="width: 100px"
  80 + :disabled="readonly"
  81 + placeholder="限制金额"
  82 + v-model="formData.useLimitValue"
  83 + ></i-input-number>
47 </div> 84 </div>
48 </i-form-item> 85 </i-form-item>
49 <i-form-item label="优惠金额" prop="couponAmount"> 86 <i-form-item label="优惠金额" prop="couponAmount">
50 - <i-input-number placeholder="优惠金额" :disabled="readonly" v-model="formData.couponAmount" style="width: 100px">  
51 - </i-input-number> 87 + <i-input-number
  88 + placeholder="优惠金额"
  89 + :disabled="readonly"
  90 + v-model="formData.couponAmount"
  91 + style="width: 100px"
  92 + ></i-input-number>
52 </i-form-item> 93 </i-form-item>
53 94
54 <i-form-item label="适用范围" prop="productLimitType"> 95 <i-form-item label="适用范围" prop="productLimitType">
@@ -59,15 +100,26 @@ @@ -59,15 +100,26 @@
59 </i-select> 100 </i-select>
60 </i-form-item> 101 </i-form-item>
61 102
62 - <i-form-item prop="productLimitValue" v-if="formData.productLimitType === 1 || formData.productLimitType === 3">  
63 - <i-input type="textarea" :disabled="readonly" placeholder="填写商品编码,多个商品编码用英文逗号分隔" v-model="formData.productLimitValue"></i-input> 103 + <i-form-item
  104 + prop="productLimitValue"
  105 + v-if="formData.productLimitType === 1 || formData.productLimitType === 3"
  106 + >
  107 + <i-input
  108 + type="textarea"
  109 + :disabled="readonly"
  110 + placeholder="填写商品编码,多个商品编码用英文逗号分隔"
  111 + v-model="formData.productLimitValue"
  112 + ></i-input>
64 <i-poptip trigger="hover"> 113 <i-poptip trigger="hover">
65 <div slot="content"> 114 <div slot="content">
66 <p>1.上传文件必须是xlsx文件</p> 115 <p>1.上传文件必须是xlsx文件</p>
67 <p>2.第一行标题栏:商品编码</p> 116 <p>2.第一行标题栏:商品编码</p>
68 - <p>3.<a href="javascript:;" @click="onExample">下载样例</a></p> 117 + <p>
  118 + 3.
  119 + <a href="javascript:;" @click="onExample">下载样例</a>
  120 + </p>
69 </div> 121 </div>
70 - <i-upload action="" :format="['xlsx']" :max-size="1024" :before-upload="onBeforeUpload"> 122 + <i-upload action :format="['xlsx']" :max-size="1024" :before-upload="onBeforeUpload">
71 <i-button type="success" size="small" :disabled="readonly">导入</i-button> 123 <i-button type="success" size="small" :disabled="readonly">导入</i-button>
72 <p>{{uploadTxt}}</p> 124 <p>{{uploadTxt}}</p>
73 </i-upload> 125 </i-upload>
@@ -105,71 +157,74 @@ @@ -105,71 +157,74 @@
105 <checkbox label="闲鱼" :disabled="readonly"></checkbox> 157 <checkbox label="闲鱼" :disabled="readonly"></checkbox>
106 </checkbox-group> 158 </checkbox-group>
107 </i-form-item> 159 </i-form-item>
  160 + <i-form-item label="需要校验" prop="checkRequired">
  161 + <checkbox v-model="formData.isCheckRequired" :disabled="readonly" @on-change="getCheckRequired"></checkbox>
  162 + </i-form-item>
108 </i-form> 163 </i-form>
109 </i-modal> 164 </i-modal>
110 </template> 165 </template>
111 166
112 <script> 167 <script>
113 - import Api from 'api/api';  
114 - import dayjs from 'dayjs';  
115 - import XLSX from 'xlsx'; 168 +import Api from "api/api";
  169 +import dayjs from "dayjs";
  170 +import XLSX from "xlsx";
116 171
117 - const api = new Api();  
118 - const forbidenTypeMap = {  
119 - '现货': 1,  
120 - '预售': 4,  
121 - '二手': 6,  
122 - '全新瑕疵': 5,  
123 - '闪购': 3  
124 - };  
125 - const forbidenLabelMap = {  
126 - 1: '现货',  
127 - 4: '预售',  
128 - 6: '二手',  
129 - 5: '全新瑕疵',  
130 - 3: '闪购'  
131 - }; 172 +const api = new Api();
  173 +const forbidenTypeMap = {
  174 + 现货: 1,
  175 + 预售: 4,
  176 + 二手: 6,
  177 + 全新瑕疵: 5,
  178 + 闪购: 3
  179 +};
  180 +const forbidenLabelMap = {
  181 + 1: "现货",
  182 + 4: "预售",
  183 + 6: "二手",
  184 + 5: "全新瑕疵",
  185 + 3: "闪购"
  186 +};
132 187
133 - const allowTypeMap = { 188 +const allowTypeMap = {
134 // '线下店订单': '2', 189 // '线下店订单': '2',
135 - '极速发货': '9-N',  
136 - '极速寄存': '9-Y',  
137 - '预售': '4',  
138 - '瑕疵': '5',  
139 - '二手' : '6', 190 + 极速发货: "9-N",
  191 + 极速寄存: "9-Y",
  192 + 预售: "4",
  193 + 瑕疵: "5",
  194 + 二手: "6",
140 // '鉴定': '8', 195 // '鉴定': '8',
141 - '海外直邮': '17',  
142 - '现货发货': '1-N',  
143 - '现货寄存': '1-Y',  
144 - '闪购发货': '3-N',  
145 - '闪购寄存': '3-Y'  
146 - };  
147 - const allowLabelMap = { 196 + 海外直邮: "17",
  197 + 现货发货: "1-N",
  198 + 现货寄存: "1-Y",
  199 + 闪购发货: "3-N",
  200 + 闪购寄存: "3-Y"
  201 +};
  202 +const allowLabelMap = {
148 // '2': '线下店订单', 203 // '2': '线下店订单',
149 - '9-N': '极速发货',  
150 - '9-Y': '极速寄存',  
151 - '4': '预售',  
152 - '5': '瑕疵',  
153 - '6': '二手', 204 + "9-N": "极速发货",
  205 + "9-Y": "极速寄存",
  206 + "4": "预售",
  207 + "5": "瑕疵",
  208 + "6": "二手",
154 // '8': '鉴定', 209 // '8': '鉴定',
155 - '17': '海外直邮',  
156 - '1-N': '现货发货',  
157 - '1-Y': '现货寄存',  
158 - '3-N': '闪购发货',  
159 - '3-Y':'闪购寄存'  
160 - }; 210 + "17": "海外直邮",
  211 + "1-N": "现货发货",
  212 + "1-Y": "现货寄存",
  213 + "3-N": "闪购发货",
  214 + "3-Y": "闪购寄存"
  215 +};
161 const businessClientTypeMap = { 216 const businessClientTypeMap = {
162 - 'UFO': 'ufo',  
163 - '闲鱼': 'h5/xianyu'  
164 - };  
165 - const businessClientLabelMap = {  
166 - 'ufo': 'UFO',  
167 - 'h5/xianyu': '闲鱼',  
168 - }; 217 + UFO: "ufo",
  218 + 闲鱼: "h5/xianyu"
  219 +};
  220 +const businessClientLabelMap = {
  221 + ufo: "UFO",
  222 + "h5/xianyu": "闲鱼"
  223 +};
169 224
170 - export default { 225 +export default {
171 components: {}, 226 components: {},
172 - name: 'ModalCreateCoupon', 227 + name: "ModalCreateCoupon",
173 data() { 228 data() {
174 return { 229 return {
175 readonly: false, 230 readonly: false,
@@ -177,95 +232,126 @@ const businessClientTypeMap = { @@ -177,95 +232,126 @@ const businessClientTypeMap = {
177 visiable: false, 232 visiable: false,
178 loading: false, 233 loading: false,
179 posting: true, 234 posting: true,
180 - uploadTxt: '',  
181 - couponToken: '', 235 + uploadTxt: "",
  236 + couponToken: "",
182 formData: { 237 formData: {
183 id: 0, 238 id: 0,
184 - couponName: '', 239 + couponName: "",
185 couponType: 0, 240 couponType: 0,
186 couponNum: 0, 241 couponNum: 0,
187 useNum: 1, 242 useNum: 1,
188 couponAmount: 0, 243 couponAmount: 0,
189 useLimitType: 0, 244 useLimitType: 0,
190 - remark: '', 245 + remark: "",
191 productLimitType: 2, 246 productLimitType: 2,
192 - productLimitValue: '', 247 + productLimitValue: "",
193 useLimitValue: 0, 248 useLimitValue: 0,
194 - time: ['', ''],  
195 - receiveTime: ['', ''],  
196 -// skupForbidTypeLable:[],  
197 -// skupForbidType: '' 249 + time: ["", ""],
  250 + receiveTime: ["", ""],
  251 + // skupForbidTypeLable:[],
  252 + // skupForbidType: ''
198 skupAllowTypeLabel: [], 253 skupAllowTypeLabel: [],
199 - skupAllowType: '',  
200 - businessClient: '' 254 + skupAllowType: "",
  255 + businessClient: "",
  256 + checkRequired: 0,
  257 + isCheckRequired: true,
201 }, 258 },
202 ruleValidate: { 259 ruleValidate: {
203 - couponType: {required: true, validator: (rule, value, callback) => {  
204 - if (value === 0 || value === '0') {  
205 - callback(new Error('请选择优惠券类型')); 260 + couponType: {
  261 + required: true,
  262 + validator: (rule, value, callback) => {
  263 + if (value === 0 || value === "0") {
  264 + callback(new Error("请选择优惠券类型"));
206 } else { 265 } else {
207 callback(); 266 callback();
208 } 267 }
209 - }},  
210 - couponName: {required: true, max: 30, message: '请输入名称'},  
211 - couponNum: {type: 'number', required: true, min: 1, message: '请输入数量'},  
212 - couponAmount: {type: 'number', required: true, min: 1, message: '请输入优惠金额'},  
213 - time: {required: true, validator: (rule, value, callback) => { 268 + }
  269 + },
  270 + couponName: { required: true, max: 30, message: "请输入名称" },
  271 + couponNum: {
  272 + type: "number",
  273 + required: true,
  274 + min: 1,
  275 + message: "请输入数量"
  276 + },
  277 + couponAmount: {
  278 + type: "number",
  279 + required: true,
  280 + min: 1,
  281 + message: "请输入优惠金额"
  282 + },
  283 + time: {
  284 + required: true,
  285 + validator: (rule, value, callback) => {
214 if (value.some(v => !v)) { 286 if (value.some(v => !v)) {
215 - callback(new Error('请选择使用期限')); 287 + callback(new Error("请选择使用期限"));
216 } else { 288 } else {
217 callback(); 289 callback();
218 } 290 }
219 - }},  
220 - receiveTime: {required: true, validator: (rule, value, callback) => { 291 + }
  292 + },
  293 + receiveTime: {
  294 + required: true,
  295 + validator: (rule, value, callback) => {
221 if (value.some(v => !v)) { 296 if (value.some(v => !v)) {
222 - callback(new Error('请选择领券期限')); 297 + callback(new Error("请选择领券期限"));
223 } else { 298 } else {
224 - let endTime = this.formData.time[1] ? dayjs(this.formData.time[1]).unix() : void 0; 299 + let endTime = this.formData.time[1]
  300 + ? dayjs(this.formData.time[1]).unix()
  301 + : void 0;
225 let receiveEndTime = value[1] ? dayjs(value[1]).unix() : void 0; 302 let receiveEndTime = value[1] ? dayjs(value[1]).unix() : void 0;
226 // console.log('====/'+endTime+"///===/"+receiveEndTime) 303 // console.log('====/'+endTime+"///===/"+receiveEndTime)
227 - if(endTime < receiveEndTime){  
228 - callback(new Error('请选择领券结束时间小于使用结束时间'));  
229 - }else { 304 + if (endTime < receiveEndTime) {
  305 + callback(new Error("请选择领券结束时间小于使用结束时间"));
  306 + } else {
230 callback(); 307 callback();
231 } 308 }
232 -  
233 } 309 }
234 - }},  
235 - remark: {required: true, message: '请输入优惠券说明'},  
236 - useLimitType: {required: true, validator: (rule, value, callback) => { 310 + }
  311 + },
  312 + remark: { required: true, message: "请输入优惠券说明" },
  313 + useLimitType: {
  314 + required: true,
  315 + validator: (rule, value, callback) => {
237 if (value >= 0) { 316 if (value >= 0) {
238 if (value === 2) { 317 if (value === 2) {
239 if (parseInt(this.formData.useLimitValue) > 0) { 318 if (parseInt(this.formData.useLimitValue) > 0) {
240 callback(); 319 callback();
241 } else { 320 } else {
242 - callback(new Error('请输入限制金额')); 321 + callback(new Error("请输入限制金额"));
243 } 322 }
244 } else { 323 } else {
245 callback(); 324 callback();
246 } 325 }
247 } else { 326 } else {
248 - callback(new Error('请选择优惠条件')); 327 + callback(new Error("请选择优惠条件"));
  328 + }
249 } 329 }
250 - }},  
251 - productLimitValue: {required: false, validator: (rule, value, callback) => {  
252 - const ids = (value || '').split(','); 330 + },
  331 + productLimitValue: {
  332 + required: false,
  333 + validator: (rule, value, callback) => {
  334 + const ids = (value || "").split(",");
253 335
254 if (!value || !ids.length) { 336 if (!value || !ids.length) {
255 - callback(new Error('请输入适用范围'));  
256 - } else if(ids.some(id => id ? !parseInt(id) : false)) {  
257 - callback(new Error('适用范围格式错误')); 337 + callback(new Error("请输入适用范围"));
  338 + } else if (ids.some(id => (id ? !parseInt(id) : false))) {
  339 + callback(new Error("适用范围格式错误"));
258 } else { 340 } else {
259 callback(); 341 callback();
260 } 342 }
261 - }},  
262 - productLimitType: {required: true, validator: (rule, value, callback) => { 343 + }
  344 + },
  345 + productLimitType: {
  346 + required: true,
  347 + validator: (rule, value, callback) => {
263 if (value === 1 || value === 2 || value === 3) { 348 if (value === 1 || value === 2 || value === 3) {
264 callback(); 349 callback();
265 } else { 350 } else {
266 - callback(new Error('请选择类型')); 351 + callback(new Error("请选择类型"));
  352 + }
  353 + }
267 } 354 }
268 - }}  
269 } 355 }
270 }; 356 };
271 }, 357 },
@@ -276,31 +362,32 @@ const businessClientTypeMap = { @@ -276,31 +362,32 @@ const businessClientTypeMap = {
276 this.allreadonly = allreadonly; 362 this.allreadonly = allreadonly;
277 this.posting = this.visiable = true; 363 this.posting = this.visiable = true;
278 this.$refs.formCoupon.resetFields(); 364 this.$refs.formCoupon.resetFields();
279 - this.couponToken = ''; 365 + this.couponToken = "";
280 let initData = { 366 let initData = {
281 id: 0, 367 id: 0,
282 - couponName: '', 368 + couponName: "",
283 couponNum: 0, 369 couponNum: 0,
284 couponType: 0, 370 couponType: 0,
285 useNum: 1, 371 useNum: 1,
286 couponAmount: 0, 372 couponAmount: 0,
287 useLimitType: 0, 373 useLimitType: 0,
288 - remark: '',  
289 - productLimitValue: '', 374 + remark: "",
  375 + productLimitValue: "",
290 productLimitType: 2, 376 productLimitType: 2,
291 useLimitValue: 0, 377 useLimitValue: 0,
292 - time: ['', ''], 378 + time: ["", ""],
293 skupAllowTypeLabel: [], 379 skupAllowTypeLabel: [],
294 - skupAllowType: '', 380 + skupAllowType: "",
295 businessClientLabel: [], 381 businessClientLabel: [],
296 - businessClient: ''  
297 -// skupForbidTypeLable:[],  
298 -// skupForbidType: '' 382 + businessClient: "",
  383 + checkRequired: 0
  384 + // skupForbidTypeLable:[],
  385 + // skupForbidType: ''
299 }; 386 };
300 387
301 if (id) { 388 if (id) {
302 this.loading = true; 389 this.loading = true;
303 - const result = await api._get('/ufoPlatform/coupon/getCouponInfo', { 390 + const result = await api._get("/ufoPlatform/coupon/getCouponInfo", {
304 id 391 id
305 }); 392 });
306 393
@@ -315,19 +402,21 @@ const businessClientTypeMap = { @@ -315,19 +402,21 @@ const businessClientTypeMap = {
315 this.couponToken = coupon.couponToken; 402 this.couponToken = coupon.couponToken;
316 let skupAllowTypeLabel = []; 403 let skupAllowTypeLabel = [];
317 if (coupon.skupAllowType) { 404 if (coupon.skupAllowType) {
318 - let arr = coupon.skupAllowType.split(',');  
319 - for(let i = 0; i < arr.length; i++) { 405 + let arr = coupon.skupAllowType.split(",");
  406 + for (let i = 0; i < arr.length; i++) {
320 skupAllowTypeLabel.push(allowLabelMap[arr[i]]); 407 skupAllowTypeLabel.push(allowLabelMap[arr[i]]);
321 } 408 }
322 } 409 }
323 410
324 let businessClientTypeLabel = []; 411 let businessClientTypeLabel = [];
325 if (coupon.businessClient) { 412 if (coupon.businessClient) {
326 - let arr = coupon.businessClient.split(',');  
327 - for(let i = 0; i < arr.length; i++) { 413 + let arr = coupon.businessClient.split(",");
  414 + for (let i = 0; i < arr.length; i++) {
328 businessClientTypeLabel.push(businessClientLabelMap[arr[i]]); 415 businessClientTypeLabel.push(businessClientLabelMap[arr[i]]);
329 } 416 }
330 } 417 }
  418 + let isCheckRequired = coupon.checkRequired === 1
  419 + console.log('=====:'+isCheckRequired)
331 initData = { 420 initData = {
332 id, 421 id,
333 couponName: coupon.couponName, 422 couponName: coupon.couponName,
@@ -338,15 +427,24 @@ const businessClientTypeMap = { @@ -338,15 +427,24 @@ const businessClientTypeMap = {
338 useLimitType: coupon.useLimitType, 427 useLimitType: coupon.useLimitType,
339 remark: coupon.remark, 428 remark: coupon.remark,
340 productLimitType: coupon.productLimitType, 429 productLimitType: coupon.productLimitType,
341 - productLimitValue: (productLimits || []).map(i => i.productId).join(','), 430 + productLimitValue: (productLimits || [])
  431 + .map(i => i.productId)
  432 + .join(","),
342 useLimitValue: coupon.useLimitValue, 433 useLimitValue: coupon.useLimitValue,
343 - time: [dayjs.unix(coupon.startTime).format('YYYY-MM-DD HH:mm:ss'), dayjs.unix(coupon.endTime).format('YYYY-MM-DD HH:mm:ss')],  
344 - receiveTime: [dayjs.unix(coupon.receiveStartTime).format('YYYY-MM-DD HH:mm:ss'), dayjs.unix(coupon.receiveEndTime).format('YYYY-MM-DD HH:mm:ss')], 434 + time: [
  435 + dayjs.unix(coupon.startTime).format("YYYY-MM-DD HH:mm:ss"),
  436 + dayjs.unix(coupon.endTime).format("YYYY-MM-DD HH:mm:ss")
  437 + ],
  438 + receiveTime: [
  439 + dayjs.unix(coupon.receiveStartTime).format("YYYY-MM-DD HH:mm:ss"),
  440 + dayjs.unix(coupon.receiveEndTime).format("YYYY-MM-DD HH:mm:ss")
  441 + ],
345 skupAllowTypeLabel: skupAllowTypeLabel, 442 skupAllowTypeLabel: skupAllowTypeLabel,
346 skupAllowType: coupon.skupAllowType, 443 skupAllowType: coupon.skupAllowType,
347 businessClientLabel: businessClientTypeLabel, 444 businessClientLabel: businessClientTypeLabel,
348 businessClient: coupon.businessClient, //购买渠道 445 businessClient: coupon.businessClient, //购买渠道
349 - 446 + checkRequired: coupon.checkRequired,
  447 + isCheckRequired
350 }; 448 };
351 } else { 449 } else {
352 result.message && this.$Message.warning(result.message); 450 result.message && this.$Message.warning(result.message);
@@ -366,7 +464,17 @@ const businessClientTypeMap = { @@ -366,7 +464,17 @@ const businessClientTypeMap = {
366 } 464 }
367 }); 465 });
368 }, 466 },
369 - getCheckBox() { // checkbox勾选取消的监测 467 + getCheckRequired(checked) {
  468 + if(checked) {
  469 + this.formData.checkRequired = 1
  470 + }else {
  471 + this.formData.checkRequired = 0
  472 + }
  473 +
  474 +
  475 + },
  476 + getCheckBox() {
  477 + // checkbox勾选取消的监测
370 let arr = []; 478 let arr = [];
371 for (let i = 0; i < this.formData.skupAllowTypeLabel.length; i++) { 479 for (let i = 0; i < this.formData.skupAllowTypeLabel.length; i++) {
372 let allowType = this.formData.skupAllowTypeLabel[i]; 480 let allowType = this.formData.skupAllowTypeLabel[i];
@@ -375,9 +483,9 @@ const businessClientTypeMap = { @@ -375,9 +483,9 @@ const businessClientTypeMap = {
375 } 483 }
376 484
377 // console.log(arr); 485 // console.log(arr);
378 - this.formData.skupAllowType = arr.join(','); 486 + this.formData.skupAllowType = arr.join(",");
379 }, 487 },
380 - getChannelCheckBox(){ 488 + getChannelCheckBox() {
381 let arr = []; 489 let arr = [];
382 for (let i = 0; i < this.formData.businessClientLabel.length; i++) { 490 for (let i = 0; i < this.formData.businessClientLabel.length; i++) {
383 let businessClientType = this.formData.businessClientLabel[i]; 491 let businessClientType = this.formData.businessClientLabel[i];
@@ -386,7 +494,7 @@ const businessClientTypeMap = { @@ -386,7 +494,7 @@ const businessClientTypeMap = {
386 } 494 }
387 495
388 // console.log(arr); 496 // console.log(arr);
389 - this.formData.businessClient = arr.join(','); 497 + this.formData.businessClient = arr.join(",");
390 }, 498 },
391 async saveData(params) { 499 async saveData(params) {
392 if (this.allreadonly) { 500 if (this.allreadonly) {
@@ -394,7 +502,7 @@ const businessClientTypeMap = { @@ -394,7 +502,7 @@ const businessClientTypeMap = {
394 return; 502 return;
395 } 503 }
396 504
397 - const result = await api._post('/ufoPlatform/coupon/saveOrUpdateCoupon', { 505 + const result = await api._post("/ufoPlatform/coupon/saveOrUpdateCoupon", {
398 id: params.id || void 0, 506 id: params.id || void 0,
399 couponName: params.couponName, 507 couponName: params.couponName,
400 couponAmount: params.couponAmount, 508 couponAmount: params.couponAmount,
@@ -405,21 +513,28 @@ const businessClientTypeMap = { @@ -405,21 +513,28 @@ const businessClientTypeMap = {
405 productLimitType: params.productLimitType, 513 productLimitType: params.productLimitType,
406 productLimitValue: params.productLimitValue, 514 productLimitValue: params.productLimitValue,
407 remark: params.remark, 515 remark: params.remark,
408 - useLimitType: parseInt(params.useLimitType) >= 0 ? params.useLimitType : void 0, 516 + useLimitType:
  517 + parseInt(params.useLimitType) >= 0 ? params.useLimitType : void 0,
409 startTime: params.time[0] ? dayjs(params.time[0]).unix() : void 0, 518 startTime: params.time[0] ? dayjs(params.time[0]).unix() : void 0,
410 endTime: params.time[1] ? dayjs(params.time[1]).unix() : void 0, 519 endTime: params.time[1] ? dayjs(params.time[1]).unix() : void 0,
411 skupAllowType: params.skupAllowType, 520 skupAllowType: params.skupAllowType,
412 businessClient: params.businessClient, 521 businessClient: params.businessClient,
413 - receiveStartTime: params.receiveTime[0] ? dayjs(params.receiveTime[0]).unix() : void 0,  
414 - receiveEndTime: params.receiveTime[1] ? dayjs(params.receiveTime[1]).unix() : void 0, 522 + receiveStartTime: params.receiveTime[0]
  523 + ? dayjs(params.receiveTime[0]).unix()
  524 + : void 0,
  525 + receiveEndTime: params.receiveTime[1]
  526 + ? dayjs(params.receiveTime[1]).unix()
  527 + : void 0,
  528 + checkRequired:params.checkRequired
  529 +
415 }); 530 });
416 531
417 // console.log('result=', result); 532 // console.log('result=', result);
418 533
419 if (result.code === 200) { 534 if (result.code === 200) {
420 - this.$Message.success('保存成功'); 535 + this.$Message.success("保存成功");
421 this.visiable = false; 536 this.visiable = false;
422 - this.$emit('on-created'); 537 + this.$emit("on-created");
423 } else { 538 } else {
424 result.message && this.$Message.warning(result.message); 539 result.message && this.$Message.warning(result.message);
425 this.posting = false; 540 this.posting = false;
@@ -429,68 +544,72 @@ const businessClientTypeMap = { @@ -429,68 +544,72 @@ const businessClientTypeMap = {
429 } 544 }
430 }, 545 },
431 onBeforeUpload(file) { 546 onBeforeUpload(file) {
432 - const fileExt = file.name.split('.').pop().toLocaleLowerCase(); 547 + const fileExt = file.name
  548 + .split(".")
  549 + .pop()
  550 + .toLocaleLowerCase();
433 // console.log(fileExt) 551 // console.log(fileExt)
434 - if (fileExt !== 'xlsx') {  
435 - this.$Message.warning('文件格式错误'); 552 + if (fileExt !== "xlsx") {
  553 + this.$Message.warning("文件格式错误");
436 return false; 554 return false;
437 } 555 }
438 if (file.size > 1024 * 1024) { 556 if (file.size > 1024 * 1024) {
439 - this.$Message.warning('文件大小超过1M'); 557 + this.$Message.warning("文件大小超过1M");
440 return false; 558 return false;
441 } 559 }
442 const reader = new FileReader(); 560 const reader = new FileReader();
443 561
444 reader.readAsArrayBuffer(file); 562 reader.readAsArrayBuffer(file);
445 reader.onloadstart = () => { 563 reader.onloadstart = () => {
446 - this.uploadTxt = '开始读取'; 564 + this.uploadTxt = "开始读取";
447 }; 565 };
448 reader.onprogress = e => { 566 reader.onprogress = e => {
449 - this.uploadTxt = `进度:${Math.round(e.loaded / e.total * 100)}...`; 567 + this.uploadTxt = `进度:${Math.round((e.loaded / e.total) * 100)}...`;
450 }; 568 };
451 reader.onerror = () => { 569 reader.onerror = () => {
452 - this.uploadTxt = '文件读取出错'; 570 + this.uploadTxt = "文件读取出错";
453 }; 571 };
454 reader.onload = e => { 572 reader.onload = e => {
455 - this.uploadTxt = ''; 573 + this.uploadTxt = "";
456 try { 574 try {
457 const data = e.target.result; 575 const data = e.target.result;
458 - const workbook = XLSX.read(data, { type: 'array' }); 576 + const workbook = XLSX.read(data, { type: "array" });
459 const firstSheetName = workbook.SheetNames[0]; 577 const firstSheetName = workbook.SheetNames[0];
460 const worksheet = workbook.Sheets[firstSheetName]; 578 const worksheet = workbook.Sheets[firstSheetName];
461 const results = XLSX.utils.sheet_to_json(worksheet); 579 const results = XLSX.utils.sheet_to_json(worksheet);
462 580
463 - this.formData.productLimitValue = results.map(r => r['商品编码']).filter(r => r).join(',');  
464 - 581 + this.formData.productLimitValue = results
  582 + .map(r => r["商品编码"])
  583 + .filter(r => r)
  584 + .join(",");
465 } catch (error) { 585 } catch (error) {
466 - this.uploadTxt = '文件解析失败,请按照格式上传'; 586 + this.uploadTxt = "文件解析失败,请按照格式上传";
467 } 587 }
468 -  
469 -  
470 }; 588 };
471 return false; 589 return false;
472 }, 590 },
473 onExample() { 591 onExample() {
474 const wb = XLSX.utils.book_new(); 592 const wb = XLSX.utils.book_new();
475 - const ws = XLSX.utils.json_to_sheet([{  
476 - '商品编码': '123456'  
477 - }]);  
478 - XLSX.utils.book_append_sheet(wb, ws, '优惠券适用范围示例');  
479 - XLSX.writeFile(wb, '优惠券适用范围示例.xlsx'); 593 + const ws = XLSX.utils.json_to_sheet([
  594 + {
  595 + 商品编码: "123456"
480 } 596 }
  597 + ]);
  598 + XLSX.utils.book_append_sheet(wb, ws, "优惠券适用范围示例");
  599 + XLSX.writeFile(wb, "优惠券适用范围示例.xlsx");
481 } 600 }
482 - }; 601 + }
  602 +};
483 </script> 603 </script>
484 604
485 <style lang="scss" scoped> 605 <style lang="scss" scoped>
486 - .form-group { 606 +.form-group {
487 width: 100%; 607 width: 100%;
488 height: 30px; 608 height: 30px;
489 background-color: #f5f7f9; 609 background-color: #f5f7f9;
490 - } 610 +}
491 611
492 - .ivu-form-item-label { 612 +.ivu-form-item-label {
493 width: 90px !important; 613 width: 90px !important;
494 - }  
495 - 614 +}
496 </style> 615 </style>
@@ -179,6 +179,7 @@ @@ -179,6 +179,7 @@
179 imgId: '0', 179 imgId: '0',
180 src: '', 180 src: '',
181 title: '', 181 title: '',
  182 + // business: "new",
182 hideDeleteButton: true, 183 hideDeleteButton: true,
183 url: { 184 url: {
184 action: 'go.h5', 185 action: 'go.h5',
@@ -199,6 +200,7 @@ @@ -199,6 +200,7 @@
199 imgId: '0', 200 imgId: '0',
200 src: '', 201 src: '',
201 title: '', 202 title: '',
  203 + // business: "new",
202 hideDeleteButton: true, 204 hideDeleteButton: true,
203 url: { 205 url: {
204 action: 'go.h5', 206 action: 'go.h5',
@@ -211,6 +213,7 @@ @@ -211,6 +213,7 @@
211 imgId: '0', 213 imgId: '0',
212 src: '', 214 src: '',
213 title: '', 215 title: '',
  216 + // business: "new",
214 hideDeleteButton: true, 217 hideDeleteButton: true,
215 url: { 218 url: {
216 action: 'go.h5', 219 action: 'go.h5',
@@ -231,6 +234,7 @@ @@ -231,6 +234,7 @@
231 imgId: '0', 234 imgId: '0',
232 src: '', 235 src: '',
233 title: '', 236 title: '',
  237 + // business: "new",
234 hideDeleteButton: true, 238 hideDeleteButton: true,
235 url: { 239 url: {
236 action: 'go.h5', 240 action: 'go.h5',
@@ -243,6 +247,7 @@ @@ -243,6 +247,7 @@
243 imgId: '0', 247 imgId: '0',
244 src: '', 248 src: '',
245 title: '', 249 title: '',
  250 + // business: "new",
246 hideDeleteButton: true, 251 hideDeleteButton: true,
247 url: { 252 url: {
248 action: 'go.h5', 253 action: 'go.h5',
@@ -255,6 +260,7 @@ @@ -255,6 +260,7 @@
255 imgId: '0', 260 imgId: '0',
256 src: '', 261 src: '',
257 title: '', 262 title: '',
  263 + // business: "new",
258 hideDeleteButton: true, 264 hideDeleteButton: true,
259 url: { 265 url: {
260 action: 'go.h5', 266 action: 'go.h5',
@@ -276,6 +282,7 @@ @@ -276,6 +282,7 @@
276 imgId: '0', 282 imgId: '0',
277 src: '', 283 src: '',
278 title: '', 284 title: '',
  285 + // business: "new",
279 hideDeleteButton: true, 286 hideDeleteButton: true,
280 url: { 287 url: {
281 action: 'go.h5', 288 action: 'go.h5',
@@ -298,6 +305,7 @@ @@ -298,6 +305,7 @@
298 imgId: '0', 305 imgId: '0',
299 src: '', 306 src: '',
300 title: '', 307 title: '',
  308 + // business: "new",
301 hideDeleteButton: true, 309 hideDeleteButton: true,
302 url: { 310 url: {
303 action: 'go.pool', 311 action: 'go.pool',
@@ -317,6 +325,8 @@ @@ -317,6 +325,8 @@
317 "0":{ 325 "0":{
318 tabName: "", 326 tabName: "",
319 code: "", 327 code: "",
  328 + // business: "new",
  329 + hideDeleteButton: true,
320 url: { 330 url: {
321 action: 'go.channel', 331 action: 'go.channel',
322 url: '' 332 url: ''
@@ -338,6 +348,7 @@ @@ -338,6 +348,7 @@
338 imgId: '0', 348 imgId: '0',
339 src: '', 349 src: '',
340 title: '', 350 title: '',
  351 + // business: "new",
341 hideDeleteButton: true, 352 hideDeleteButton: true,
342 url: { 353 url: {
343 action: 'go.h5', 354 action: 'go.h5',