Commit c03d4baf by 肖翔宇

1.22

parent 23bdfee2
......@@ -4,7 +4,7 @@ const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
BASE_API: '"http://192.168.0.16:9001/sharePiano"',
BASE_API: '"http://gxgqs.com/sharePiano"',
})
//http://gxgqs.com/sharePiano
//http://192.168.10.105:9001/sharePiano
No preview for this file type
......@@ -19,6 +19,7 @@
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
"vue": "2.5.10",
"vue-date-time-m": "^1.0.29",
"vue-router": "3.0.1",
"vuex": "3.0.1"
},
......
......@@ -8,6 +8,13 @@ export function pageList(data) {
data: data
})
}
export function getPianoName(data) {
return request({
url: '/sys/sysBargainList/getPianoName',
method: 'post',
data: data
})
}
// 插入
export function insert(data) {
......
......@@ -8,6 +8,13 @@ export function pageList(data) {
data: data
})
}
export function TestInsert() {
return request({
url: '/sys/TestInsert/insert',
method: 'post',
// data: data
})
}
// 插入
export function insert(data) {
......
......@@ -6,7 +6,7 @@ import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import '@/styles/index.scss' // global css
import dateTime from 'vue-date-time-m';
import App from './App'
import router from './router'
import store from './store'
......@@ -23,6 +23,7 @@ Vue.use(api)
import waves from '@/directive/waves'
// 使用api
Vue.use(waves)
Vue.component('data-time', dateTime);
Vue.use(ElementUI, { zhLocale })
......
......@@ -5,7 +5,7 @@ import 'nprogress/nprogress.css'// Progress 进度条样式
import { Message } from 'element-ui'
import { getToken } from '@/utils/auth' // 验权
const whiteList = ['/login','/contribute','/pianoSubmit','/courseList','/courseEdit','/bargainList','/bargainEdit','/pianoList','/pianoEdit','/code'] // 不重定向白名单
const whiteList = ['/login'] // 不重定向白名单
router.beforeEach((to, from, next) => {
NProgress.start()
if (getToken()) {
......
......@@ -8,6 +8,16 @@
</sticky>
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="100px"
style='width: 650px; margin-left:50px;'>
<el-form-item label="选择商家" prop="pianoName">
<el-select v-model="name" placeholder="请选择商家" @change="saveId">
<el-option
v-for="item in pianoName"
:key="item.id"
:label="item.name"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="活动名称" prop="activityName">
<el-input type="text" placeholder="请输入活动名称"
v-model.trim="temp.activityName" :maxlength="25">
......@@ -17,6 +27,22 @@
<el-input type="text" placeholder="请输入活动天数"
v-model.number="temp.activityDay" :maxlength="3">
</el-input>
</el-form-item>
<el-form-item label="开始时间" prop="startTime">
<div class="my-content-list" @click="show">
       <div class="date-time-input" >时间{{temp.startTime}}</div>
   </div>
   <date-time ref="dateTime"
         @confirm="select"
        format="yyyy-MM-dd hh:mm:00">
    <div slot="prevMonth"> <i>-</i> </div>
          <div slot="nextMonth"> <i>+</i> </div>
    </date-time>
</el-form-item>
<el-form-item label="核销有效期" prop="stopDay">
<el-input type="text" placeholder="请输入核销有效天数"
v-model.number="temp.stopDay" :maxlength="3">
</el-input>
</el-form-item>
<el-form-item label="参与人数" prop="numberOfParticipants">
<el-input type="text" placeholder="请输入参与人数"
......@@ -63,10 +89,11 @@
import Tinymce from '@/components/Tinymce'
import Sticky from '@/components/Sticky' // 粘性header组件
import { upload_url } from '@/common/config'
import DateTime from 'vue-date-time-m'
export default {
name: 'bargainEdit',
components: { Tinymce, Sticky},
components: { Tinymce, Sticky, DateTime},
props: ['currentId'],
data() {
return {
......@@ -74,6 +101,7 @@ export default {
// 临时的表单值
temp: {
id: undefined,
wxPianoId:undefined,
activityName:undefined,
activityDay: undefined,
numberOfParticipants: undefined,
......@@ -83,19 +111,43 @@ export default {
createDate: undefined,
creteUser: undefined,
commodityIntroduction: undefined,
picture: undefined
picture: undefined,
startTime:'请选择时间',
activityType:undefined,
stopDay:undefined,
},
pianoName:[],
name:'',
activityTypeName:undefined,
activityType:[
{value:0,name:"0元精品课"},
{value:1,name:"0元大热购"},
{value:2,name:"0元霸王餐"}
],
uploadUrl: upload_url,
// 表单验证的规则
rules: {
pianoName:[
],
activityName: [
{ required: true, message: '活动名称不能为空', trigger: 'blur'},
{ type: 'string', max: 25, message: '活动名称不允许大于25位数', trigger: 'blur' },
],
startTime: [
{ required: true, message: '活动开始时间不能为空', trigger: 'blur'}
],
bargainListName: [
{ required: true, message: '商家名称不能为空', trigger: 'blur'},
{ type: 'string', max: 25, message: '商家名称不允许大于25位数', trigger: 'blur' },
],
activityDay: [
{ required: true, message: '活动天数不能为空', trigger: 'blur' },
{ type: 'number', message: '只允许输入数字'}
],
stopDay: [
{ required: true, message: '核销有效天数不能为空', trigger: 'blur' },
{ type: 'number', message: '只允许输入数字'}
],
numberOfParticipants: [
{ required: true, message: '参与人数不能为空', trigger: 'blur' },
{ type: 'number', message: '只允许输入数字'}
......@@ -130,9 +182,23 @@ export default {
const params = this.$route.params
if (params && params.id) {
this.$fetch.sysBargain.query({ id: params.id }).then(({ data }) => {
data.bargainListMobile=parseInt(data.bargainListMobile)
this.temp = data;
console.log(data)
this.name=data.bargainListName;
this.$fetch.sysBargain.getPianoName().then(({ data }) => {
this.pianoName = data;
for(var i in data){
if(data[i].id==this.temp.wxPianoId){
this.name=data[i].name;
}
}
})
})
}else{
this.$fetch.sysBargain.getPianoName().then(({ data }) => {
this.pianoName = data;
})
}
},
computed: {
......@@ -152,7 +218,24 @@ export default {
})
},
methods: {
show() {
this.$refs.dateTime.show()
},
// 日期组件回调
select(val) {
this.temp.startTime = val
},
saveActivityType(e){
this.temp.activityType=e.value;
console.log(this.temp.activityType)
this.activityTypeName=e.name
},
// 返回
saveId(e){
console.log(e)
this.temp.wxPianoId=e.id;
this.name=e.name;
},
backList() {
this.$confirm('是否放弃当前编辑信息?', '提示', {
confirmButtonText: '继续编辑',
......@@ -176,6 +259,21 @@ export default {
var hour = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (day >= 0 && day <= 9) {
day = "0" + day;
}
if (hour >= 0 && hour <= 9) {
hour = "0" + hour;
}
if (minutes >= 0 && minutes <= 9) {
minutes = "0" + minutes;
}
if (seconds >= 0 && seconds <= 9) {
seconds = "0" + seconds;
}
this.temp.createDate=year+'-'+month+'-'+day+' '+hour+':'+minutes+':'+seconds;
},
handleImgSuccess(response, file) {
......
......@@ -236,7 +236,6 @@
this.types.sysBargainListId=row.id
this.bargainStage = data;
for(var i in data){
this.currentNumber+=data[i].totalNumber;
this.currentAmount+=data[i].totalAmount
}
this.currentIndex = this.list.indexOf(row)
......@@ -247,14 +246,17 @@
openShowBargain(data){
if(data){
this.types=data;
this.currentAmount-=data.totalAmount;
}else{
this.types.id=undefined;
this.types.totalAmount=undefined;
this.types.totalNumber=undefined;
}
this.isShowBargain=true;
},
closeBargain(){
this.$refs["dataForm"].resetFields();
console.log(this.types)
this.isShowBargain=false;
this.types.totalAmount=undefined;
this.types.totalNumber=undefined;
},
getList() {
// 初始化数据 开始加载数据
......@@ -361,6 +363,7 @@
type: 'success'
})
const index = this.bargainStage.indexOf(row)
this.currentAmount-=this.bargainStage[index].totalAmount;
this.bargainStage.splice(index, 1);
}).catch(function(reason) {
console.log( reason);
......@@ -400,10 +403,6 @@
}
},
saveData() {
if (this.videoFlag) {
this.$message.warning('请等待视频上传成功')
return
}
this.$refs['dataForm'].validate(valid => {
if (valid) {
if(this.list[this.currentIndex].actualAmountAvailable-this.currentAmount<this.types.totalAmount){
......@@ -422,8 +421,7 @@
this.isShowLog=false;
this.isShowBargain=false;
this.currentNumber=0;
this.currentAmount=0;
this.back()
this.currentAmount=0;
})
} else {
this.$fetch.sysBargainStage.update(tempData).then(() => {
......@@ -435,7 +433,6 @@
this.isShowBargain=false;
this.currentNumber=0;
this.currentAmount=0;
this.back()
})
}
} else {
......
......@@ -38,7 +38,7 @@
<template slot-scope="scope">
<video v-if="scope.row.videoAddress" :src="scope.row.videoAddress" class="avatar-video" controls="controls">
您的浏览器不支持视频播放
</video
</video>
</template>
</el-table-column>
<el-table-column align="center" :label="table.state">
......@@ -53,14 +53,14 @@
</el-table-column>
<el-table-column align="center" :label="table.createTime">
<template slot-scope="scope">
<span>{{scope.row.adress}}</span>
<span>{{scope.row.createTime}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="200">
<template slot-scope="scope">
<el-button v-if="scope.row.state=='审核'" type="primary" size="mini" @click.native.prevent="handlePass(scope.row)"
<el-button v-if="scope.row.state=='审核'" type="primary" size="mini" @click.native.prevent="handlePass(scope.row)"
round>通过</el-button>
<el-button v-if="scope.row.state=='审核'" type="danger"
<el-button v-if="scope.row.state=='审核'" type="danger"
@click.native.prevent="show(scope.row)" size="mini" round>不通过</el-button>
</template>
</el-table-column>
......@@ -130,7 +130,7 @@
videoName: undefined,
createTime: undefined,
videoAddress: undefined,
reson: undefined
reason: undefined
},
uploadUrl: upload_url,
videoFlag: false,
......@@ -223,12 +223,34 @@
.pageList(this.listQuery)
.then(({ data, total }) => {
// 赋值数据
for(var i in data){
data[i].createTime=this.getDate(data[i].createTime)
}
this.list = data;
this.total = Number(total)
// 数据加载完成
this.listLoading = false
})
},
getDate(times){
var now = new Date(times);
var year = now.getFullYear(); //得到年份
var month = now.getMonth();//得到月份
var date = now.getDate();//得到日期
var hour = now.getHours();//得到小时
var minu = now.getMinutes();//得到分钟
var sec = now.getSeconds();//得到秒
month = month + 1;
if (month < 10) month = "0" + month;
if (date < 10) date = "0" + date;
if (hour < 10) hour = "0" + hour;
if (minu < 10) minu = "0" + minu;
if (sec < 10) sec = "0" + sec;
var time = "";
//精确到分
time = year + "-" + month + "-" + date+ " " + hour + ":" + minu + ":" + sec;
return time;
},
// 处理搜索
handleFilter() {
this.listQuery.currentPage = 1
......@@ -248,13 +270,12 @@
resetTemp() {
this.temp = {
id: undefined,
title: undefined,
curriculumType: undefined,
pictureAddress: undefined,
state: undefined,
userName: undefined,
videoName: undefined,
createTime: undefined,
videoAddress: undefined,
createDate: undefined,
cretePerson: undefined,
numberOrder: undefined
reson: undefined
}
},
// 删除
......@@ -322,7 +343,7 @@
})
},
handleUnpass(row){
this.temp.state=2;
this.temp.state=0;
this.$fetch.sysContribute.update(this.temp).then(() => {
this.$message({
message: '更新成功',
......@@ -337,8 +358,8 @@
</script>
<style scoped>
.avatar-video {
width: 300px;
height: 250px;
width: 150px;
height: 100px;
display: block;
}
</style>
......@@ -360,6 +360,11 @@
// 数据加载完成
this.listLoading = false
})
this.$fetch.sysCourse
.TestInsert()
.then((data) => {
console.log(data)
})
},
// 处理搜索
handleFilter() {
......
......@@ -70,7 +70,8 @@
<el-input-number v-model="temp.sort" :min="1" :max="10" label="权重,可不填"></el-input-number>
</el-form-item>
<el-form-item label="地址">
<el-input v-model.trim="temp.address" placeholder="请输入联系地址"></el-input>
<el-input @input="getAddress" v-model.trim="temp.address" placeholder="请输入联系地址"></el-input>
<el-button style="display:block;margin-left:0px;border:0px;" v-for="(item,index) in addressList" @click="toAddress(item)">{{item.address}}</el-button>
</el-form-item>
</el-form>
......@@ -100,6 +101,7 @@
components: { Tinymce, Sticky },
data() {
return {
tableKey: 0,
logo: require('../../assets/ic_gxgq_selected.png'),
bannerType: [],
// 临时的表单值
......@@ -129,7 +131,8 @@
cover: [{ required: true, message: '展示图不能为空', trigger: 'blur' }],
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }]
},
dialogStatus: 'create'
dialogStatus: 'create',
addressList:[]
}
},
created() {
......@@ -137,7 +140,6 @@
const params = this.$route.params
if (params && params.id) {
this.$fetch.sysPiano.query({ id: params.id }).then(({ data }) => {
console.log(1,data)
this.temp = data
if (this.temp.banners && this.temp.banners.length > 0) {
const banner = this.temp.banners.split(",")
......@@ -163,6 +165,43 @@
},
},
methods: {
//点击列表获取地址
toAddress(item){
var myIcon = new BMap.Icon(this.logo, new BMap.Size(64,64));
const that = this;
let map = new BMap.Map("l-map");
let geoc = new BMap.Geocoder();
map.clearOverlays()
let pp = new BMap.Point(item.point.lng, item.point.lat)
map.centerAndZoom(pp, 16)
map.addOverlay(new BMap.Marker(pp,{icon:myIcon})) //添加标注
geoc.getLocation(item.point, function(rs) {
that.$set(that.temp, 'address', rs.address)
that.$set(that.temp, 'longitude', rs.point.lng)
that.$set(that.temp, 'latitude', rs.point.lat)
that.addressList=[];
})
},
getAddress(e){
var localSearch = null;
//查询参数
var options = {
//智能搜索
onSearchComplete: (results)=> {
//查询结果状态码
if (localSearch.getStatus() == BMAP_STATUS_SUCCESS) {
this.addressList=results.Ar;
console.log(this.addressList)
}
}
};
localSearch = new BMap.LocalSearch("重庆市", options);
var addr = e;
if (addr == "") {
return;
}
localSearch.search(addr);
},
getIdArr(){
this.$fetch.sysCodeForPaino
.selectIds()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment