소스 검색

套餐编辑

licailing 4 년 전
부모
커밋
4c69d92e4b

+ 4 - 4
src/main/vue/src/components/PackageEdit.vue

@@ -293,12 +293,12 @@
                     <el-button @click="list.push({ name: '', desc: '', img: [] })">添加</el-button>
                 </div>
             </el-form-item> -->
-            <!-- <el-form-item>
-                <el-button @click="onSave" :loading="saving" type="primary" v-if="$route.query.id">保存</el-button>
-                <el-button @click="onSave" :loading="saving" type="primary" v-else>下一步</el-button>
+            <el-form-item>
+                <el-button @click="onSave" :loading="saving" type="primary">保存</el-button>
+                <!-- <el-button @click="onSave" :loading="saving" type="primary" v-else>下一步</el-button> -->
                 <el-button @click="onDelete" :loading="saving" type="danger" v-if="formData.id">删除 </el-button>
                 <el-button @click="$router.go(-1)">取消</el-button>
-            </el-form-item> -->
+            </el-form-item>
         </el-form>
     </div>
 </template>

+ 51 - 49
src/main/vue/src/components/PackageEdit2.vue

@@ -40,12 +40,12 @@
                     <el-button @click="list.push({ name: '', desc: '', img: [] })">添加</el-button>
                 </div>
             </el-form-item>
-            <!-- <el-form-item>
+            <el-form-item>
                 <el-button @click="onSave" :loading="saving" type="primary" v-if="$route.query.id">保存</el-button>
                 <el-button @click="onSave" :loading="saving" type="primary" v-else>下一步</el-button>
                 <el-button @click="onDelete" :loading="saving" type="danger" v-if="formData.id">删除 </el-button>
                 <el-button @click="$router.go(-1)">取消</el-button>
-            </el-form-item> -->
+            </el-form-item>
         </el-form>
     </div>
 </template>
@@ -59,56 +59,57 @@ export default {
                 .get('package/get/' + this.$route.query.id)
                 .then(res => {
                     this.formData = res;
+                    this.list = JSON.parse(res.workflow) || [];
                 })
                 .catch(e => {
                     console.log(e);
                     this.$message.error(e.error);
                 });
-            this.$http.get('/stock/byPackageId', { packageId: this.$route.query.id }).then(res => {
-                this.stockList = res;
-            });
+            // this.$http.get('/stock/byPackageId', { packageId: this.$route.query.id }).then(res => {
+            //     this.stockList = res;
+            // });
         }
