Browse Source

增加绑定供货商

wangn 5 years ago
parent
commit
a23d964460
2 changed files with 559 additions and 424 deletions
  1. 143 125
      pt/src/components/module/sj-list-layer.vue
  2. 416 299
      pt/src/saas/shop/list.vue

+ 143 - 125
pt/src/components/module/sj-list-layer.vue

@@ -1,134 +1,152 @@
 <template>
-	<el-dialog
-		title="选择商家"
-		:visible.sync="selDialog"
-		:close-on-click-modal="false"
-		:append-to-body="true"
-		width="800px"
-	>
-		<div class="recharge-modal-content">
-			<el-radio-group v-model="radio" class="radio-wrap">
-				<x-crud class="liu-crud-wrap" @load="onLoad">
-					<template #table-column-radio="{scope}">
-						<div><el-radio :label="scope.row.index">选择</el-radio></div>
-					</template>
+  <el-dialog
+    title="选择商家"
+    :visible.sync="selDialog"
+    :close-on-click-modal="false"
+    :append-to-body="true"
+    width="800px"
+  >
+    <div class="recharge-modal-content">
+      <el-radio-group
+        v-model="radio"
+        class="radio-wrap"
+      >
+        <x-crud
+          class="liu-crud-wrap"
+          @load="onLoad"
+        >
+          <template #table-column-radio="{scope}">
+            <div>
+              <el-radio :label="scope.row.index">选择</el-radio>
+            </div>
+          </template>
 
-					<template #table-column-imgUrl="{scope}">
-						<div>
-							<cl-avatar
-								shape="square"
-								:size="40"
-								:src="scope.row.imgUrl | default_avatar"
-								:style="{ margin: 'auto' }"
-							></cl-avatar>
-						</div>
-					</template>
-				</x-crud>
-			</el-radio-group>
-		</div>
-		<div slot="footer" class="dialog-footer">
-			<el-button size="small" @click="resetForm">取 消</el-button>
-			<el-button type="primary" size="small" @click="confirmFn">确定</el-button>
-		</div>
-	</el-dialog>
+          <template #table-column-imgUrl="{scope}">
+            <div>
+              <cl-avatar
+                shape="square"
+                :size="40"
+                :src="scope.row.imgUrl | default_avatar"
+                :style="{ margin: 'auto' }"
+              ></cl-avatar>
+            </div>
+          </template>
+        </x-crud>
+      </el-radio-group>
+    </div>
+    <div
+      slot="footer"
+      class="dialog-footer"
+    >
+      <el-button
+        size="small"
+        @click="resetForm"
+      >取 消</el-button>
+      <el-button
+        type="primary"
+        size="small"
+        @click="confirmFn"
+      >确定</el-button>
+    </div>
+  </el-dialog>
 </template>
 
 <script>
 export default {
-	name: 'sj-list-layer',
-	props: {
-		show: {
-			type: Boolean,
-			default: false
-		},
-		multi: {
-			type: Boolean,
-			default: false
-		}
-	},
-	data() {
-		return {
-			selDialog: false,
-			ruleForm: {},
-			radio: '',
-			list: [],
-			selData: {}
-		};
-	},
-	computed: {
-	},
-	watch: {
-		show(val) {
-			this.selDialog = val;
-		}
-	},
-	created() {},
-	methods: {
-		confirmFn() {
-			this.$emit('confirm', this.list[this.radio]);
-		},
-		resetForm() {
-			this.$emit('cancel');
-		},
-		onLoad({ ctx, app }) {
-			this.app = app;
-			ctx.service(this.$service.sj)
-				.set('table', {
-					columns: [
-						{
-							prop: 'radio',
-							label: '选择',
-							align: 'center',
-							'min-width': 60
-						},
-						{
-							prop: 'name',
-							label: '商家名称',
-							align: 'center'
-						},
-						{
-							prop: 'currentStyle',
-							label: '类型',
-							align: 'center'
-						}
-					],
-					// 操作列
-					op: {
-						visible: false // 是否显示
-					}
-				})
-				.set('dict', {
-					search: {
-						keyWord: 'name'
-					}
-				})
-				.set('search', {
-					key: {
-						placeholder: '商家名称,支持拼音首字母'
-					}
-				})
-				.set('pagination', {
-					size: 6
-				})
-				.set('layout', [
-					['slot-tabs'],
-					['search-key', 'flex1', 'refresh-btn'],
-					['data-table'],
-					['flex1', 'pagination']
-				])
-				.on('refresh', async (params, { next, render }) => {
-					// 继续执行刷新
-					let { list } = await next(params);
-					list.map((e, index) => {
-						e.index = index;
-					});
-					this.list = list;
-					render(list);
-				})
-				.done();
-			app.refresh({ type: this.tabIndex });
-		}
-	}
+  name: 'sj-list-layer',
+  props: {
+    show: {
+      type: Boolean,
+      default: false
+    },
+    multi: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      selDialog: false,
+      ruleForm: {},
+      radio: '',
+      list: [],
+      selData: {}
+    };
+  },
+  computed: {
+  },
+  watch: {
+    show (val) {
+      this.selDialog = val;
+    }
+  },
+  created () { },
+  methods: {
+    confirmFn () {
+      this.$emit('confirm', this.list[this.radio]);
+    },
+    resetForm () {
+      this.$emit('cancel');
+    },
+    onLoad ({ ctx, app }) {
+      this.app = app;
+      ctx.service(this.$service.sj)
+        .set('table', {
+          columns: [
+            {
+              prop: 'radio',
+              label: '选择',
+              align: 'center',
+              'min-width': 60
+            },
+            {
+              prop: 'name',
+              label: '商家名称',
+              align: 'center'
+            },
+            {
+              prop: 'currentStyle',
+              label: '类型',
+              align: 'center'
+            }
+          ],
+          // 操作列
+          op: {
+            visible: false // 是否显示
+          }
+        })
+        .set('dict', {
+          search: {
+            keyWord: 'name'
+          }
+        })
+        .set('search', {
+          key: {
+            placeholder: '商家名称,支持拼音首字母'
+          }
+        })
+        .set('pagination', {
+          size: 6
+        })
+        .set('layout', [
+          ['slot-tabs'],
+          ['search-key', 'flex1', 'refresh-btn'],
+          ['data-table'],
+          ['flex1', 'pagination']
+        ])
+        .on('refresh', async (params, { next, render }) => {
+          // 继续执行刷新
+          let { list } = await next(params);
+          list.map((e, index) => {
+            e.index = index;
+          });
+          this.list = list;
+          render(list);
+        })
+        .done();
+      app.refresh({ type: this.tabIndex });
+    }
+  }
 };
 </script>
 <style lang="scss">

+ 416 - 299
pt/src/saas/shop/list.vue

@@ -1,125 +1,239 @@
 <template>
-	<div class="app-list-content">
-		<x-crud class="liu-crud-wrap" @load="onLoad">
-			<!-- 粉丝 -->
-			<template #table-column-totalFans>
+  <div class="app-list-content">
+    <x-crud
+      class="liu-crud-wrap"
+      @load="onLoad"
+    >
+      <!-- 粉丝 -->
+      <template #table-column-totalFans>
 
-			</template>
+      </template>
 
-			<!-- 客户 -->
-			<template #table-column-totalUser="{scope}">
-				<span>{{ scope.row.totalUser }}</span>
-			</template>
+      <!-- 客户 -->
+      <template #table-column-totalUser="{scope}">
+        <span>{{ scope.row.totalUser }}</span>
+      </template>
 
-			<!-- 访问量 -->
-			<template #table-column-totalVisit="{scope}">
-				<span>{{ scope.row.totalView }}</span>
-			</template>
+      <!-- 访问量 -->
+      <template #table-column-totalVisit="{scope}">
+        <span>{{ scope.row.totalView }}</span>
+      </template>
 
-			<!-- 平台帐号激活 -->
-			<template #slot-activation>
-				<div v-if="firstHost == 'huaml.com' || firstHost == 'huahb.com' ">
-				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=hd&authType=1`)">花店公众号激活</el-button>
-				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=hd&authType=2`)">花店小程序激活</el-button>
-				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/bind-open?id=hd&actId=6`)">花店小程序体验码</el-button>
-			</div>
-			<div v-else-if="firstHost == 'theflorist.cn' || firstHost == 'zhhinc.com'">
-				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=mall&authType=1`)">商城公众号激活</el-button>
-				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=mall&authType=2`)">商城小程序激活</el-button>
-				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/bind-open?id=mall&actId=6`)">商城小程序体验码</el-button>
-			</div>
-			<div v-else>
-				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=ghs&authType=1`)">供货商公众号激活</el-button>
-				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/begin-auth?id=ghs&authType=2`)">供货商小程序激活</el-button>
-				<el-button type="primary" size="mini" @click="bindJump(`/wx-open/bind-open?id=ghs&actId=6`)">供货商小程序体验码</el-button>
-				</div>
-			</template>
+      <!-- 平台帐号激活 -->
+      <template #slot-activation>
+        <div v-if="firstHost == 'huaml.com' || firstHost == 'huahb.com' ">
+          <el-button
+            type="primary"
+            size="mini"
+            @click="bindJump(`/wx-open/begin-auth?id=hd&authType=1`)"
+          >花店公众号激活</el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            @click="bindJump(`/wx-open/begin-auth?id=hd&authType=2`)"
+          >花店小程序激活</el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            @click="bindJump(`/wx-open/bind-open?id=hd&actId=6`)"
+          >花店小程序体验码</el-button>
+        </div>
+        <div v-else-if="firstHost == 'theflorist.cn' || firstHost == 'zhhinc.com'">
+          <el-button
+            type="primary"
+            size="mini"
+            @click="bindJump(`/wx-open/begin-auth?id=mall&authType=1`)"
+          >商城公众号激活</el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            @click="bindJump(`/wx-open/begin-auth?id=mall&authType=2`)"
+          >商城小程序激活</el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            @click="bindJump(`/wx-open/bind-open?id=mall&actId=6`)"
+          >商城小程序体验码</el-button>
+        </div>
+        <div v-else>
+          <el-button
+            type="primary"
+            size="mini"
+            @click="bindJump(`/wx-open/begin-auth?id=ghs&authType=1`)"
+          >供货商公众号激活</el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            @click="bindJump(`/wx-open/begin-auth?id=ghs&authType=2`)"
+          >供货商小程序激活</el-button>
+          <el-button
+            type="primary"
+            size="mini"
+            @click="bindJump(`/wx-open/bind-open?id=ghs&actId=6`)"
+          >供货商小程序体验码</el-button>
+        </div>
+      </template>
 
-			<template #slot-op-btn="{scope}">
-					<el-button v-if="scope.row.style == 2" size="mini" type="text" @click="bindGhs(scope.row.id)">绑供货商</el-button>
-			</template>
+      <template #slot-op-btn="{scope}">
+        <el-button
+          v-if="scope.row.style == 2"
+          size="mini"
+          type="text"
+          @click="bindGhs(scope.row.id)"
+        >绑供货商</el-button>
+      </template>
 
