Browse Source

单个门店改为列表与配置新增uni页面配置

master
hupeng 5 years ago
parent
commit
d9a07a67c0
  1. 16
      src/api/yxSystemStore.js
  2. 2
      src/settings.js
  3. 105
      src/views/dashboard/YshopInfo.vue
  4. 11
      src/views/shop/set/form.vue
  5. 4
      src/views/shop/set/index.vue
  6. 4
      src/views/shop/set/menu.vue
  7. 9
      src/views/shop/set/menuform.vue
  8. 131
      src/views/shop/set/recharge.vue
  9. 110
      src/views/shop/set/rechargeform.vue
  10. 4
      src/views/shop/set/roll.vue
  11. 9
      src/views/shop/set/rollform.vue
  12. 4
      src/views/shop/set/usermenu.vue
  13. 9
      src/views/shop/set/usermenuform.vue
  14. 149
      src/views/shop/store/index.vue
  15. 171
      src/views/shop/store/indexbak.vue

16
src/api/yxSystemStore.js

@ -1,12 +1,20 @@
import request from '@/utils/request'
export function get() {
export function add(data) {
return request({
url: 'api/yxSystemStore',
method: 'get'
method: 'post',
data
})
}
// export function get() {
// return request({
// url: 'api/yxSystemStore',
// method: 'get'
// })
// }
export function getL(data) {
return request({
url: 'api/yxSystemStore/getL',
@ -23,7 +31,7 @@ export function del(ids) {
})
}
export function update(data) {
export function edit(data) {
return request({
url: 'api/yxSystemStore',
method: 'put',
@ -31,4 +39,4 @@ export function update(data) {
})
}
export default { get, getL, update, del }
export default { getL, add, edit, del }

2
src/settings.js

@ -2,7 +2,7 @@ module.exports = {
/**
* @description 网站标题
*/
title: 'YSHOP-2.0',
title: 'YSHOP-2.1',
/**
* @description 是否显示 tagsView
*/

105
src/views/dashboard/YshopInfo.vue

@ -87,121 +87,148 @@
<span style="font-weight: bolder">更新日志</span>
</div>
<div class="text item">
<span style="font-weight: bolder">2020-03-07yshop2.0版本 发布更新如下</span>
<span style="font-weight: bolder">预计4月发布yshop2.1版本 更新如下</span>
</div>
<div class="text item">
1优化代码结构与名称修改get请求参数其统一继承分页参数
1单门店升级为多门店
</div>
<div class="text item">
2新增redis监听未付款30分钟取消功能与7天自动收货功能mq队列作为备选(注释掉)
2充值增加充值方案
</div>
<div class="text item">
3新增门店到店核销功能
3打通小程序与公众号账号
</div>
<div class="text item">
4新增分销全局开关#I19HB1
4新增微信app支付主要用于uniapp
</div>
<div class="text item">
5积分新增消费限制#I19TUR
5修复
</div>
<div class="text item">
6新增充值功能#I18V5D
<span style="font-weight: bolder">2020-03-152.0.X修复优化版本 发布更新如下</span>
</div>
<div class="text item">
7后台菜单调整新增财务模块
1修复后台上传图片点击图片预览关闭按钮不显示的问题#I1B8RB
</div>
<div class="text item">
8优化后台配置赋值写法
2后台新增物流快递查询
</div>
<div class="text item">
9修复管理后台新增表单之后如果直接再新增数据导致默认数据缺失问题#I1AFBK
3修复后台不能一次删除多个商品分类且优化删除分类#I1BASM
</div>
<div class="text item">
10修复提交购物车可能查询多条数据的问题
4修复商品管理/管理商品/待上架产品删除问题#I1B9O7
</div>
<div class="text item">
11后台登陆背景图固定#I1A0LS
5微信支付新增小程序渠道,修复小程序与其他支付appid冲突问题后台微信支付配置移除appid选项
</div>
<div class="text item">
12增加常量与枚举优化硬编码问题
6后台微信菜单与自动回复显示字体调整
</div>
<div class="text item">
13微信支付公众号模板消息修改
7后台订单列表修改为状态栏展示
</div>
<div class="text item">
14修复代码生成器不全的问题#I1AIO4
8微信授权与小程序授权优化及其确认订单优化
</div>
<div class="text item">
15修复营销产品拼团等轮播图不能修改的问题#I1AHXR
9新增公众号获取微信地址权限
</div>
<div class="text item">
16移除yshop-monitor模块
10修复打开图片素材库的标红警告#I1BLJM
</div>
<div class="text item">
17修复退货理由文字错误#I1AQ7D
11修复后台订单详情时间显示不对的问题#I1BLV6
</div>
<div class="text item">
18修复新增分类的图片自动显示上次一次的图片#I1AQBK
12修复提交订单页面选取优惠时显示优惠券有效期错乱#I1BHA1
</div>
<div class="text item">
19新增微信jssdk接口返回所需js权限
13修复PC端图片素材删除分组标红警告 #I1BNII
</div>
<div class="text item">
20新增余额充值变动模板消息通知
14小程序增加下拉刷新功能#I1AHAX
</div>
<div class="text item">
21首页数据缓存优化
15修复小程序首页--促销单品--更多 报错#I1AA47
</div>
<div class="text item">
22新增未支付订单显示到期时间
<span style="font-weight: bolder">2020-03-07yshop2.0版本 发布更新如下</span>
</div>
<div class="text item">
23修复加入购物车购买后后台订单中的商品信息数据重复#I1AXNX
1优化代码结构与名称修改get请求参数其统一继承分页参数
</div>
<div class="text item">
24修复后台-管理商品-规格属性 属性无法删除问题#I1AYL2
2新增redis监听未付款30分钟取消功能与7天自动收货功能mq队列作为备选(注释掉)
</div>
<div class="text item">
25修复公众号商品直接微信分享标题不显示的问题#I1AX0R
3新增门店到店核销功能
</div>
<div class="text item">
4新增分销全局开关#I19HB1
</div>
<div class="text item">
5积分新增消费限制#I19TUR
</div>
<div class="text item">
<span style="font-weight: bolder">2020-02-24yshop修复优化版本 发布更新如下</span>
6新增充值功能#I18V5D
</div>
<div class="text item">
1.修复小程序积分支付功能#I1A03I
7后台菜单调整新增财务模块
</div>
<div class="text item">
2.修复小程序砍价功能上面时间没有进行倒计时#I1A037
8优化后台配置赋值写法
</div>
<div class="text item">
3.优化小程序底层导航栏适配ios#I1A1QX
9修复管理后台新增表单之后如果直接再新增数据导致默认数据缺失问题#I1AFBK
</div>
<div class="text item">
4.修复小程序返回的问题#I1A036
10修复提交购物车可能查询多条数据的问题
</div>
<div class="text item">
11后台登陆背景图固定#I1A0LS
</div>
<div class="text item">
5.修复小程序地址管理#I1A03U
12增加常量与枚举优化硬编码问题
</div>
<div class="text item">
6.调整小程序首页样式修改与H5保持同步
13微信支付公众号模板消息修改
</div>
<div class="text item">
7.H5首页数据加载顺序调整
14修复代码生成器不全的问题#I1AIO4
</div>
<div class="text item">
<span style="font-weight: bolder">2020-02-20yshop1.9.10版本 发布更新如下</span>
15修复营销产品拼团等轮播图不能修改的问题#I1AHXR
</div>
<div class="text item">
1.小程序新增了商品详情海报功能
16移除yshop-monitor模块
</div>
<div class="text item">
2.小程序新增了手机号绑定功能
17修复退货理由文字错误#I1AQ7D
</div>
<div class="text item">
3.修复小程序选择规格的问题#I19PD7
18修复新增分类的图片自动显示上次一次的图片#I1AQBK
</div>
<div class="text item">
4.修改移动端二维码海报生成拆分为H5端与小程序端
19新增微信jssdk接口返回所需js权限
</div>
<div class="text item">
20新增余额充值变动模板消息通知
</div>
<div class="text item">
21首页数据缓存优化
</div>
<div class="text item">
22新增未支付订单显示到期时间
</div>
<div class="text item">
23修复加入购物车购买后后台订单中的商品信息数据重复#I1AXNX
</div>
<div class="text item">
24修复后台-管理商品-规格属性 属性无法删除问题#I1AYL2
</div>
<div class="text item">
25修复公众号商品直接微信分享标题不显示的问题#I1AX0R
</div>
</el-card>
</div>

11
src/views/shop/set/form.vue

@ -1,15 +1,18 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="140px">
<el-form-item label="标题">
<el-input v-model="form.name" style="width: 300px;" />
</el-form-item>
<el-form-item label="跳转url">
<el-form-item label="H5跳转url">
<el-input v-model="form.url" style="width: 300px;" />
</el-form-item>
<el-form-item label="小程序跳转page">
<el-form-item label="mpvue小程序路由">
<el-input v-model="form.wxapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="uniapp路由">
<el-input v-model="form.uniapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="图片(750*375)">
<MaterialList v-model="form.imageArr" style="width: 300px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
@ -50,6 +53,7 @@ export default {
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,
@ -115,6 +119,7 @@ export default {
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,

4
src/views/shop/set/index.vue

@ -21,7 +21,8 @@
<el-table-column prop="id" label="ID" />
<el-table-column prop="map.name" label="标题" />
<el-table-column prop="map.url" label="链接url" />
<el-table-column prop="map.wxapp_url" label="小程序跳转page" />
<el-table-column prop="map.wxapp_url" label="mpvue小程序路由" width="140" />
<el-table-column prop="map.uniapp_url" label="uniapp路由" />
<el-table-column ref="table" label="图片">
<template slot-scope="scope">
<a :href="scope.row.map.pic" style="color: #42b983" target="_blank"><img :src="scope.row.map.pic" alt="点击打开" class="el-avatar"></a>
@ -124,6 +125,7 @@ export default {
name: data.map.name,
url: data.map.url,
wxapp_url: data.map.wxapp_url,
uniapp_url: data.map.uniapp_url,
pic: data.map.pic,
imageArr: data.map.pic ? data.map.pic.split(',') : [],
sort: data.sort,

4
src/views/shop/set/menu.vue

@ -21,7 +21,8 @@
<el-table-column prop="id" label="ID" />
<el-table-column prop="map.name" label="分类名称" />
<el-table-column prop="map.url" label="链接url" />
<el-table-column prop="map.wxapp_url" label="小程序跳转page" />
<el-table-column prop="map.wxapp_url" label="mpvue小程序路由" width="140" />
<el-table-column prop="map.uniapp_url" label="uniapp路由" />
<el-table-column ref="table" label="分类图标">
<template slot-scope="scope">
<a :href="scope.row.map.pic" style="color: #42b983" target="_blank"><img :src="scope.row.map.pic" alt="点击打开" class="el-avatar"></a>
@ -124,6 +125,7 @@ export default {
name: data.map.name,
url: data.map.url,
wxapp_url: data.map.wxapp_url,
uniapp_url: data.map.uniapp_url,
pic: data.map.pic,
imageArr: data.map.pic ? data.map.pic.split(',') : [],
sort: data.sort,

9
src/views/shop/set/menuform.vue

@ -1,15 +1,18 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="140px">
<el-form-item label="分类名称">
<el-input v-model="form.name" style="width: 300px;" />
</el-form-item>
<el-form-item label="跳转url">
<el-input v-model="form.url" style="width: 300px;" />
</el-form-item>
<el-form-item label="小程序跳转page">
<el-form-item label="mpvue小程序路由">
<el-input v-model="form.wxapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="uniapp路由">
<el-input v-model="form.uniapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="分类图标(90*90)">
<MaterialList v-model="form.imageArr" style="width: 300px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
@ -50,6 +53,7 @@ export default {
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,
@ -115,6 +119,7 @@ export default {
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,

131
src/views/shop/set/recharge.vue

@ -0,0 +1,131 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add"
>新增</el-button>
</div>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd" />
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="ID" />
<el-table-column prop="map.price" label="额度" />
<el-table-column prop="map.give_price" label="赠送" />
<el-table-column prop="sort" label="排序" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.status === 1" style="cursor: pointer" :type="''">显示</el-tag>
<el-tag v-else style="cursor: pointer" :type=" 'info' ">不显示</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" />
<el-popover
:ref="scope.row.id"
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE']"
placement="top"
width="180"
>
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini" />
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"
/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del } from '@/api/yxSystemGroupData'
import eForm from './rechargeform'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'api/yxSystemGroupData'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'recharge_price_ways' }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
groupName: data.groupName,
day: data.map.day,
sign_num: data.map.sign_num,
sort: data.sort,
status: data.status
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>

110
src/views/shop/set/rechargeform.vue

@ -0,0 +1,110 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px">
<el-form-item label="额度">
<el-input v-model="form.price" style="width: 300px;" />
</el-form-item>
<el-form-item label="赠送">
<el-input v-model="form.give_price" style="width: 300px;" />
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 300px;" />
</el-form-item>
<el-form-item label="是否显示">
<el-radio v-model="form.status" :label="1"></el-radio>
<el-radio v-model="form.status" :label="0" style="width: 200px;"></el-radio>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<!--<el-input v-model="form.groupName" />-->
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/yxSystemGroupData'
import picUpload from '@/components/pic-upload'
export default {
components: { picUpload },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
groupName: 'recharge_price_ways',
price: 1,
give_price: 0,
sort: 0,
status: 1
},
rules: {
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
groupName: 'recharge_price_ways',
price: 1,
give_price: 0,
sort: 0,
status: 1
}
}
}
}
</script>
<style scoped>
</style>

4
src/views/shop/set/roll.vue

@ -21,7 +21,8 @@
<el-table-column prop="id" label="ID" />
<el-table-column prop="map.info" label="滚动文字" />
<el-table-column prop="map.url" label="链接url" />
<el-table-column prop="map.wxapp_url" label="小程序跳转page" />
<el-table-column prop="map.wxapp_url" label="mpvue小程序路由" width="140" />
<el-table-column prop="map.uniapp_url" label="uniapp路由" />
<el-table-column prop="sort" label="排序" />
<el-table-column label="状态" align="center">
<template slot-scope="scope">
@ -120,6 +121,7 @@ export default {
info: data.map.info,
url: data.map.url,
wxapp_url: data.map.wxapp_url,
uniapp_url: data.map.uniapp_url,
pic: data.map.pic,
sort: data.sort,
status: data.status

9
src/views/shop/set/rollform.vue

@ -1,15 +1,18 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="140px">
<el-form-item label="滚动文字">
<el-input v-model="form.info" style="width: 300px;" />
</el-form-item>
<el-form-item label="跳转url">
<el-input v-model="form.url" style="width: 300px;" />
</el-form-item>
<el-form-item label="小程序跳转page">
<el-form-item label="mpvue小程序路由">
<el-input v-model="form.wxapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="uniapp路由">
<el-input v-model="form.uniapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="排序">
<el-input v-model="form.sort" style="width: 300px;" />
</el-form-item>
@ -45,6 +48,7 @@ export default {
groupName: 'routine_home_roll_news',
info: '',
wxapp_url: '',
uniapp_url: '',
url: '',
sort: 0,
status: 1
@ -101,6 +105,7 @@ export default {
groupName: 'routine_home_roll_news',
info: '',
wxapp_url: '',
uniapp_url: '',
url: '',
sort: 0,
status: 1

4
src/views/shop/set/usermenu.vue

@ -21,7 +21,8 @@
<el-table-column prop="id" label="ID" />
<el-table-column prop="map.name" label="菜单名" />
<el-table-column prop="map.url" label="链接url" />
<el-table-column prop="map.wxapp_url" label="小程序跳转page" />
<el-table-column prop="map.wxapp_url" label="mpvue小程序路由" width="140" />
<el-table-column prop="map.uniapp_url" label="uniapp路由" />
<el-table-column ref="table" label="图标">
<template slot-scope="scope">
<a :href="scope.row.map.pic" style="color: #42b983" target="_blank">
@ -126,6 +127,7 @@ export default {
name: data.map.name,
url: data.map.url,
wxapp_url: data.map.wxapp_url,
uniapp_url: data.map.uniapp_url,
pic: data.map.pic,
imageArr: data.map.pic ? data.map.pic.split(',') : [],
sort: data.sort,

9
src/views/shop/set/usermenuform.vue

@ -1,15 +1,18 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="140px">
<el-form-item label="菜单名">
<el-input v-model="form.name" style="width: 300px;" />
</el-form-item>
<el-form-item label="跳转url">
<el-input v-model="form.url" style="width: 300px;" />
</el-form-item>
<el-form-item label="小程序跳转page">
<el-form-item label="mpvue小程序路由">
<el-input v-model="form.wxapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="uniapp路由">
<el-input v-model="form.uniapp_url" style="width: 300px;" />
</el-form-item>
<el-form-item label="图标(52*52)">
<MaterialList v-model="form.imageArr" style="width: 300px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
@ -50,6 +53,7 @@ export default {
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,
@ -115,6 +119,7 @@ export default {
name: '',
url: '',
wxapp_url: '',
uniapp_url: '',
pic: '',
imageArr: [],
sort: 0,

149
src/views/shop/store/index.vue

@ -2,7 +2,11 @@
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="门店名称" prop="name">
<el-input v-model="form.name" style="width: 370px;" />
</el-form-item>
@ -14,16 +18,16 @@
</el-form-item>
<el-form-item label="门店地址" prop="address">
<el-input v-model="form.address" style="width: 370px;" />
<el-button :loading="loading" size="medium" type="primary" @click="getL(form.address)">获取经纬度</el-button>
<el-button size="medium" type="primary" @click="getL(form.address)">获取经纬度</el-button>
</el-form-item>
<el-form-item label="门店logo" prop="image">
<MaterialList v-model="form.imageArr" style="width: 370px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
<el-form-item label="纬度" prop="latitude">
<el-input v-model="form.latitude" :disabled="true" style="width: 370px;" />
<el-input v-model="form.latitude" style="width: 370px;" :disabled="true" />
</el-form-item>
<el-form-item label="经度" prop="longitude">
<el-input v-model="form.longitude" :disabled="true" style="width: 370px;" />
<el-input v-model="form.longitude" style="width: 370px;" :disabled="true" />
</el-form-item>
<el-form-item label="核销时效" prop="validTime">
<el-date-picker
@ -48,28 +52,80 @@
placeholder="选择时间范围">
</el-time-picker>
</el-form-item>
<el-form-item label="">
<el-button :loading="loading" size="medium" type="primary" @click="doSubmit">保存配置</el-button>
<el-form-item label="是否显示" prop="isShow">
<el-radio-group v-model="form.isShow" style="width: 178px">
<el-radio :label="1">显示</el-radio>
<el-radio :label="0">隐藏</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column v-if="columns.visible('id')" prop="id" label="id" width="50" />
<el-table-column v-if="columns.visible('name')" prop="name" label="门店名称" />
<el-table-column v-if="columns.visible('phone')" prop="phone" label="门店电话" />
<el-table-column v-if="columns.visible('address')" prop="address" label="地址" />
<el-table-column v-if="columns.visible('image')" prop="image" label="门店logo" >
<template slot-scope="scope">
<a :href="scope.row.image" style="color: #42b983" target="_blank"><img :src="scope.row.image" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('validTime')" prop="validTime" label="核销有效日期" />
<el-table-column v-if="columns.visible('dayTime')" prop="dayTime" label="营业时间" />
<el-table-column v-if="columns.visible('isShow')" prop="isShow" label="是否显示" >
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.isShow === 1" :type="''">显示</el-tag>
<el-tag v-else :type=" 'info' ">隐藏</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-permission="['admin','yxSystemStore:edit','yxSystemStore:del']" label="操作" width="150px" align="center">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import { get, update, getL } from '@/api/yxSystemStore'
import crudYxSystemStore from '@/api/yxSystemStore'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import MaterialList from '@/components/material'
import { parseTime } from '@/utils/index'
// crudpresenter
const defaultCrud = CRUD({ title: '门店', url: 'api/yxSystemStore', sort: 'id,desc', crudMethod: { ...crudYxSystemStore }})
const defaultForm = { id: null, name: null, introduction: null, phone: null, address: null, detailedAddress: null, image: null, latitude:
null, longitude: null, validTime: null, dayTime: null, addTime: null, isShow: 1, imageArr: [], validTimeArr: [], dayTimeArr: [] }
export default {
name: 'YxSystemStore',
components: { MaterialList },
components: { pagination, crudOperation, rrOperation, udOperation, MaterialList },
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() {
return {
loading: false,
form: { id:null, name: '', introduction: '', phone: '', address: '', detailedAddress: '', image: '' ,
latitude: '', longitude: '', validTime: '', dayTime: '', validTimeStart: null, validTimeEnd: null,
dayTimeStart: null, dayTimeEnd: null, dayTimeArr: [new Date(),new Date()], validTimeArr: [], imageArr: []},
permission: {
add: ['admin', 'yxSystemStore:add'],
edit: ['admin', 'yxSystemStore:edit'],
del: ['admin', 'yxSystemStore:del']
},
rules: {
name: [
{ required: true, message: '门店名称不能为空', trigger: 'blur' }
@ -89,62 +145,27 @@ export default {
longitude: [
{ required: true, message: '经度不能为空', trigger: 'blur' }
],
validTime: [
{ required: true, message: '核销有效日期不能为空', trigger: 'blur' }
],
dayTime: [
{ required: true, message: '每日营业开关时间不能为空', trigger: 'blur' }
isShow: [
{ required: true, message: '是否显示不能为空', trigger: 'blur' }
]
}
}
},
watch: {
'form.imageArr': function(val) {
console.log(222)
if (val) {
console.log(val)
this.form.image = val.join(',')
}
}
},
created() {
this.init()
},
methods: {
init() {
get().then(res => {
if(res.content.length > 0){
const con = res.content[0]
this.form = con
this.form.imageArr = [con.image]
this.form.dayTimeArr = [con.dayTimeStart,con.dayTimeEnd]
this.form.validTimeArr = [con.validTimeStart,con.validTimeEnd]
}
})
//
[CRUD.HOOK.beforeRefresh]() {
return true
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
//
[CRUD.HOOK.beforeSubmit]() {
//console.log('hah:'+this.form.imageArr)
this.form.image = this.form.imageArr.join(',')
update(this.form).then(res => {
this.$notify({
title: '保存成功',
type: 'success',
duration: 2500
})
this.loading = false
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
}
})
},
//
[CRUD.HOOK.beforeToEdit](crud, form) {
form.imageArr = [form.image]
form.dayTimeArr = [form.dayTimeStart,form.dayTimeEnd]
form.validTimeArr = [form.validTimeStart,form.validTimeEnd]
},
getTime(t) {
this.form.dayTimeStart = t[0]
@ -157,9 +178,11 @@ export default {
this.form.validTime = parseTime(t[0],'{y}-{m}-{d}') + ' - ' + parseTime(t[1],'{y}-{m}-{d}')
},
getL(addr) {
getL({addr}).then(res => {
crudYxSystemStore.getL({addr}).then(res => {
this.form.latitude = res.result.location.lat
this.form.longitude = res.result.location.lng
//console.log(this.form)
})
}
}

171
src/views/shop/store/indexbak.vue

@ -0,0 +1,171 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px">
<el-form-item label="门店名称" prop="name">
<el-input v-model="form.name" style="width: 370px;" />
</el-form-item>
<el-form-item label="门店简介" prop="introduction">
<el-input v-model="form.introduction" style="width: 370px;" />
</el-form-item>
<el-form-item label="门店手机" prop="phone">
<el-input v-model="form.phone" style="width: 370px;" />
</el-form-item>
<el-form-item label="门店地址" prop="address">
<el-input v-model="form.address" style="width: 370px;" />
<el-button :loading="loading" size="medium" type="primary" @click="getL(form.address)">获取经纬度</el-button>
</el-form-item>
<el-form-item label="门店logo" prop="image">
<MaterialList v-model="form.imageArr" style="width: 370px" type="image" :num="1" :width="150" :height="150" />
</el-form-item>
<el-form-item label="纬度" prop="latitude">
<el-input v-model="form.latitude" :disabled="true" style="width: 370px;" />
</el-form-item>
<el-form-item label="经度" prop="longitude">
<el-input v-model="form.longitude" :disabled="true" style="width: 370px;" />
</el-form-item>
<el-form-item label="核销时效" prop="validTime">
<el-date-picker
@change="getTimeT"
style="width: 370px;"
v-model="form.validTimeArr"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="营业时间" prop="dayTime">
<el-time-picker
@change="getTime"
style="width: 370px;"
is-range
v-model="form.dayTimeArr"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围">
</el-time-picker>
</el-form-item>
<el-form-item label="">
<el-button :loading="loading" size="medium" type="primary" @click="doSubmit">保存配置</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import { get, update, getL } from '@/api/yxSystemStore'
import MaterialList from '@/components/material'
import { parseTime } from '@/utils/index'
export default {
name: 'YxSystemStore',
components: { MaterialList },
data() {
return {
loading: false,
form: { id:null, name: '', introduction: '', phone: '', address: '', detailedAddress: '', image: '' ,
latitude: '', longitude: '', validTime: '', dayTime: '', validTimeStart: null, validTimeEnd: null,
dayTimeStart: null, dayTimeEnd: null, dayTimeArr: [new Date(),new Date()], validTimeArr: [], imageArr: []},
rules: {
name: [
{ required: true, message: '门店名称不能为空', trigger: 'blur' }
],
introduction: [
{ required: true, message: '简介不能为空', trigger: 'blur' }
],
phone: [
{ required: true, message: '手机号码不能为空', trigger: 'blur' }
],
address: [
{ required: true, message: '省市区不能为空', trigger: 'blur' }
],
latitude: [
{ required: true, message: '纬度不能为空', trigger: 'blur' }
],
longitude: [
{ required: true, message: '经度不能为空', trigger: 'blur' }
],
validTime: [
{ required: true, message: '核销有效日期不能为空', trigger: 'blur' }
],
dayTime: [
{ required: true, message: '每日营业开关时间不能为空', trigger: 'blur' }
]
}
}
},
watch: {
'form.imageArr': function(val) {
console.log(222)
if (val) {
console.log(val)
this.form.image = val.join(',')
}
}
},
created() {
this.init()
},
methods: {
init() {
get().then(res => {
if(res.content.length > 0){
const con = res.content[0]
this.form = con
this.form.imageArr = [con.image]
this.form.dayTimeArr = [con.dayTimeStart,con.dayTimeEnd]
this.form.validTimeArr = [con.validTimeStart,con.validTimeEnd]
}
})
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
this.form.image = this.form.imageArr.join(',')
update(this.form).then(res => {
this.$notify({
title: '保存成功',
type: 'success',
duration: 2500
})
this.loading = false
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
} else {
return false
}
})
},
getTime(t) {
this.form.dayTimeStart = t[0]
this.form.dayTimeEnd = t[1]
this.form.dayTime = parseTime(t[0],'{h}:{i}:{s}') + ' - ' + parseTime(t[1],'{h}:{i}:{s}')
},
getTimeT(t) {
this.form.validTimeStart = t[0]
this.form.validTimeEnd = t[1]
this.form.validTime = parseTime(t[0],'{y}-{m}-{d}') + ' - ' + parseTime(t[1],'{y}-{m}-{d}')
},
getL(addr) {
getL({addr}).then(res => {
this.form.latitude = res.result.location.lat
this.form.longitude = res.result.location.lng
})
}
}
}
</script>
<style scoped>
</style>
Loading…
Cancel
Save