-        this.$http
-            .post('/attractions/all', { size: 1000, query: { del: false, brand: false } }, { body: 'json' })
-            .then(res => {
-                if (res.content.length > 0) {
-                    res.content.forEach(item => {
-                        this.attractionsOptions.push({
-                            label: item.name,
-                            value: item.id
-                        });
-                    });
-                }
-            })
-            .catch(e => {
-                console.log(e);
-                this.$message.error(e.error);
-            });
-        this.$http
-            .post('/category/getChildren', { id: 731 })
-            .then(res => {
-                if (res.length > 0) {
-                    res.forEach(item => {
-                        this.categoryOptions.push({
-                            label: item.name,
-                            value: item.id
-                        });
-                    });
-                }
-            })
-            .catch(e => {
-                console.log(e);
-                this.$message.error(e.error);
-            });
-        this.$http
-            .post('/coupon/all', { size: 1000, query: { del: false } }, { body: 'json' })
-            .then(res => {
-                this.coupons = res.content;
-            })
-            .catch(e => {
-                console.log(e);
-                this.$message.error(e.error);
-            });
+        // this.$http
+        //     .post('/attractions/all', { size: 1000, query: { del: false, brand: false } }, { body: 'json' })
+        //     .then(res => {
+        //         if (res.content.length > 0) {
+        //             res.content.forEach(item => {
+        //                 this.attractionsOptions.push({
+        //                     label: item.name,
+        //                     value: item.id
+        //                 });
+        //             });
+        //         }
+        //     })
+        //     .catch(e => {
+        //         console.log(e);
+        //         this.$message.error(e.error);
+        //     });
+        // this.$http
+        //     .post('/category/getChildren', { id: 731 })
+        //     .then(res => {
+        //         if (res.length > 0) {
+        //             res.forEach(item => {
+        //                 this.categoryOptions.push({
+        //                     label: item.name,
+        //                     value: item.id
+        //                 });
+        //             });
+        //         }
+        //     })
+        //     .catch(e => {
+        //         console.log(e);
+        //         this.$message.error(e.error);
+        //     });
+        // this.$http
+        //     .post('/coupon/all', { size: 1000, query: { del: false } }, { body: 'json' })
+        //     .then(res => {
+        //         this.coupons = res.content;
+        //     })
+        //     .catch(e => {
+        //         console.log(e);
+        //         this.$message.error(e.error);
+        //     });
     },
     data() {
         return {
@@ -200,6 +201,7 @@ export default {
         },
         submit() {
             let data = { ...this.formData };
+            data.workflow = JSON.stringify(this.list);
             this.saving = true;
             this.$http
                 .post('/package/save', data, { body: 'json' })
@@ -208,9 +210,9 @@ export default {
                     // this.$message.success('成功');
                     this.packageId = res.id;
                     this.$nextTick(() => {
-                        this.$http.post('/stock/batchSave', {
-                            stocks: this.saveOtherJson
-                        });
+                        // this.$http.post('/stock/batchSave', {
+                        //     stocks: this.saveOtherJson
+                        // });
                         this.$message.success('成功');
                         this.$router.go(-1);
                     });

+ 65 - 65
src/main/vue/src/components/PackageEdit3.vue

@@ -21,7 +21,7 @@
                 >
                     <div slot="tips" class="tips">尺寸120x240px</div>
                 </poster-upload> -->
-                <crop-upload v-model="formData.poster"></crop-upload>
+                <single-upload v-model="formData.poster"></single-upload>
             </el-form-item>
             <el-form-item label="分享图" prop="smallPoster">
                 <multi-upload v-model="formData.smallPoster"></multi-upload>
@@ -29,11 +29,11 @@
             <el-form-item prop="share" label="文案" style="width: 600px;">
                 <simple-rich-text v-model="formData.share" class="select-width"></simple-rich-text>
             </el-form-item>
-            <!-- <el-form-item>
+            <el-form-item>
                 <el-button @click="onSave" :loading="saving" type="primary" v-if="$route.query.id">保存</el-button>
                 <el-button @click="onDelete" :loading="saving" type="danger" v-if="formData.id">删除 </el-button>
                 <el-button @click="$router.go(-1)">取消</el-button>
-            </el-form-item> -->
+            </el-form-item>
         </el-form>
     </div>
 </template>
@@ -52,51 +52,51 @@ export default {
                     console.log(e);
                     this.$message.error(e.error);
                 });
-            this.$http.get('/stock/byPackageId', { packageId: this.$route.query.id }).then(res => {
-                this.stockList = res;
-            });
+            // this.$http.get('/stock/byPackageId', { packageId: this.$route.query.id }).then(res => {
+            //     this.stockList = res;
+            // });
         }
-        this.$http
-            .post('/attractions/all', { size: 1000, query: { del: false, brand: false } }, { body: 'json' })
-            .then(res => {
-                if (res.content.length > 0) {
-                    res.content.forEach(item => {
-                        this.attractionsOptions.push({
-                            label: item.name,
-                            value: item.id
-                        });
-                    });
-                }
-            })
-            .catch(e => {
-                console.log(e);
-                this.$message.error(e.error);
-            });
-        this.$http
-            .post('/category/getChildren', { id: 731 })
-            .then(res => {
-                if (res.length > 0) {
-                    res.forEach(item => {
-                        this.categoryOptions.push({
-                            label: item.name,
-                            value: item.id
-                        });
-                    });
-                }
-            })
-            .catch(e => {
-                console.log(e);
-                this.$message.error(e.error);
-            });
-        this.$http
-            .post('/coupon/all', { size: 1000, query: { del: false } }, { body: 'json' })
-            .then(res => {
-                this.coupons = res.content;
-            })
-            .catch(e => {
-                console.log(e);
-                this.$message.error(e.error);
-            });
+        // this.$http
+        //     .post('/attractions/all', { size: 1000, query: { del: false, brand: false } }, { body: 'json' })
+        //     .then(res => {
+        //         if (res.content.length > 0) {
+        //             res.content.forEach(item => {
+        //                 this.attractionsOptions.push({
+        //                     label: item.name,
+        //                     value: item.id
+        //                 });
+        //             });
+        //         }
+        //     })
+        //     .catch(e => {
+        //         console.log(e);
+        //         this.$message.error(e.error);
+        //     });
+        // this.$http
+        //     .post('/category/getChildren', { id: 731 })
+        //     .then(res => {
+        //         if (res.length > 0) {
+        //             res.forEach(item => {
+        //                 this.categoryOptions.push({
+        //                     label: item.name,
+        //                     value: item.id
+        //                 });
+        //             });
+        //         }
+        //     })
+        //     .catch(e => {
+        //         console.log(e);
+        //         this.$message.error(e.error);
+        //     });
+        // this.$http
+        //     .post('/coupon/all', { size: 1000, query: { del: false } }, { body: 'json' })
+        //     .then(res => {
+        //         this.coupons = res.content;
+        //     })
+        //     .catch(e => {
+        //         console.log(e);
+        //         this.$message.error(e.error);
+        //     });
     },
     data() {
         return {
@@ -169,22 +169,22 @@ export default {
     },
     methods: {
         onSave() {
-            // this.$refs.form.validate(valid => {
-            //     if (valid) {
-            //         this.submit();
-            //     } else {
-            //         return false;
-            //     }
-            // });
-            Promise.all(this.$refs.subform.map(i => i.validate())).then(() => {
-                this.$refs.form.validate(valid => {
-                    if (valid) {
-                        this.submit();
-                    } else {
-                        return false;
-                    }
-                });
+            this.$refs.form.validate(valid => {
+                if (valid) {
+                    this.submit();
+                } else {
+                    return false;
+                }
             });
+            // Promise.all(this.$refs.subform.map(i => i.validate())).then(() => {
+            //     this.$refs.form.validate(valid => {
+            //         if (valid) {
+            //             this.submit();
+            //         } else {
+            //             return false;
+            //         }
+            //     });
+            // });
         },
         submit() {
             let data = { ...this.formData };
@@ -196,9 +196,9 @@ export default {
                     // this.$message.success('成功');
                     this.packageId = res.id;
                     this.$nextTick(() => {
-                        this.$http.post('/stock/batchSave', {
-                            stocks: this.saveOtherJson
-                        });
+                        // this.$http.post('/stock/batchSave', {
+                        //     stocks: this.saveOtherJson
+                        // });
                         this.$message.success('成功');
                         this.$router.go(-1);
                     });

+ 2 - 2
src/main/vue/src/views/PackageEdit.vue

@@ -14,7 +14,7 @@
                 <PackageGoodsTable ref="setGoodsList" />
             </el-tab-pane> -->
         </el-tabs>
-        <el-form
+        <!-- <el-form
             :model="formData"
             ref="form"
             label-width="120px"
@@ -27,7 +27,7 @@
                 <el-button @click="onDelete" :loading="saving" type="danger" v-if="formData.id">删除 </el-button>
                 <el-button @click="$router.go(-1)">取消</el-button>
             </el-form-item>
-        </el-form>
+        </el-form> -->
     </div>
 </template>
 <script>