-			<template #slot-add-ad-btn>
-				<el-button type="primary" size="mini" class="sj_add_button" @click="addBtnFn">添加</el-button>
-			</template>
-		</x-crud>
-		<!-- 微信支付 -->
-		<el-dialog
-			:title="dialogTitle"
-			:visible.sync="wxPayDialog"
-			:close-on-click-modal="false"
-			width="500px"
-		>
-			<div class="ad-modal-content">
-				<el-form
-					v-if="plamPayType === 1"
-					:model="form"
-					:rules="rule"
-					ref="form"
-					label-width="100px"
-					class="demo-form"
-				>
-					<el-form-item label="商户ID" prop="status">
-						<el-input v-model="form.wxPayMerchantId" placeholder="请输入商户ID" size="small"></el-input>
-					</el-form-item>
-					<el-form-item label="密钥" prop="remark">
-						<el-input type="textarea" v-model="form.wxPayKey"></el-input>
-					</el-form-item>
-				</el-form>
-				<el-form
-					v-if="plamPayType === 2"
-					:model="form"
-					:rules="rule"
-					ref="form"
-					label-width="100px"
-					class="demo-form"
-				>
-					<el-form-item label="商户ID" prop="status">
-						<el-input v-model="form.alipayPId" placeholder="请输入商户ID" size="small"></el-input>
-					</el-form-item>
-					<el-form-item label="商户私钥" prop="remark">
-						<el-input type="textarea" v-model="form.alipayKey"></el-input>
-					</el-form-item>
-					<el-form-item label="支付宝公钥" prop="remark">
-						<el-input type="textarea" v-model="form.alipayPublicKey"></el-input>
-					</el-form-item>
-				</el-form>
-			</div>
-			<div slot="footer" class="dialog-footer">
-				<el-button size="small" @click="resetForm('form')">取 消</el-button>
-				<el-button type="primary" size="small" @click="setPayConfirm">确认</el-button>
-			</div>
-		</el-dialog>
-		<!-- 支付宝支付 -->
+      <template #slot-add-ad-btn>
+        <el-button
+          type="primary"
+          size="mini"
+          class="sj_add_button"
+          @click="addBtnFn"
+        >添加</el-button>
+      </template>
+    </x-crud>
+    <!-- 微信支付 -->
+    <el-dialog
+      :title="dialogTitle"
+      :visible.sync="wxPayDialog"
+      :close-on-click-modal="false"
+      width="500px"
+    >
+      <div class="ad-modal-content">
+        <el-form
+          v-if="plamPayType === 1"
+          :model="form"
+          :rules="rule"
+          ref="form"
+          label-width="100px"
+          class="demo-form"
+        >
+          <el-form-item
+            label="商户ID"
+            prop="status"
+          >
+            <el-input
+              v-model="form.wxPayMerchantId"
+              placeholder="请输入商户ID"
+              size="small"
+            ></el-input>
+          </el-form-item>
+          <el-form-item
+            label="密钥"
+            prop="remark"
+          >
+            <el-input
+              type="textarea"
+              v-model="form.wxPayKey"
+            ></el-input>
+          </el-form-item>
+        </el-form>
+        <el-form
+          v-if="plamPayType === 2"
+          :model="form"
+          :rules="rule"
+          ref="form"
+          label-width="100px"
+          class="demo-form"
+        >
+          <el-form-item
+            label="商户ID"
+            prop="status"
+          >
+            <el-input
+              v-model="form.alipayPId"
+              placeholder="请输入商户ID"
+              size="small"
+            ></el-input>
+          </el-form-item>
+          <el-form-item
+            label="商户私钥"
+            prop="remark"
+          >
+            <el-input
+              type="textarea"
+              v-model="form.alipayKey"
+            ></el-input>
+          </el-form-item>
+          <el-form-item
+            label="支付宝公钥"
+            prop="remark"
+          >
+            <el-input
+              type="textarea"
+              v-model="form.alipayPublicKey"
+            ></el-input>
+          </el-form-item>
+        </el-form>
+      </div>
+      <div
+        slot="footer"
+        class="dialog-footer"
+      >
+        <el-button
+          size="small"
+          @click="resetForm('form')"
+        >取 消</el-button>
+        <el-button
+          type="primary"
+          size="small"
+          @click="setPayConfirm"
+        >确认</el-button>
+      </div>
+    </el-dialog>
+    <!-- 支付宝支付 -->
 
