shish 5 роки тому
батько
коміт
493b4b107b

+ 2 - 0
ghs/README.md

@@ -0,0 +1,2 @@
+说明文档
+https://admin.cool-js.com/front/crud/form.html#op-%E6%93%8D%E4%BD%9C%E6%A0%8F%E9%85%8D%E7%BD%AE

+ 2 - 0
hd/README.md

@@ -0,0 +1,2 @@
+说明文档
+https://admin.cool-js.com/front/crud/form.html#op-%E6%93%8D%E4%BD%9C%E6%A0%8F%E9%85%8D%E7%BD%AE

+ 6 - 1
hd/src/views/staff/list.vue

@@ -446,7 +446,12 @@ export default {
 				// })
 				.done();
 			app.refresh({ type: this.tabIndex });
-		}
+		},
+		resetForm(formName) {
+			let formNamed = formName || 'form';
+			this.$refs[formNamed].resetFields();
+			this.addDialog = false;
+		},
 	}
 };
 </script>

+ 1 - 1
hd/vue.config.js

@@ -61,7 +61,7 @@ module.exports = {
 
 	devServer: {
 		host: '127.0.0.1',
-		port: 7778,
+		port: 7777,
 		open: false,
 		compress: false,
 		overlay: {

+ 2 - 0
pt/README.md

@@ -0,0 +1,2 @@
+说明文档
+https://admin.cool-js.com/front/crud/form.html#op-%E6%93%8D%E4%BD%9C%E6%A0%8F%E9%85%8D%E7%BD%AE

+ 139 - 0
pt/src/components/module/sj-list-layer.vue

@@ -0,0 +1,139 @@
+<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>
+
+<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 });
+		}
+	}
+};
+</script>
+<style lang="scss">
+// 列表
+.radio-wrap {
+	display: block;
+}
+</style>

+ 4 - 5
pt/src/cool/request/index.js

@@ -1,7 +1,5 @@
 import Vue from 'vue';
 
-//不要在这里引入方法,请在各vue文件里按需引入方法!!!!!!!!!!!!!!!!!!!!!!
-
 import common from '@/service/common/index';
 import system from '@/service/system/index';
 import test from '@/service/test/index';
@@ -21,8 +19,6 @@ import setting from '@/service/setting/index';
 import workbench from '@/service/workbench/index';
 import auth from '@/service/auth/index';
 
-//不要在这里引入方法,请在各vue文件里按需引入方法!!!!!!!!!!!!!!!!!!!!!!
-
 import saasShop from '@/service/saas/shop/index';
 import saasOrder from '@/service/saas/order/index';
 import saasMember from '@/service/saas/member/index';
@@ -34,6 +30,8 @@ import saasWxOpen from '@/service/saas/wx-open/index';
 import shop from '@/service/shop/index';
 import chat from '@/service/chat/index';
 
