Commit f3b8fbae authored by liwei's avatar liwei

liwei

parent 94e93dd6
<template> <template>
<div class="integral-page"> <div class="integral-page">
<el-form ref="searchFrom" :model="form" style="padding-top: 20px;background: white" label-width="80px" inline size="small"> <el-form
ref="searchFrom"
:model="form"
style="padding-top: 20px;background: white"
label-width="80px"
inline
size="small"
>
<el-form-item label="昵称"> <el-form-item label="昵称">
<el-input v-model="form.nickname" style="width: 120px;"></el-input> <el-input v-model="form.nickname" style="width: 120px;"></el-input>
</el-form-item> </el-form-item>
...@@ -16,220 +23,226 @@ ...@@ -16,220 +23,226 @@
v-for="(data,index) in sourceOption" v-for="(data,index) in sourceOption"
:key="index" :key="index"
:label="data.value" :label="data.value"
:value="data.id"> :value="data.id"
</el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" plain @click="getList">搜索</el-button> <el-button type="primary" plain @click="getList">搜索</el-button>
<el-button type="success" plain @click="addIntegral" v-if="!$store.state.readonly">变更用户积分</el-button> <el-button type="success" plain @click="addIntegral" v-if="!$store.state.readonly">变更用户积分</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-tabs v-model="form.is_add" type="card" style="background: white;padding-top: 10px" @tab-click="getList"> <el-tabs
<el-tab-pane label="全部" name="-1"/> v-model="form.is_add"
<el-tab-pane label="添加积分" name="1"/> type="card"
<el-tab-pane label="减少积分" name="0"/> style="background: white;padding-top: 10px"
<el-tab-pane label="积分排行" name="-2"/> @tab-click="getList"
>
<el-tab-pane label="全部" name="-1" />
<el-tab-pane label="添加积分" name="1" />
<el-tab-pane label="减少积分" name="0" />
<el-tab-pane label="积分排行" name="-2" />
</el-tabs> </el-tabs>
<el-table <el-table :data="list" size="mini" :style="{width: width+'px'}">
:data="list" <el-table-column width="220" class="f-c" label="用户">
size="mini" <template slot-scope="scope">
style="width: 100%"> <img class="avatar" :src="scope.row.avatar" />
<el-table-column {{scope.row.nickname}}(ID:{{scope.row.user_id}})
width="220" <br />
className="f-c" 手机:{{scope.row.mobile}}
label="用户"> </template>
<template slot-scope="scope"> </el-table-column>
<img class="avatar" :src="scope.row.avatar"/> {{scope.row.nickname}}(ID:{{scope.row.user_id}})<br>手机:{{scope.row.mobile}} <el-table-column v-if="form.is_add !== '-2'" label="来源">
</template> <template slot-scope="scope">{{scope.row.source | INTEGRALFUN}}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="desc" v-if="form.is_add !== '-2'" label="积分变更描述" />
v-if="form.is_add !== '-2'" <el-table-column v-if="form.is_add !== '-2'" label="变更积分值">
label="来源"> <template slot-scope="scope">
<template slot-scope="scope"> <span v-if="scope.row.is_add===1" style="color: green">+{{scope.row.value}}</span>
{{scope.row.source | INTEGRALFUN}} <span v-if="scope.row.is_add===0" style="color: red">-{{scope.row.value}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="last_value" :label="form.is_add !== '-2'?'变更后积分值':'最新积分'" />
prop="desc" <el-table-column prop="created_at" :label="form.is_add !== '-2'?'创建时间':'最新变更时间'" />
v-if="form.is_add !== '-2'" </el-table>
label="积分变更描述" <page
/> :nowPage="nowPage"
<el-table-column :total="total"
v-if="form.is_add !== '-2'" :limit="limit"
label="变更积分值"> @pageChange="onPageChange"
<template slot-scope="scope"> @sizeChange="onSizeChange"
<span v-if="scope.row.is_add===1" style="color: green">+{{scope.row.value}}</span> />
<span v-if="scope.row.is_add===0" style="color: red">-{{scope.row.value}}</span> <new-integral :newIntegral="newIntegral" @subAdd="subAdd" @showUserList="showUserList" />
</template> <user-list-page :show="userListShow" @addUser="addUser" />
</el-table-column>
<el-table-column
prop="last_value"
:label="form.is_add !== '-2'?'变更后积分值':'最新积分'"
/>
<el-table-column
prop="created_at"
:label="form.is_add !== '-2'?'创建时间':'最新变更时间'"
/>
</el-table>
<page :nowPage="nowPage" :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/>
<new-integral :newIntegral="newIntegral" @subAdd="subAdd" @showUserList="showUserList"/>
<user-list-page :show="userListShow" @addUser="addUser"/>
</div> </div>
</template> </template>
<script> <script>
import {getIntegralListApi,changeIntegralApi,integralApi} from "../../service/api"; import {
import {INTEGRALTYPE,INTEGRALFUN} from "../../util/wordbook"; getIntegralListApi,
import page from '../framework/page' changeIntegralApi,
import newIntegral from './newIntegral' integralApi
import userListPage from './userList' } from "../../service/api";
export default { import { INTEGRALTYPE, INTEGRALFUN } from "../../util/wordbook";
name: "index", import page from "../framework/page";
components: { import newIntegral from "./newIntegral";
page, import userListPage from "./userList";
newIntegral, export default {
userListPage name: "index",
}, components: {
data(){ page,
let is_addOption = []; newIntegral,
for(let k in INTEGRALTYPE){ userListPage
is_addOption.push({id:k,value:INTEGRALTYPE[k]}) },
} data() {
let sourceOption = []; let is_addOption = [];
for(let j in INTEGRALFUN){ for (let k in INTEGRALTYPE) {
sourceOption.push({id:j,value:INTEGRALFUN[j]}) is_addOption.push({ id: k, value: INTEGRALTYPE[k] });
} }
return { let sourceOption = [];
list:[], for (let j in INTEGRALFUN) {
total:0, sourceOption.push({ id: j, value: INTEGRALFUN[j] });
newIntegral:{ }
show:false, return {
user_id:'', width: 0,
is_add:'', list: [],
value:'', total: 0,
desc:'' newIntegral: {
}, show: false,
is_addOption:is_addOption, user_id: "",
sourceOption:sourceOption, is_add: "",
limit:10, value: "",
userListShow:{ desc: ""
show:false },
}, is_addOption: is_addOption,
nowPage:1, sourceOption: sourceOption,
form:{ limit: 10,
is_add:'-1', userListShow: {
source:'', show: false
user_id:'', },
mobile:'', nowPage: 1,
nickname:'' form: {
} is_add: "-1",
source: "",
user_id: "",
mobile: "",
nickname: ""
} }
};
},
mounted() {
this.initPage();
this.width = window.innerWidth - 200;
},
filters: {
INTEGRALTYPE(value) {
return INTEGRALTYPE[value];
}, },
mounted(){ INTEGRALFUN(value) {
this.initPage() return INTEGRALFUN[value];
}
},
methods: {
subAdd() {
let json = {
user_id: this.newIntegral.user_id,
is_add: this.newIntegral.is_add,
value: this.newIntegral.value,
desc: this.newIntegral.desc
};
changeIntegralApi(json).then(res => {
this.getList();
this.newIntegral.show = false;
});
}, },
filters:{ showUserList() {
INTEGRALTYPE(value){ this.userListShow.show = true;
return INTEGRALTYPE[value]
},
INTEGRALFUN(value){
return INTEGRALFUN[value]
}
}, },
methods:{ addUser(value) {
subAdd(){ this.userListShow.show = false;
let json = { this.newIntegral.user_id = value;
user_id:this.newIntegral.user_id, },
is_add:this.newIntegral.is_add, changeUserList() {},
value:this.newIntegral.value, addIntegral() {
desc:this.newIntegral.desc, this.newIntegral = {
}; show: true,
changeIntegralApi(json).then(res=>{ user_id: "",
this.getList(); is_add: "",
this.newIntegral.show = false value: "",
}) desc: ""
}, };
showUserList(){ },
this.userListShow.show = true initPage() {
}, this.form = {
addUser(value){ is_add: "-1",
this.userListShow.show = false; source: "",
this.newIntegral.user_id = value user_id: "",
}, mobile: "",
changeUserList(){}, nickname: ""
addIntegral(){ };
this. newIntegral={ this.getList();
show:true, },
user_id:'', onPageChange(val) {
is_add:'', this.nowPage = val;
value:'', this.getList();
desc:'' },
onSizeChange(val) {
this.limit = val;
this.nowPage = 1;
this.getList();
},
getList() {
let json = {
limit: this.limit,
page: this.nowPage
};
if (this.form.is_add === "-2") {
integralApi(json).then(res => {
this.list = res.list;
this.total = res.total;
});
} else {
if (this.form.is_add !== "" && this.form.is_add !== "-1") {
json.is_add = this.form.is_add;
} }
}, if (this.form.source !== "") {
initPage(){ json.source = this.form.source;
this.form = { }
is_add:'-1', if (this.form.user_id !== "") {
source:'', json.user_id = this.form.user_id;
user_id:'', }
mobile:'', if (this.form.mobile !== "") {
nickname:'' json.mobile = this.form.mobile;
};
this.getList()
},
onPageChange(val){
this.nowPage = val;
this.getList()
},
onSizeChange(val){
this.limit = val;
this.nowPage = 1;
this.getList()
},
getList(){
let json={
limit:this.limit,
page: this.nowPage
};
if(this.form.is_add === '-2'){
integralApi(json).then(res=>{
this.list = res.list;
this.total = res.total
})
}else{
if(this.form.is_add !== '' && this.form.is_add !== '-1'){
json.is_add = this.form.is_add
}
if(this.form.source !== ''){json.source = this.form.source}
if(this.form.user_id !== ''){json.user_id = this.form.user_id}
if(this.form.mobile !== ''){json.mobile = this.form.mobile}
if(this.form.nickname !== ''){json.nickname = this.form.nickname}
getIntegralListApi(json).then(res=>{
this.list = res.list;
this.total = res.total
})
} }
if (this.form.nickname !== "") {
json.nickname = this.form.nickname;
}
getIntegralListApi(json).then(res => {
this.list = res.list;
this.total = res.total;
});
} }
} }
} }
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@import "../../util/public"; @import "../../util/public";
.avatar{ .avatar {
width: 50px; width: 50px;
min-width: 50px; min-width: 50px;
height: 50px; height: 50px;
margin-right: 5px; margin-right: 5px;
border-radius: 50%; border-radius: 50%;
} }
</style> </style>
<style> <style>
.f-c > .cell { .f-c > .cell {
display: flex !important; display: flex !important;
flex-flow: row; flex-flow: row;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
} }
</style> </style>
<template> <template>
<el-dialog <el-dialog title="新增订单" center append-to-body :visible.sync="newdialogObj.show" width="70%">
title="新增订单" <el-form ref="form" :model="form" label-width="120px" :rules="rules">
center <el-row>
append-to-body <el-col :span="10">
:visible.sync="newdialogObj.show" <el-form-item label="商品名称" prop="goods_id">
width="70%"> <el-select v-model="form.goods_id" placeholder="请选择" @change="onOptionChange">
<el-form ref="form" :model="form" label-width="120px" :rules="rules">
<el-row>
<el-col :span="10">
<el-form-item label="商品名称" prop="goods_id">
<el-select v-model="form.goods_id" placeholder="请选择" @change="onOptionChange">
<el-option <el-option
v-for="(data,index) in goodsList" v-for="(data,index) in goodsList"
:key="index" :key="index"
:label="data | filterGoods" :label="data | filterGoods"
:value="data.id"> :value="data.id"
</el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="10"> <!-- <el-col :span="10">
<el-form-item label="期数名称" prop="periods_id"> <el-form-item label="期数名称" prop="periods_id">
<el-select v-model="form.periods_id" placeholder="请选择"> <el-select v-model="form.periods_id" placeholder="请选择">
<el-option <el-option
...@@ -30,95 +25,101 @@ ...@@ -30,95 +25,101 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> --> </el-col>-->
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="10"> <el-col :span="10">
<el-form-item label="用户ID" prop="user_id" > <el-form-item label="用户ID" prop="user_id">
<el-input width='100' v-model="form.user_id"></el-input> <el-input width="100" v-model="form.user_id"></el-input>
<el-button type="success" @click="onAddUser">+添加用户</el-button> <el-button type="success" @click="onAddUser">+添加用户</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<el-form-item label="添加推广人" > <el-form-item label="添加推广人">
<!-- <el-input v-model="form.invite_id"></el-input> --> <!-- <el-input v-model="form.invite_id"></el-input> -->
<el-select <el-select
v-model="form.invite_id" v-model="form.invite_id"
filterable filterable
clearable clearable
placeholder="请输入名称" placeholder="请输入名称"
:remote-method="remoteMethod" :remote-method="remoteMethod"
> >
<el-option <el-option
v-for="item in teacherList" v-for="item in teacherList"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.user_id"> :value="item.user_id"
</el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="10"> <el-col :span="10">
<el-form-item label="支付类型" prop="order_type"> <el-form-item label="支付类型" prop="order_type">
<el-select v-model="form.order_type" placeholder="请选择"> <el-select v-model="form.order_type" placeholder="请选择">
<el-option <el-option
v-for="item in buyWayOptioms" v-for="item in buyWayOptioms"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
:disabled="item.disabled"> :disabled="item.disabled"
</el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<el-form-item label="实付金额(元)" prop="money" > <el-form-item label="实付金额(元)" prop="money">
<el-input-number v-model="form.money"></el-input-number> <el-input-number v-model="form.money"></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="10"> <el-col :span="10">
<el-form-item label="支付时间" prop="pay_at" > <el-form-item label="支付时间" prop="pay_at">
<el-date-picker <el-date-picker
v-model="form.pay_at" v-model="form.pay_at"
type="datetime" type="datetime"
:picker-options="pickerOptions1" :picker-options="pickerOptions1"
default-time="12:00:00" default-time="12:00:00"
placeholder="选择日期时间"> placeholder="选择日期时间"
</el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<el-form-item label="备注"> <el-form-item label="备注">
<el-input type="textarea" v-model="form.desc"></el-input> <el-input type="textarea" v-model="form.desc"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="10" v-if="form.order_type!=2"> <el-col :span="10" v-if="form.order_type!=2">
<el-form-item label="订单号"> <el-form-item label="订单号">
<el-input v-model="form.out_trade_no"></el-input> <el-input v-model="form.out_trade_no"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<vue-address :province="form.province_name" :city="form.city" :district="form.area" :detail="form.address" :mobile="form.receive_mobile" :name="form.receive_name" @change="handlerAddressChange"> <vue-address
</vue-address> :province="form.province"
</el-col> :city="form.city"
</el-row> :district="form.district"
:detail="form.address"
</el-form> :mobile="form.receive_mobile"
:name="form.receive_name"
@change="handlerAddressChange"
></vue-address>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="newdialogObj.show = false">取 消</el-button> <el-button @click="newdialogObj.show = false">取 消</el-button>
<el-button type="primary" @click="saveAddOrder(form)">确定</el-button> <el-button type="primary" @click="saveAddOrder(form)">确定</el-button>
</div> </div>
<el-dialog :modal="false" :visible.sync="addShow" > <el-dialog :modal="false" :visible.sync="addShow">
<el-form label-width="90px"> <el-form label-width="90px">
<!--<el-form-item label="用户id">--> <!--<el-form-item label="用户id">-->
<!--<el-input v-model="addId"></el-input>--> <!--<el-input v-model="addId"></el-input>-->
<!--</el-form-item>--> <!--</el-form-item>-->
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
...@@ -149,305 +150,315 @@ ...@@ -149,305 +150,315 @@
:data="userList" :data="userList"
ref="multipleTable" ref="multipleTable"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
style="width: 100%"> style="width: 100%"
<el-table-column >
type="selection" <el-table-column type="selection" width="55"></el-table-column>
width="55"> <el-table-column class="f-c" label="用户">
</el-table-column>
<el-table-column
className="f-c"
label="用户">
<template slot-scope="scope"> <template slot-scope="scope">
<img style="margin-right:5px;width: 50px;height: 50px;border-radius: 50px" :src="scope.row.avatar">{{scope.row.nickname}}(ID:{{scope.row.user_id}}) <img
style="margin-right:5px;width: 50px;height: 50px;border-radius: 50px"
:src="scope.row.avatar"
/>
{{scope.row.nickname}}(ID:{{scope.row.user_id}})
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="mobile" label="手机号"></el-table-column>
prop="mobile"
label="手机号">
</el-table-column>
</el-table> </el-table>
<page :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/> <page :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="addShow = false">取 消</el-button> <el-button @click="addShow = false">取 消</el-button>
<el-button type="primary" @click="onAdd">确 定</el-button> <el-button type="primary" @click="onAdd">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import {getGoodsListApi,setOrderApi,getPeriodsApi,getTeacherListApi,getUserListApi,getOrderTypeApi} from "../../service/api" import {
import vueAddress from '../framework/address-picker/Address' getGoodsListApi,
import AddressArray from '../framework/address-picker/addr' setOrderApi,
import {ORDERSTATUS,BUYWay,GOODSTYPE} from "../../util/wordbook" getPeriodsApi,
import CommonJs from '../../util/common'; getTeacherListApi,
import page from '../framework/page' getUserListApi,
export default { getOrderTypeApi
name: "newdialogObj", } from "../../service/api";
props:[ import vueAddress from "../framework/address-picker/Address";
'newdialogObj' import AddressArray from "../framework/address-picker/addr";
], import { ORDERSTATUS, BUYWay, GOODSTYPE } from "../../util/wordbook";
data(){ import CommonJs from "../../util/common";
return{ import page from "../framework/page";
rules:{ export default {
periods_id: [ name: "newdialogObj",
{ required: true, message: '请输入期数名称', trigger: 'change' } props: ["newdialogObj"],
], data() {
goods_id: [ return {
{ required: true, message: '请输入商品名称', trigger: 'change' } rules: {
], periods_id: [
money: [ { required: true, message: "请输入期数名称", trigger: "change" }
{ required: true, message: '请输入金额', trigger: 'blur' } ],
], goods_id: [
user_id: [ { required: true, message: "请输入商品名称", trigger: "change" }
{ required: true, message: '请输入用户ID', trigger: 'blur' } ],
], money: [{ required: true, message: "请输入金额", trigger: "blur" }],
pay_at: [ user_id: [{ required: true, message: "请输入用户ID", trigger: "blur" }],
{ required: true, message: '请选择日期', trigger: 'change' } pay_at: [{ required: true, message: "请选择日期", trigger: "change" }],
], order_type: [
order_type:[ { required: true, message: "请选择支付类型", trigger: "change" }
{ required: true, message: '请选择支付类型', trigger: 'change' } ],
], out_trade_no: [
out_trade_no:[ { required: true, message: "请填写订单号", trigger: "change" }
{ required: true, message: '请填写订单号', trigger: 'change' } ]
], },
}, nowPage: 1,
nowPage: 1, limit: 200,
limit: 200, total: 0,
total:0, form: {
form:{ periods_id: "",
periods_id:"", goods_id: "",
goods_id:"", user_id: "",
user_id:"", money: "",
money:"", buy_type: "",
buy_type:"", invite_id: "",
invite_id:"", desc: "",
desc:"",
province_name:"",
city:"",
area:"",
city_name:"",
district_name:"",
district:"",
province:"",
address:"",
receive_mobile:"",
receive_name:"",
order_type:"",
pay_at:"",
},
goodsList:[],
periodsList:[],
pickerOptions1:'',
buyWayOptioms:[],
teacherList: [],
addShow:false,
searchFrom:{
},
userList: [],
multipleSelection: [],
} province_name: "",
city: "",
area: "",
city_name: "",
district_name: "",
district: "",
province: "",
address: "",
receive_mobile: "",
receive_name: "",
order_type: "",
pay_at: ""
},
goodsList: [],
periodsList: [],
pickerOptions1: "",
buyWayOptioms: [],
teacherList: [],
addShow: false,
searchFrom: {},
userList: [],
multipleSelection: []
};
},
components: {
vueAddress,
page
},
filters: {
filterGoods(val) {
return (
"[" +
GOODSTYPE[val.goods_type] +
"]" +
"[" +
val.current_price / 100 +
"元]" +
val.name
);
}
},
methods: {
onPageChange(val) {
this.nowPage = val;
this.getUser();
},
onSizeChange(val) {
this.limit = val;
this.nowPage = 1;
this.getUser();
}, },
components:{ handleSelectionChange(val) {
vueAddress, this.multipleSelection = val;
page,
}, },
filters:{ getUser() {
filterGoods(val){ let json = {
return '[' + GOODSTYPE[val.goods_type] + ']' + '[' +val.current_price / 100 + '元]' + val.name page: this.nowPage,
limit: 5
};
if (this.searchFrom.userId) {
json.user_id = this.searchFrom.userId;
}
if (this.searchFrom.nickName) {
json.nickname = this.searchFrom.nickName;
} }
if (this.searchFrom.mobile) {
json.mobile = this.searchFrom.mobile;
}
getUserListApi(json).then(res => {
this.userList = res.list;
this.total = res.total;
});
}, },
methods:{ saveAddOrder(data) {
onPageChange(val){ this.$refs["form"].validate(valid => {
this.nowPage = val if (valid) {
this.getUser() let json = {
}, periods_id: data.periods_id,
onSizeChange(val){ goods_id: data.goods_id,
this.limit = val user_id: data.user_id,
this.nowPage = 1; money: data.money,
this.getUser() province_name: data.province_name,
}, city_id: data.city,
handleSelectionChange(val) { city: data.city_name,
this.multipleSelection = val; area: data.district_name,
}, area_id: data.district,
getUser(){ province_id: data.province,
let json = { address: data.address,
page: this.nowPage, receive_mobile: data.receive_mobile,
limit: 5 receive_name: data.receive_name,
}; order_type: data.order_type
if (this.searchFrom.userId) { };
json.user_id = this.searchFrom.userId // 元转分
} json.money = json.money;
if (this.searchFrom.nickName) { if (data.pay_at) {
json.nickname = this.searchFrom.nickName json.pay_at = CommonJs.dateFmt(data.pay_at, "yyyy-MM-dd hh:mm:ss");
} }
if (this.searchFrom.mobile) { if (this.form.invite_id) {
json.mobile = this.searchFrom.mobile json.invite_id = this.form.invite_id;
} }
getUserListApi(json).then(res=>{ if (this.form.desc) {
this.userList = res.list; json.desc = this.form.desc;
this.total = res.total; }
}) if (this.form.out_trade_no) {
}, json.out_trade_no = this.form.out_trade_no;
saveAddOrder(data){ }
this.$refs['form'].validate((valid) => { json.invite_type = "TEACHER";
if (valid) { if (
let json={ json.province_name &&
periods_id:data.periods_id, json.address &&
goods_id:data.goods_id, json.receive_mobile &&
user_id:data.user_id, json.receive_name
money:data.money, ) {
province_name:data.province_name, setOrderApi(json).then(res => {
city_id:data.city, this.newdialogObj.show = false;
city:data.city_name, this.$emit("reflash");
area:data.district_name,
area_id:data.district,
province_id:data.province,
address:data.address,
receive_mobile:data.receive_mobile,
receive_name:data.receive_name,
order_type:data.order_type,
}
// 元转分
json.money=json.money;
if(data.pay_at){
json.pay_at = CommonJs.dateFmt( data.pay_at,"yyyy-MM-dd hh:mm:ss");
}
if(this.form.invite_id){
json.invite_id = this.form.invite_id
}
if(this.form.desc){
json.desc = this.form.desc
}
if(this.form.out_trade_no){
json.out_trade_no = this.form.out_trade_no
}
json.invite_type="TEACHER";
if(json.province_name && json.address && json.receive_mobile && json.receive_name){
setOrderApi(json).then(res=>{
this.newdialogObj.show=false
this.$emit("reflash");
this.$message({ this.$message({
message: '添加成功', message: "添加成功",
type: 'success' type: "success"
}); });
}) });
}else{
this.$message({
message: "缺少必填项",
type: "warning"
});
}
} else { } else {
console.log('error submit!!'); this.$message({
return false; message: "缺少必填项",
type: "warning"
});
} }
});
},
handlerAddressChange(val){
if(!val.province || !val.city || !val.district){
return
}
this.form.address = val.detail;
this.form.province = val.province;
this.form.city = val.city;
this.form.receive_mobile = val.mobile;
this.form.receive_name = val.name;
let provinceObj = AddressArray.filter((item) => {
return item.value === val.province
})
let cityObj = provinceObj[0].children.filter((city) => {
return city.value === val.city
})
let districtObj = cityObj[0].children.filter((district) => {
return district.value === val.district
})
this.form.province_name = provinceObj[0].label;
this.form.city_name = cityObj[0].label;
this.form.district_name = districtObj.length > 0 ? districtObj[0].label : cityObj[0].children[0].label;
this.form.district = districtObj.length > 0 ? districtObj[0].value : cityObj[0].children[0].value;
},
getGoodsOption(){
let json = {
page: 1,
limit: 200,
course_type:0,
};
getGoodsListApi(json).then(res=>{
this.goodsList = res.list;
})
},
onOptionChange(id){
this.form.periods_id="";
getPeriodsApi({goods_id:id}).then((res) => {
this.periodsList=res.list
})
},
getTeacherList(name){
let json = {
limit: 100,
page: 1
};
if(name) {
json.name = name
}
getTeacherListApi(json).then(res=>{
this.teacherList = res.list
});
getOrderTypeApi().then(res =>{
this.buyWayOptioms = res
})
},
remoteMethod(query) {
if (query !== '') {
this.getTeacherList(query);
} else { } else {
this.getTeacherList(); console.log("error submit!!");
return false;
} }
}, });
onAddUser(){
this.addShow = true;
this.getUser();
},
onAdd(){
if(this.multipleSelection.length === 0) {
this.$message({
type: 'error',
message: '请选择用户!'
});
return
} else if (this.multipleSelection.length !== 1){
this.$message({
type: 'error',
message: '只能选择一个用户!'
});
return
}
this.form.user_id=this.multipleSelection[0].user_id;
this.addShow = false;
},
}, },
watch:{ handlerAddressChange(val) {
'newdialogObj.show'(val){ if (!val.province || !val.city || !val.district) {
if(val){ return;
this.getGoodsOption();
this.getTeacherList();
}
} }
this.form.address = val.detail;
this.form.province = val.province;
this.form.city = val.city;
this.form.receive_mobile = val.mobile;
this.form.receive_name = val.name;
let provinceObj = AddressArray.filter(item => {
return item.value === val.province;
});
let cityObj = provinceObj[0].children.filter(city => {
return city.value === val.city;
});
let districtObj = cityObj[0].children.filter(district => {
return district.value === val.district;
});
this.form.province_name = provinceObj[0].label;
this.form.city_name = cityObj[0].label;
this.form.district_name =
districtObj.length > 0
? districtObj[0].label
: cityObj[0].children[0].label;
this.form.district =
districtObj.length > 0
? districtObj[0].value
: cityObj[0].children[0].value;
}, },
mounted(){ getGoodsOption() {
let json = {
page: 1,
limit: 200,
course_type: 0
};
getGoodsListApi(json).then(res => {
this.goodsList = res.list;
});
}, },
} onOptionChange(id) {
this.form.periods_id = "";
getPeriodsApi({ goods_id: id }).then(res => {
this.periodsList = res.list;
});
},
getTeacherList(name) {
let json = {
limit: 100,
page: 1
};
if (name) {
json.name = name;
}
getTeacherListApi(json).then(res => {
this.teacherList = res.list;
});
getOrderTypeApi().then(res => {
this.buyWayOptioms = res;
});
},
remoteMethod(query) {
if (query !== "") {
this.getTeacherList(query);
} else {
this.getTeacherList();
}
},
onAddUser() {
this.addShow = true;
this.getUser();
},
onAdd() {
if (this.multipleSelection.length === 0) {
this.$message({
type: "error",
message: "请选择用户!"
});
return;
} else if (this.multipleSelection.length !== 1) {
this.$message({
type: "error",
message: "只能选择一个用户!"
});
return;
}
this.form.user_id = this.multipleSelection[0].user_id;
this.addShow = false;
}
},
watch: {
"newdialogObj.show"(val) {
if (val) {
this.getGoodsOption();
this.getTeacherList();
}
}
},
mounted() {}
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.dialog-footer{ .dialog-footer {
display: block; display: block;
text-align: center; text-align: center;
} }
</style> </style>
<template> <template>
<div class="integral-page"> <div class="integral-page">
<el-form ref="searchFrom" :model="searchFrom" style="padding-top:20px;" label-width="80px" inline> <el-form
<el-form-item label="主账户ID"> ref="searchFrom"
<el-input v-model="searchFrom.user_id"></el-input> :model="searchFrom"
</el-form-item> style="padding-top:20px;"
<el-form-item label="子账户ID"> label-width="80px"
<el-input v-model="searchFrom.sub_user_id"></el-input> inline
</el-form-item> >
<el-form-item> <el-form-item label="主账户ID">
<el-button type="primary" plain @click="getUser">搜索</el-button> <el-input v-model="searchFrom.user_id"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="子账户ID">
<el-input v-model="searchFrom.sub_user_id"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" plain @click="getUser">搜索</el-button>
</el-form-item>
</el-form> </el-form>
<el-table <el-table :data="userList" :style="{width: width+'px'}">
:data="userList" <el-table-column class="f-c" label="主账户">
style="width: 100%">
<el-table-column
className="f-c"
label="主账户">
<template slot-scope="scope"> <template slot-scope="scope">
<img class="avatar" :src="scope.row.user_avatar">{{scope.row.user_nickname}}(ID:{{scope.row.user_id}}) <img class="avatar" :src="scope.row.user_avatar" />
{{scope.row.user_nickname}}(ID:{{scope.row.user_id}})
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column class="f-c" label="子账户">
className="f-c"
label="子账户">
<template slot-scope="scope"> <template slot-scope="scope">
<img class="avatar" :src="scope.row.sub_user_avatar">{{scope.row.sub_user_nickname}}(ID:{{scope.row.sub_user_id}}) <img class="avatar" :src="scope.row.sub_user_avatar" />
{{scope.row.sub_user_nickname}}(ID:{{scope.row.sub_user_id}})
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="created_at" label="绑定时间"></el-table-column>
prop="created_at" <el-table-column prop="unbind_at" label="解绑时间">
label="绑定时间"> <template
</el-table-column> slot-scope="scope"
<el-table-column >{{scope.row.unbind_at=='0000-00-00 00:00:00'?'未解绑':scope.row.unbind_at}}</template>
prop="unbind_at"
label="解绑时间">
<template slot-scope="scope">
{{scope.row.unbind_at=='0000-00-00 00:00:00'?'未解绑':scope.row.unbind_at}}
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<page :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/> <page :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange" />
</div> </div>
</template> </template>
<script> <script>
import {getSubAccountListApi,getOldListApi} from "../../service/api"; import { getSubAccountListApi, getOldListApi } from "../../service/api";
import {INTEGRALTYPE,INTEGRALFUN} from "../../util/wordbook"; import { INTEGRALTYPE, INTEGRALFUN } from "../../util/wordbook";
import page from '../framework/page' import page from "../framework/page";
export default { export default {
name: "index", name: "index",
components: { components: {
page page
},
data() {
let is_addOption = [];
for (let k in INTEGRALTYPE) {
is_addOption.push({ id: k, value: INTEGRALTYPE[k] });
}
let sourceOption = [];
for (let j in INTEGRALFUN) {
sourceOption.push({ id: j, value: INTEGRALFUN[j] });
}
return {
width: 0,
searchFrom: {
user_id: "",
sub_user_id: ""
},
userList: [],
total: 0,
nowPage: 1,
limit: 10,
showDetail: false
};
},
mounted() {
this.getUser();
this.width = window.innerWidth - 200;
},
filters: {
INTEGRALTYPE(value) {
return INTEGRALTYPE[value];
}, },
data(){ INTEGRALFUN(value) {
let is_addOption = []; return INTEGRALFUN[value];
for(let k in INTEGRALTYPE){ }
is_addOption.push({id:k,value:INTEGRALTYPE[k]}) },
} methods: {
let sourceOption = []; onPageChange(val) {
for(let j in INTEGRALFUN){ this.nowPage = val;
sourceOption.push({id:j,value:INTEGRALFUN[j]}) this.getUser();
}
return {
searchFrom:{
user_id:'',
sub_user_id:""
},
userList:[],
total:0,
nowPage:1,
limit: 10,
showDetail:false
}
}, },
mounted(){ onSizeChange(val) {
this.getUser() this.limit = val;
this.nowPage = 1;
this.getUser();
}, },
filters:{ getUser() {
INTEGRALTYPE(value){ let json = {
return INTEGRALTYPE[value] page: this.nowPage,
}, limit: this.limit
INTEGRALFUN(value){ };
return INTEGRALFUN[value] if (this.searchFrom.user_id) {
json.user_id = this.searchFrom.user_id;
} }
}, if (this.searchFrom.sub_user_id) {
methods:{ json.sub_user_id = this.searchFrom.sub_user_id;
onPageChange(val){
this.nowPage = val
this.getUser()
},
onSizeChange(val){
this.limit = val;
this.nowPage = 1;
this.getUser()
},
getUser(){
let json = {
page: this.nowPage,
limit: this.limit
}
if (this.searchFrom.user_id) {
json.user_id = this.searchFrom.user_id
}
if (this.searchFrom.sub_user_id) {
json.sub_user_id = this.searchFrom.sub_user_id
}
getSubAccountListApi(json).then(res=>{
this.userList = res.list;
this.total = res.total
})
} }
getSubAccountListApi(json).then(res => {
this.userList = res.list;
this.total = res.total;
});
} }
} }
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@import "../../util/public"; @import "../../util/public";
.avatar{ .avatar {
width: 50px; width: 50px;
min-width: 50px; min-width: 50px;
height: 50px; height: 50px;
margin-right: 5px; margin-right: 5px;
border-radius: 50%; border-radius: 50%;
} }
</style> </style>
<style> <style>
.f-c > .cell { .f-c > .cell {
display: flex !important; display: flex !important;
flex-flow: row; flex-flow: row;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
} }
</style> </style>
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 to comment