-		<!-- 新增弹窗 -->
-		<el-dialog
-			title="添加"
-			:visible.sync="addDialog"
-			:close-on-click-modal="false"
-			width="600px"
-		>
-			<div class="ad-modal-content">
-				<el-form :model="adForm" :rules="ruleForm" ref="adForm" label-width="100px" class="demo-form">
-					<el-form-item label="名称" prop="name">
-						<el-input v-model="adForm.name" placeholder="请输入商家名称,将生成昆明供货商" size="small"></el-input>
-					</el-form-item>
-				</el-form>
-				
-			</div>
-			<div slot="footer" class="dialog-footer">
-				<el-button size="small" @click="resetForm('adForm')">取 消</el-button>
-				<el-button type="primary" size="small" @click="submitForm('adForm')">确认</el-button>
-			</div>
-		</el-dialog>
+    <!-- 新增弹窗 -->
+    <el-dialog
+      title="添加"
+      :visible.sync="addDialog"
+      :close-on-click-modal="false"
+      width="600px"
+    >
+      <div class="ad-modal-content">
+        <el-form
+          :model="adForm"
+          :rules="ruleForm"
+          ref="adForm"
+          label-width="100px"
+          class="demo-form"
+        >
+          <el-form-item
+            label="名称"
+            prop="name"
+          >
+            <el-input
+              v-model="adForm.name"
+              placeholder="请输入商家名称,将生成昆明供货商"
+              size="small"
+            ></el-input>
+          </el-form-item>
+        </el-form>
 
-		<sj-list-layer
-			:show.sync="ghsModal"
-			@confirm="selGoodsConfirmFn"
-			@cancel="ghsModal = false"
-		></sj-list-layer>
+      </div>
+      <div
+        slot="footer"
+        class="dialog-footer"
+      >
+        <el-button
+          size="small"
+          @click="resetForm('adForm')"
+        >取 消</el-button>
+        <el-button
+          type="primary"
+          size="small"
+          @click="submitForm('adForm')"
+        >确认</el-button>
+      </div>
+    </el-dialog>
 
-	</div>
+    <sj-list-layer
+      :show.sync="ghsModal"
+      @confirm="bindGhsConfirmFn"
+      @cancel="ghsModal = false"
+    ></sj-list-layer>
+
+  </div>
 </template>
 
 <script>
