| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <?php
- use common\helpers\ComponentHelper;
- use common\helpers\AddonHelper;
- ComponentHelper::loadComponentView('coupon-select', AddonHelper::getAddonRootPath('Coupon') . 'backend/views/components');
- ComponentHelper::loadComponentView('form-diy-list', AddonHelper::getAddonRootPath('SmartForm') . 'backend/views/components/form');
- ?>
- <style>
- .flexcenter{
- display:flex;
- justify-content: center;
- }
- </style>
- <template id="com-smartform-goods">
- <div class="com-smartform-goods">
- <el-card class="edit-card" shadow="never">
- <div slot="header" class="clearfix">
- <div class="card-title">商品关联智能表单设置<span class="card-sub-title"></span></div>
- </div>
- <el-form :model="smartGoodForm" size="small" v-if="smartGoodForm">
- <div >
- <el-form-item label="开启表单关联商品" prop="is_relation">
- <el-switch :active-value="1" :inactive-value="0" v-model="smartGoodForm.is_relation"></el-switch>
- </el-form-item>
- <el-row :gutter="10" v-if="smartGoodForm.is_relation == 1">
- <el-form-item label="选择表单">
- <el-button type="primary" size="mini" @click="opensmartform">选择表单</el-button>
- </el-form-item>
- <el-form-item label="已选表单">
- <el-row :gutter="3">
- <el-col :span="3" >
- <form-diy-list v-for="(f,fi) in smartForm" :key="fi" :item="f" :index="fi" ></form-diy-list>
- </el-col>
- </el-row>
- </el-form-item>
- </el-row>
- </div>
- </el-form>
- </el-card>
- <!-- 弹窗 -->
- <el-dialog
- title="表单"
- :visible.sync="SmartFormdialog"
- width="30%"
- >
- <div>
- <el-table :data="smartFormList" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
- <el-table-column width="100px" label="" props="id" >
- <template slot-scope="props">
- <el-radio-group v-model="radioSelection" @change="handleSelectionChange(props.row)">
- <el-radio :label="props.row.id"></el-radio>
- </el-radio-group>
- </template>
- </el-table-column>
- <el-table-column prop="id" min-width="50" label="表单ID" align="center"></el-table-column>
- <el-table-column prop="title" min-width="50" label="表单名称" align="center"></el-table-column>
- </el-table>
- <div style="flexcenter">
- <el-button type="primary" size="mini" @click="SmartFormdialog = false">保存</el-button>
- </div>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- Vue.component('com-smartform-goods',{
- template: "#com-smartform-goods",
- props: {
- goods_id: {
- type: Number | String,
- default: 0
- }
- },
- data() {
- return {
- SmartFormdialog:false,
- loading:false,
- radioSelection:false,
- smartGoodForm: {
- is_relation:1,
- multiple_selection:[]
- },
- smartFormList:[],
- smartForm:[]
- }
- },
- watch: {
- // form:{
- // deep:true,
- // immediate: true,
- // handler(value){
- // this.$emit("select", {Redpack: this.form});
- // }
- // }
- },
- mounted: function() {
- this.getsmartFormConfig()
- this.getSmartFormList()
- // if (this.goods_id) this.redpack();
- },
- methods: {
- handleSelectionChange(row){
- console.log(row)
- this.smartForm = []
- this.smartForm.push(row)
- console.log('this.smartForm',this.smartForm)
- },
- opensmartform(){
- this.SmartFormdialog = true
- },
- getsmartFormConfig(){
- this.loading = true
- request({
- params: {
- r: 'smart-form/form-goods/info',
- goods_id:this.goods_id
- },
- method: 'get',
- data: { }
- }).then(res => {
- this.loading = false
- this.smartGoodForm.is_relation = res.data.data.status
- this.smartForm = []
- this.smartForm.push(res.data.data.template)
- })
- },
- handle(type){
-
- },
- getSmartFormList(){
- this.loading = true
- request({
- params: {
- r: 'smart-form/form/index',
- },
- method: 'get',
- data: { }
- }).then(res => {
- this.loading = false
- this.smartFormList.push(...res.data.data.list)
- })
- }
- }
- });
- </script>
|