|
|
@@ -0,0 +1,409 @@
|
|
|
+<template>
|
|
|
+ <div v-loading="loading">
|
|
|
+ <div class="white-box">
|
|
|
+ <el-form :model="form" ref="form" label-width="250px" class="form-page">
|
|
|
+ <div class="hr-tip"><span>账号信息</span></div>
|
|
|
+ <el-form-item label="会员编号" prop="insertUserName">
|
|
|
+ <el-input v-model="form.insertUserName"
|
|
|
+ placeholder="请输入要升级的会员编号"
|
|
|
+ :rules="{ required: true, message: '请输入升级的会员编号', trigger: 'blur' }"
|
|
|
+ @blur="upgradeInfo()"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <template slot="label">
|
|
|
+ 升级购买商品
|
|
|
+ </template>
|
|
|
+ <el-tabs type="border-card" v-model="decWay" style="position: relative;width: 600px;">
|
|
|
+ <el-tab-pane name="1">
|
|
|
+ <span slot="label">套餐</span>
|
|
|
+ <el-table class="table-box" :data="_tableData" stripe style="width: 100%;" highlight-current-row @current-change="handleCurrentChange">
|
|
|
+ <el-table-column
|
|
|
+ type="index"
|
|
|
+ width="50">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label=" " width="50">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span class="el-checkbox__input" :class="{'is-checked':scope && scope.row && currentRow && scope.row.ID==currentRow.ID}">
|
|
|
+ <span class="el-checkbox__inner">
|
|
|
+ </span>
|
|
|
+ <input type="checkbox" aria-hidden="false" class="el-checkbox__original" value="">
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="套餐名称" prop="PACKAGE_NAME">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="套餐金额" prop="AMOUNT">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="套餐PV" prop="PV">
|
|
|
+ <template>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="所属报单级别" prop="LEVEL_NAME">
|
|
|
+ <template>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="套餐内容" prop="PACKAGE_CONTENT">
|
|
|
+ <template >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="商品" name="2">
|
|
|
+ <el-table class="table-box" v-if="numList.length > 0" :data="tableDatas" stripe style="width: 100%;" highlight-current-row @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column
|
|
|
+ type="selection"
|
|
|
+ width="55">
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="商品名称" prop="GOODS_NAME">
|
|
|
+
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="商品编号" prop="GOODS_NO">
|
|
|
+
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="卖价" prop="SELL_PRICE">
|
|
|
+
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="PV价格" prop="PRICE_PV">
|
|
|
+
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="数量" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number size="mini" v-model="numList[scope.$index]" :min="0" :max="Number(scope.row.STORE_NUMS)" @change="value=>{handleChange(value,scope.row.ID)}"></el-input-number>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="white-box-footer flex">
|
|
|
+ <el-button @click="getSum()">计算合计</el-button>
|
|
|
+ <div class='flex data' style="flex:1;justify-content: flex-end;">
|
|
|
+ <div style="margin-right:2rem">商品价格:¥{{sell_price_sum}}</div>
|
|
|
+ <div>商品PV:¥{{price_pv_sum}}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注">
|
|
|
+ <el-input type="textarea" v-model="form.remark"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="onSubmit" :loading="submitButtonStat">保存</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import Vue from 'vue'
|
|
|
+ import network from '@/utils/network'
|
|
|
+ import baseInfo from '@/utils/baseInfo'
|
|
|
+ import store from '@/utils/vuexStore'
|
|
|
+ import tool from '@/utils/tool'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: 'user_upgrade',
|
|
|
+ mounted() {
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
+ _tableData(){
|
|
|
+ if(this.tableData==null){
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ if(this.form.decLv==''){
|
|
|
+ return this.tableData;
|
|
|
+ }
|
|
|
+ return this.tableData.filter(item=>{
|
|
|
+ return item.LEVEL_ID == this.form.decLv
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ rules:{
|
|
|
+ ruleTime:[
|
|
|
+ {required: true, message: '请输入地点', trigger: 'blur'}
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ currentRow:null,
|
|
|
+ decWay:'1',
|
|
|
+ regionData: store.state.regionInfo.regionData,
|
|
|
+ form: {
|
|
|
+ remark:'',
|
|
|
+ realName:'',
|
|
|
+ decLv: '',
|
|
|
+ insertUserName:'',
|
|
|
+ decUserName:'',
|
|
|
+ recUserName:'',
|
|
|
+ conUserName:'',
|
|
|
+ insertUserIdCard:'',
|
|
|
+ consignee:'',
|
|
|
+ acceptMobile:'',
|
|
|
+ areaSelected: [],
|
|
|
+ address: '',
|
|
|
+ openBank:'',
|
|
|
+ bankAddress: '',
|
|
|
+ bankProvince: '',
|
|
|
+ bankCity: '',
|
|
|
+ bankCounty: '',
|
|
|
+ bankNo: '',
|
|
|
+ bankAreaSelected: [],
|
|
|
+ password:'111111',
|
|
|
+ payPassword:'111111',
|
|
|
+ mobile:'',
|
|
|
+ packageId:'',
|
|
|
+ goodsId:[],
|
|
|
+ goodsNum:[],
|
|
|
+ province:'',
|
|
|
+ city:'',
|
|
|
+ county:'',
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ conRealName: '-',
|
|
|
+ recRealName: '-',
|
|
|
+ num: 1,
|
|
|
+ tableData:null,
|
|
|
+ tableDatas:null,
|
|
|
+ allOpenBank: null,
|
|
|
+ allDecPackage:{},
|
|
|
+ allDecLevel: baseInfo.decLevels(),
|
|
|
+ loading: false,
|
|
|
+ submitButtonStat: false,
|
|
|
+ submitButton:false,
|
|
|
+ allGoods:[],
|
|
|
+ multipleSelection: [],
|
|
|
+ goodsNums:[],
|
|
|
+ numList: [],
|
|
|
+ sell_price_sum:0.00,
|
|
|
+ price_pv_sum:0.00
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 获取要升级的会员信息
|
|
|
+ upgradeInfo() {
|
|
|
+ if (this.form.insertUserName) {
|
|
|
+ network.postData(`user/upgrade-info`,{userName:this.form.insertUserName}).then(response => {
|
|
|
+ console.log(response)
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ getSum(){
|
|
|
+ let sell_price_sum=0,price_pv_sum=0;
|
|
|
+ this.multipleSelection.map((item,index)=>{
|
|
|
+ console.log(item)
|
|
|
+ sell_price_sum+=Number(item.SELL_PRICE)*item.goodsNum;
|
|
|
+ price_pv_sum+=Number(item.PRICE_PV)*item.goodsNum;
|
|
|
+ })
|
|
|
+ this.sell_price_sum=tool.formatPrice(sell_price_sum);
|
|
|
+ this.price_pv_sum=tool.formatPrice(price_pv_sum);
|
|
|
+ console.log(this.sell_price_sum,this.price_pv_sum)
|
|
|
+ },
|
|
|
+ getData () {
|
|
|
+
|
|
|
+ network.getData(`user/upgrade`).then(response => {
|
|
|
+ console.log(response)
|
|
|
+ this.loading = false;
|
|
|
+ // this.form.insertUserName = response.userName;
|
|
|
+ this.allOpenBank = response.allOpenBank;
|
|
|
+ this.allDecPackage = response.allDecPackage;
|
|
|
+ this.allGoods = response.allGoods;
|
|
|
+ console.log(this.allDecPackage);
|
|
|
+ let settingObj=this.allDecPackage;
|
|
|
+ let settingArr = Object.keys(settingObj).map(key => {
|
|
|
+ //console.log(key); //为每个键名
|
|
|
+ return settingObj[key]; //把每个对象返回出去生成一个新的数组中相当于0:{id:1}
|
|
|
+ });
|
|
|
+ this.tableData=settingArr;
|
|
|
+ let settingObj1=this.allGoods;
|
|
|
+ for(let i in settingObj1){
|
|
|
+ this.numList[i] = 1;
|
|
|
+ settingObj1[i].goodsNum= 1 ;
|
|
|
+ }
|
|
|
+ this.tableDatas=settingObj1;
|
|
|
+ // this.tableDatas=this.allGoods.map(item=>{return {...item,goodsNum:1}});
|
|
|
+
|
|
|
+ console.log(this.tableDatas);
|
|
|
+ console.log(this.numList);
|
|
|
+ }).catch(() => {
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ console.log(val)
|
|
|
+ if(!val){return}
|
|
|
+ this.currentRow = val;
|
|
|
+ this.form.packageId=this.currentRow.ID;
|
|
|
+
|
|
|
+ console.log(this.form.packageId)
|
|
|
+ },
|
|
|
+ // handleSelectionChange(val) {
|
|
|
+ // this.multipleSelection = val;
|
|
|
+ // this.form.goodsId = this.multipleSelection.map(item => item.ID)
|
|
|
+ // this.form.goodsNum = this.multipleSelection.map(item=>{
|
|
|
+ // return item.goodsNum
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ let idx = -1,num;
|
|
|
+ for(let i in this.tableDatas){
|
|
|
+ for(let v in val){
|
|
|
+ if(val[v].ID==this.tableDatas[i].ID){
|
|
|
+ idx = i;
|
|
|
+ num = this.numList[idx];
|
|
|
+ val[v]["goodsNum"] = num;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(val)
|
|
|
+ this.multipleSelection = val;
|
|
|
+
|
|
|
+ },
|
|
|
+ handleChange(value,ID) {
|
|
|
+ for(let i in this.multipleSelection){
|
|
|
+ if(this.multipleSelection[i]['ID']==ID) {
|
|
|
+ this.multipleSelection[i]["goodsNum"] = value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getGoods(){
|
|
|
+ this.form.goodsId=[];
|
|
|
+ this.form.goodsNum=[];
|
|
|
+ this.multipleSelection.map((item,index)=>{
|
|
|
+ console.log(item);
|
|
|
+ console.log('==');
|
|
|
+ this.form.goodsId.push(item.ID)
|
|
|
+ this.form.goodsNum.push(item.goodsNum)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onSubmit() {
|
|
|
+ this.getGoods();
|
|
|
+ this.submitButtonStat = true
|
|
|
+ let path = 'user/upgrade'
|
|
|
+ let postData = {
|
|
|
+ consignee: this.form.consignee,
|
|
|
+ acceptMobile: this.form.acceptMobile,
|
|
|
+ province: this.form.areaSelected[0] ? this.form.areaSelected[0] : '',
|
|
|
+ city: this.form.areaSelected[1] ? this.form.areaSelected[1] : '',
|
|
|
+ county: this.form.areaSelected[2] ? this.form.areaSelected[2] : '',
|
|
|
+ address: this.form.address,
|
|
|
+ insertUserName: this.form.insertUserName,
|
|
|
+ decLv: this.form.decLv,
|
|
|
+ realName: this.form.realName,
|
|
|
+ decUserName: this.form.decUserName,
|
|
|
+ conUserName: this.form.conUserName,
|
|
|
+ recUserName: this.form.recUserName,
|
|
|
+ insertUserIdCard: this.form.insertUserIdCard,
|
|
|
+ openBank: this.form.openBank,
|
|
|
+ bankAddress: this.form.bankAddress,
|
|
|
+ mobile: this.form.mobile,
|
|
|
+
|
|
|
+ bankProvince: this.form.bankAreaSelected[0] ? this.form.bankAreaSelected[0] : '',
|
|
|
+ bankCity: this.form.bankAreaSelected[1] ? this.form.bankAreaSelected[1] : '',
|
|
|
+ bankCounty: this.form.bankAreaSelected[2] ? this.form.bankAreaSelected[2] : '',
|
|
|
+
|
|
|
+
|
|
|
+ bankNo: this.form.bankNo,
|
|
|
+ password: this.form.password,
|
|
|
+ payPassword: this.form.payPassword,
|
|
|
+ packageId: this.form.packageId,
|
|
|
+ goodsId: this.form.goodsId,
|
|
|
+ goodsNum: this.form.goodsNum,
|
|
|
+ location: this.form.location,
|
|
|
+ decWay:this.decWay
|
|
|
+ }
|
|
|
+
|
|
|
+ return network.postData(path, postData).then(response => {
|
|
|
+ console.log(response);
|
|
|
+ this.$message({
|
|
|
+ message: response,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.submitButtonStat = false
|
|
|
+ this.$router.go(-1)
|
|
|
+ }).catch(() => {
|
|
|
+ this.submitButtonStat = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ selectOne(event, item) {
|
|
|
+ network.getData(`user/upgrade`).then(response => {
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ handleChkConUser() {
|
|
|
+ if (this.form.conUserName) {
|
|
|
+ this.loading = true
|
|
|
+ network.getData('user/full-info', {userName: this.form.conUserName}).then(response => {
|
|
|
+ this.conRealName = response.REAL_NAME + response.isLocation
|
|
|
+ this.loading = false
|
|
|
+ }).catch(response => {
|
|
|
+ this.conRealName = '-'
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ handleChkRecUser() {
|
|
|
+ if (this.form.recUserName) {
|
|
|
+ this.loading = true
|
|
|
+ network.getData('user/full-info', {userName: this.form.recUserName}).then(response => {
|
|
|
+ this.recRealName = response.REAL_NAME
|
|
|
+ this.loading = false
|
|
|
+ }).catch(response => {
|
|
|
+ this.recRealName = '-'
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+ .hr-tip {
|
|
|
+ font-size: 12px;
|
|
|
+ position: relative;
|
|
|
+ text-align: center;
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+ color: #999;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .hr-tip:before {
|
|
|
+ content: '';
|
|
|
+ display: block;
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ top: 14px;
|
|
|
+ border-bottom: 1px dashed #ddd;
|
|
|
+ height: 1px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .hr-tip span {
|
|
|
+ display: inline-block;
|
|
|
+ background: #fff;
|
|
|
+ position: relative;
|
|
|
+ padding: 0 10px;
|
|
|
+ }
|
|
|
+ .el-input-number--mini .el-input-number__decrease, .el-input-number--mini .el-input-number__increase{width: 22px!important}
|
|
|
+ .el-input-number.is-controls-right .el-input__inner{padding-left: 10px;
|
|
|
+ padding-right: 30px;}
|
|
|
+ .el-tabs--border-card{
|
|
|
+ position: relative;
|
|
|
+ width: 600px;
|
|
|
+ }
|
|
|
+ .flex{
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
+</style>
|