@@ -130,196 +244,199 @@ import sjListLayer from '@/components/module/sj-list-layer';
 import GhsService from '@/service/ghs/index';
 
 export default {
-	name:'sjList',
-	components: {
-		sjListLayer
-	},
-	data() {
-		return {
-			// x-crud
-			app: null,
-			wxPayDialog: false,
-			dialogTitle: '',
-			plamPayType: 1,
-			form: {},
-			rule: {},
-			wxOpen: { wx_mini_base_id: 0, wx_base_id: 0 },
-			firstHost:`${getFirstHost()}`,
-			addDialog:false,
-			adForm: {
-				name: '',
-			},
-			ruleForm: {
-				name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
-			},
-			ghsModal:false,
-			selectSjId:0
-		};
-	},
-	mounted() {
-		this.getWxOpen();
-	},
-	methods: {
-		bindGhsConfirmFn(item) {
+  name: 'sjList',
+  components: {
+    sjListLayer
+  },
+  data () {
+    return {
+      // x-crud
+      app: null,
+      wxPayDialog: false,
+      dialogTitle: '',
+      plamPayType: 1,
+      form: {},
+      rule: {},
+      wxOpen: { wx_mini_base_id: 0, wx_base_id: 0 },
+      firstHost: `${getFirstHost()}`,
+      addDialog: false,
+      adForm: {
+        name: '',
+      },
+      ruleForm: {
+        name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
+      },
+      ghsModal: false,
+      selectSjId: 0
+    };
+  },
+  mounted () {
+    this.getWxOpen();
+  },
+  methods: {
+    bindGhsConfirmFn (item) {
 
-			GhsService.bindGhs({sjId:this.selectSjId,ghsSjId:item.id}).then(res => {
-				this.$message.success('操作成功!');
-				this.ghsModal = false;
-			});
-		},
-		bindGhs(id) {
-			this.selectSjId = id;
-			this.ghsModal = true;
-		},
-		wxPayConfigFn() {},
-		// 绑定跳转
-		bindJump(url) {
-			let host = `http://api.pt.${getFirstHost()}`;
-			window.open(host + url);
-		},
-		getWxOpen() {
-			this.wxOpen = this.$service.saasWxOpen.getWxOpen();
-		},
-		// crud
-		onLoad({ ctx, app }) {
-			this.app = app;
-			let applyHost = () => {
-				return this.$service.saasShop.merchantList();
-			};
+      GhsService.bindGhs({ sjId: this.selectSjId, ghsSjId: item.id }).then(res => {
+        this.$message.success('操作成功!');
+        this.ghsModal = false;
+      });
+    },
+    bindGhs (id) {
+      this.selectSjId = id;
+      this.ghsModal = true;
+    },
+    wxPayConfigFn () { },
+    // 绑定跳转
+    bindJump (url) {
+      let host = `http://api.pt.${getFirstHost()}`;
+      window.open(host + url);
+    },
+    getWxOpen () {
+      this.wxOpen = this.$service.saasWxOpen.getWxOpen();
+    },
+    selGoodsConfirmFn (val) {
+      console.log(val)
+    },
+    // crud
+    onLoad ({ ctx, app }) {
+      this.app = app;
+      let applyHost = () => {
+        return this.$service.saasShop.merchantList();
+      };
 
-			ctx.service({
-				page: applyHost
-			})
-				.set('table', {
-					columns: [
-						{
-							prop: 'id',
-							label: 'ID',
-							align: 'center'
-						},
-						{
-							prop: 'name',
-							label: '名称',
-							align: 'center'
-						},
-						{
-							prop: 'currentStyle',
-							label: '类型',
-							align: 'center'
-						},
-						{
-							prop: 'totalUser',
-							label: '客户',
-							align: 'center'
-						},
-						{
-							prop: 'totalIncome',
-							label: '收入',
-							align: 'center',
-							emptyText: '无'
-						},
-						{
-							prop: 'totalVisit',
-							label: '访问量',
-							align: 'center'
-						},
-						{
-							prop: 'setName',
-							label: '套餐',
-							align: 'center'
-						},
-						{
-							prop: 'status',
-							label: '状态',
-							align: 'center'
-						}
-					],
-					// 操作列
-					op: {
-						layout: ['slot-op-btn']
-					}
-				})
-				.set('layout', [
-					['slot-activation','flex1', 'slot-add-ad-btn','refresh-btn'],
-					['data-table'],
-					['flex1', 'pagination']
-				])
-				.done();
-			app.refresh();
-		},
+      ctx.service({
+        page: applyHost
+      })
+        .set('table', {
+          columns: [
+            {
+              prop: 'id',
+              label: 'ID',
+              align: 'center'
+            },
+            {
+              prop: 'name',
+              label: '名称',
+              align: 'center'
+            },
+            {
+              prop: 'currentStyle',
+              label: '类型',
+              align: 'center'
+            },
+            {
+              prop: 'totalUser',
+              label: '客户',
+              align: 'center'
+            },
+            {
+              prop: 'totalIncome',
+              label: '收入',
+              align: 'center',
+              emptyText: '无'
+            },
+            {
+              prop: 'totalVisit',
+              label: '访问量',
+              align: 'center'
+            },
+            {
+              prop: 'setName',
+              label: '套餐',
+              align: 'center'
+            },
+            {
+              prop: 'status',
+              label: '状态',
+              align: 'center'
+            }
+          ],
+          // 操作列
+          op: {
+            layout: ['slot-op-btn']
+          }
+        })
+        .set('layout', [
+          ['slot-activation', 'flex1', 'slot-add-ad-btn', 'refresh-btn'],
+          ['data-table'],
+          ['flex1', 'pagination']
+        ])
+        .done();
+      app.refresh();
+    },
 
-		payOption(type, data) {
-			this.plamPayType = type;
-			this.$service.saasShop.merchantExtend({ id: data.id }).then(res => {
-				this.form = { ...res };
-				this.wxPayDialog = true;
-				switch (type) {
-					case 1: //微信
-						this.dialogTitle = '微信支付设置';
-						break;
-					case 2: //支付宝
-						this.dialogTitle = '支付宝支付设置';
-						break;
-				}
-			});
-		},
-		setPayConfirm() {
-			let plamPayType = this.plamPayType;
-			switch (plamPayType) {
-				case 1: //微信
-					var data = {
-						merchantId: this.form.merchantId,
-						wxPayMerchantId: this.form.wxPayMerchantId,
-						wxPayKey: this.form.wxPayKey
-					};
-					this.$service.saasShop.setWxPay(data).then(res => {
-						this.resetForm();
-						this.$message('成功');
-					});
-					break;
-				case 2: //支付宝
-					var data = {
-						merchantId: this.form.merchantId,
-						alipayPId: this.form.alipayPId,
-						alipayKey: this.form.alipayKey,
-						alipayPublicKey: this.form.alipayPublicKey
-					};
-					this.$service.saasShop.setAlipa(data).then(res => {
-						this.resetForm();
-						this.$message('成功');
-					});
-					break;
-			}
-		},
-		resetForm(formName) {
-			let formNamed = formName || 'form';
-			this.$refs[formNamed].resetFields();
-			this.wxPayDialog = false;
-			this.addDialog=false;
-		},
-		addBtnFn() {
-			this.addDialog = true;
-		},
-		submitForm(formName) {
-			this.$refs[formName].validate(valid => {
-				if (valid) {
-					this.addFn(formName);
-				} else {
-					console.log('error submit!!');
-					return false;
-				}
-			});
-		},
-		addFn(formName) {
-			let adForm = JSON.parse(JSON.stringify(this.adForm));
-			SjService.add(adForm).then(res => {
-				this.$message.success('操作成功!');
-				this.app.refresh();
-				this.resetForm(formName);
-				this.addDialog=false;
-			});
-		},
-	}
+    payOption (type, data) {
+      this.plamPayType = type;
+      this.$service.saasShop.merchantExtend({ id: data.id }).then(res => {
+        this.form = { ...res };
+        this.wxPayDialog = true;
+        switch (type) {
+          case 1: //微信
+            this.dialogTitle = '微信支付设置';
+            break;
+          case 2: //支付宝
+            this.dialogTitle = '支付宝支付设置';
+            break;
+        }
+      });
+    },
+    setPayConfirm () {
+      let plamPayType = this.plamPayType;
+      switch (plamPayType) {
+        case 1: //微信
+          var data = {
+            merchantId: this.form.merchantId,
+            wxPayMerchantId: this.form.wxPayMerchantId,
+            wxPayKey: this.form.wxPayKey
+          };
+          this.$service.saasShop.setWxPay(data).then(res => {
+            this.resetForm();
+            this.$message('成功');
+          });
+          break;
+        case 2: //支付宝
+          var data = {
+            merchantId: this.form.merchantId,
+            alipayPId: this.form.alipayPId,
+            alipayKey: this.form.alipayKey,
+            alipayPublicKey: this.form.alipayPublicKey
+          };
+          this.$service.saasShop.setAlipa(data).then(res => {
+            this.resetForm();
+            this.$message('成功');
+          });
+          break;
+      }
+    },
+    resetForm (formName) {
+      let formNamed = formName || 'form';
+      this.$refs[formNamed].resetFields();
+      this.wxPayDialog = false;
+      this.addDialog = false;
+    },
+    addBtnFn () {
+      this.addDialog = true;
+    },
+    submitForm (formName) {
+      this.$refs[formName].validate(valid => {
+        if (valid) {
+          this.addFn(formName);
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    addFn (formName) {
+      let adForm = JSON.parse(JSON.stringify(this.adForm));
+      SjService.add(adForm).then(res => {
+        this.$message.success('操作成功!');
+        this.app.refresh();
+        this.resetForm(formName);
+        this.addDialog = false;
+      });
+    },
+  }
 };
 </script>
 <style lang="scss">