+import sj from '@/service/sj/index';
+
 export function SET_SERVICE({ store }) {
 	// const files = require.context('@/service/', true, /\.js$/);
 	// const ignore = ['./request.js'];
@@ -65,7 +63,8 @@ export function SET_SERVICE({ store }) {
 		saasAuth,
 		saasWxOpen,
 		shop,
-		chat
+		chat,
+		sj
 	};
 
 	Vue.prototype.$service = modules;

+ 88 - 21
pt/src/saas/shop/list.vue

@@ -22,13 +22,13 @@
 				<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'">
+			</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>
+			</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>
@@ -36,7 +36,10 @@
 			</template>
 
 			<template #slot-op-btn="{scope}">
-				<el-button size="mini" type="text" @click="relateGhs(scope.row)">找供货商</el-button>
+				<el-button size="mini" type="text" @click="selGoods(scope.row.id)">绑供货商</el-button>
+			</template>
+			<template #slot-add-ad-btn="{scope}">
+				<el-button type="primary" size="mini" class="sj_add_button" @click="addBtnFn">添加</el-button>
 			</template>
 		</x-crud>
 		<!-- 微信支付 -->
@@ -87,14 +90,48 @@
 			</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>
+
+		<sj-list-layer
+			:show.sync="ghsModal"
+			@confirm="selGoodsConfirmFn"
+			@cancel="ghsModal = false"
+		></sj-list-layer>
+
 	</div>
 </template>
 
 <script>
 import { getFirstHost } from '@/cool/utils';
 import MerchantService from '@/service/merchant/index';
+import SjService from '@/service/sj/index';
+import sjListLayer from '@/components/module/sj-list-layer';
+import GhsService from '@/service/ghs/index';
 
 export default {
+	name:'sjList',
+	components: {
+		sjListLayer
+	},
 	data() {
 		return {
 			// x-crud
@@ -105,13 +142,33 @@ export default {
 			form: {},
 			rule: {},
 			wxOpen: { wx_mini_base_id: 0, wx_base_id: 0 },
-			firstHost:`${getFirstHost()}`
+			firstHost:`${getFirstHost()}`,
+			addDialog:false,
+			adForm: {
+				name: '',
+			},
+			ruleForm: {
+				name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
+			},
+			ghsModal:false,
+			selectSjId:0
 		};
 	},
 	mounted() {
 		this.getWxOpen();
 	},
 	methods: {
+		selGoodsConfirmFn(item) {
+
+			GhsService.bindGhs({sjId:this.selectSjId,ghsSjId:item.id}).then(res => {
+				this.$message.success('操作成功!');
+				this.ghsModal = false;
+			});
+		},
+		selGoods(id) {
+			this.selectSjId = id;
+			this.ghsModal = true;
+		},
 		wxPayConfigFn() {},
 		// 绑定跳转
 		bindJump(url) {
@@ -144,8 +201,8 @@ export default {
 							align: 'center'
 						},
 						{
-							prop: 'totalFans',
-							label: '粉丝',
+							prop: 'currentStyle',
+							label: '类型',
 							align: 'center'
 						},
 						{
@@ -181,8 +238,7 @@ export default {
 					}
 				})
 				.set('layout', [
-					// ['slot-tabs'],
-					['flex1', 'slot-activation', 'refresh-btn'],
+					['slot-activation','flex1', 'slot-add-ad-btn','refresh-btn'],
 					['data-table'],
 					['flex1', 'pagination']
 				])
@@ -192,7 +248,6 @@ export default {
 
 		payOption(type, data) {
 			this.plamPayType = type;
-			console.log(type);
 			this.$service.saasShop.merchantExtend({ id: data.id }).then(res => {
 				this.form = { ...res };
 				this.wxPayDialog = true;
@@ -238,18 +293,30 @@ export default {
 			let formNamed = formName || 'form';
 			this.$refs[formNamed].resetFields();
 			this.wxPayDialog = false;
+			this.addDialog=false;
 		},
-		getH5MallQrCode(id) {
-			MerchantService.getH5MallQrCode({ id: id }).then(res => {
-				this.$alert(
-					"<img src='" + res.imgUrl + "' style='width:200px;margin:0 auto;' />",
-					'H5商城',
-					{
-						dangerouslyUseHTMLString: true
-					}
-				);
+		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>

+ 15 - 0
pt/src/service/ghs/index.js

@@ -0,0 +1,15 @@
+import { BaseService, Service } from '@/cool';
+
+@Service('ghs')
+export class GhsService extends BaseService {
+
+	bindGhs(data) {
+		return this.request({
+			url: '/bind-ghs',
+			params: data
+		});
+	}
+
+}
+
+export default new GhsService();

+ 13 - 0
pt/src/service/sj/index.js

@@ -0,0 +1,13 @@
+import { BaseService, Service } from '@/cool';
+
+@Service('sj')
+export class SjService extends BaseService {
+	add(data) {
+		return this.request({
+			url: '/add',
+			params: data
+		});
+	}
+}
+
+export default new SjService();

+ 1 - 1
pt/vue.config.js

@@ -63,7 +63,7 @@ module.exports = {
 
 	devServer: {
 		host: '127.0.0.1',
-		port: 7779,
+		port: 7777,
 		open: false,
 		compress: false,
 		overlay: {