|
|
@@ -1,468 +1,484 @@
|
|
|
-<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 label="会员级别">
|
|
|
- <el-input v-model="form.userDecName"
|
|
|
- disabled
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="会员姓名">
|
|
|
- <el-input v-model="form.userRealName"
|
|
|
- disabled
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="加入日期">
|
|
|
- <el-input v-model="form.addAt"
|
|
|
- disabled
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="!isMax" label="升级方式">
|
|
|
- <el-input v-model="form.upgradeFunc"
|
|
|
- disabled
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="!isMax" label="升级级别" prop="upgradeValue">
|
|
|
- <el-select v-model="form.upgradeValue" placeholder="请选择级别" @change="changeLevel">
|
|
|
- <el-option
|
|
|
- v-for="item in upgradeOption"
|
|
|
- :key="item.ID"
|
|
|
- :label="item.LEVEL_NAME"
|
|
|
- :value="{value:item.ID, diffPv:item.REPAIR_PV}">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="!isMax" label="升级补差业绩">
|
|
|
- <el-input v-model="needDiffPv"
|
|
|
- disabled
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="!isMax">
|
|
|
- <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 v-if="!isMax">
|
|
|
- <template slot="label">
|
|
|
- 收货人
|
|
|
- </template>
|
|
|
- <el-input v-model="form.consignee"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="!isMax">
|
|
|
- <template slot="label">
|
|
|
- 收货人手机
|
|
|
- </template>
|
|
|
- <el-input v-model="form.acceptMobile"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="!isMax" prop="areaSelected">
|
|
|
- <template slot="label">
|
|
|
- 地区
|
|
|
- </template>
|
|
|
- <el-cascader
|
|
|
- size="large"
|
|
|
- :options="regionData"
|
|
|
- v-model="form.areaSelected">
|
|
|
- </el-cascader>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="!isMax">
|
|
|
- <template slot="label">
|
|
|
- 详细地址
|
|
|
- </template>
|
|
|
- <el-input v-model="form.address"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="!isMax" label="备注">
|
|
|
- <el-input type="textarea" v-model="form.remark"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="!isMax">
|
|
|
- <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 {
|
|
|
- nowPerf:'',
|
|
|
- nextPerf:'',
|
|
|
- decUserName:'',
|
|
|
- needDiffPv:'',
|
|
|
- isMax:true,
|
|
|
- upgradeOption:[],
|
|
|
- toLevel:'',
|
|
|
- currentRow:null,
|
|
|
- decWay:'2',
|
|
|
- regionData: store.state.regionInfo.regionData,
|
|
|
- form: {
|
|
|
- address:'',
|
|
|
- areaSelected:[],
|
|
|
- consignee:'',
|
|
|
- upgradeFunc:'',
|
|
|
- upgradeValue:'',
|
|
|
- addAt:'',
|
|
|
- userRealName:'',
|
|
|
- userDecName:'',
|
|
|
- remark:'',
|
|
|
- realName:'',
|
|
|
- decLv: '',
|
|
|
- insertUserName:'',
|
|
|
- decUserName:'',
|
|
|
- recUserName:'',
|
|
|
- conUserName:'',
|
|
|
- insertUserIdCard:'',
|
|
|
- packageId:'',
|
|
|
- goodsId:[],
|
|
|
- goodsNum:[],
|
|
|
- province:'',
|
|
|
- city:'',
|
|
|
- county:'',
|
|
|
- acceptMobile:'',
|
|
|
-
|
|
|
- },
|
|
|
- num: 1,
|
|
|
- tableData:null,
|
|
|
- tableDatas:null,
|
|
|
- allDecPackage:{},
|
|
|
- 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 => {
|
|
|
- this.form.addAt=response.baseInfo.ADD_AT
|
|
|
- this.form.userRealName=response.baseInfo.REAL_NAME
|
|
|
- this.form.userDecName=response.baseInfo.DEC_NAME
|
|
|
- this.isMax = response.baseInfo.IS_MAX
|
|
|
- this.upgradeOption = response.baseInfo.LEVEL_LIST
|
|
|
- this.form.upgradeFunc = response.baseInfo.UPGRADE_FUNC //upgradeFunc升级方式
|
|
|
- this.nowPerf = response.baseInfo.NOW_PERF // 用户当前业绩
|
|
|
- this.nextPerf = response.baseInfo.NEXT_PERF
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- changeLevel(data) {
|
|
|
- let { value,diffPv } = data
|
|
|
- this.needDiffPv = diffPv
|
|
|
- this.toLevel = value
|
|
|
- },
|
|
|
- getSum(){
|
|
|
- let sell_price_sum=0,price_pv_sum=0;
|
|
|
- this.multipleSelection.map((item,index)=>{
|
|
|
- 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);
|
|
|
- },
|
|
|
- getData () {
|
|
|
- network.getData(`user/upgrade`).then(response => {
|
|
|
- this.decUserName = response.decUserName
|
|
|
- this.loading = false;
|
|
|
- this.allDecPackage = response.allDecPackage;
|
|
|
- this.allGoods = response.allGoods;
|
|
|
- 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;
|
|
|
-
|
|
|
- }).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) {
|
|
|
- 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() {
|
|
|
- if (!this.form.insertUserName) {
|
|
|
- this.$message({
|
|
|
- message: '请输入会员编号',
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (!this.toLevel) {
|
|
|
- this.$message({
|
|
|
- message: '请选择级别',
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- return false
|
|
|
- }
|
|
|
-
|
|
|
- this.getGoods();
|
|
|
- this.submitButtonStat = true
|
|
|
- let path = 'user/upgrade'
|
|
|
- let postData = {
|
|
|
- decUserName:this.decUserName,
|
|
|
- packageId: this.form.packageId,
|
|
|
- goodsId: this.form.goodsId,
|
|
|
- goodsNum: this.form.goodsNum,
|
|
|
- location: this.form.location,
|
|
|
- decWay:this.decWay,
|
|
|
- decLv:this.toLevel, // 用户想升级到什么级别
|
|
|
- insertUserName:this.form.insertUserName, // 要升级的用户的编号
|
|
|
- remark:this.form.remark,
|
|
|
- address: this.form.address,
|
|
|
- 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] : '',
|
|
|
- nowPerf:this.nowPerf,
|
|
|
- nextPerf:this.nextPerf
|
|
|
- }
|
|
|
-
|
|
|
- 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;
|
|
|
- }
|
|
|
- .form-page{
|
|
|
- width:100% !important;
|
|
|
- }
|
|
|
-</style>
|
|
|
+<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 label="会员级别">
|
|
|
+ <el-input v-model="form.userDecName"
|
|
|
+ disabled
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="会员姓名">
|
|
|
+ <el-input v-model="form.userRealName"
|
|
|
+ disabled
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="加入日期">
|
|
|
+ <el-input v-model="form.addAt"
|
|
|
+ disabled
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isMax" label="升级方式">
|
|
|
+ <el-input v-model="form.upgradeFunc"
|
|
|
+ disabled
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isMax" label="升级级别" prop="upgradeValue">
|
|
|
+ <el-select v-model="form.upgradeValue" placeholder="请选择级别" @change="changeLevel">
|
|
|
+ <el-option
|
|
|
+ v-for="item in upgradeOption"
|
|
|
+ :key="item.ID"
|
|
|
+ :label="item.LEVEL_NAME"
|
|
|
+ :value="{value:item.ID, diffPv:item.REPAIR_PV}">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isMax" label="升级补差业绩">
|
|
|
+ <el-input v-model="needDiffPv"
|
|
|
+ disabled
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isMax">
|
|
|
+ <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 v-if="!isMax">
|
|
|
+ <template slot="label">
|
|
|
+ 收货人
|
|
|
+ </template>
|
|
|
+ <el-input v-model="form.consignee"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isMax">
|
|
|
+ <template slot="label">
|
|
|
+ 收货人手机
|
|
|
+ </template>
|
|
|
+ <el-input v-model="form.acceptMobile"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isMax" prop="areaSelected">
|
|
|
+ <template slot="label">
|
|
|
+ 地区
|
|
|
+ </template>
|
|
|
+ <el-cascader
|
|
|
+ size="large"
|
|
|
+ :options="regionData"
|
|
|
+ v-model="form.areaSelected">
|
|
|
+ </el-cascader>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isMax">
|
|
|
+ <template slot="label">
|
|
|
+ Local Government Area
|
|
|
+ </template>
|
|
|
+ <el-input v-model="form.lgaName"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isMax">
|
|
|
+ <template slot="label">
|
|
|
+ City
|
|
|
+ </template>
|
|
|
+ <el-input v-model="form.cityName"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isMax">
|
|
|
+ <template slot="label">
|
|
|
+ 详细地址
|
|
|
+ </template>
|
|
|
+ <el-input v-model="form.address"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isMax" label="备注">
|
|
|
+ <el-input type="textarea" v-model="form.remark"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isMax">
|
|
|
+ <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 {
|
|
|
+ nowPerf:'',
|
|
|
+ nextPerf:'',
|
|
|
+ decUserName:'',
|
|
|
+ needDiffPv:'',
|
|
|
+ isMax:true,
|
|
|
+ upgradeOption:[],
|
|
|
+ toLevel:'',
|
|
|
+ currentRow:null,
|
|
|
+ decWay:'2',
|
|
|
+ regionData: store.state.regionInfo.regionData,
|
|
|
+ form: {
|
|
|
+ address:'',
|
|
|
+ areaSelected:[],
|
|
|
+ consignee:'',
|
|
|
+ upgradeFunc:'',
|
|
|
+ upgradeValue:'',
|
|
|
+ addAt:'',
|
|
|
+ userRealName:'',
|
|
|
+ userDecName:'',
|
|
|
+ remark:'',
|
|
|
+ realName:'',
|
|
|
+ decLv: '',
|
|
|
+ insertUserName:'',
|
|
|
+ decUserName:'',
|
|
|
+ recUserName:'',
|
|
|
+ conUserName:'',
|
|
|
+ insertUserIdCard:'',
|
|
|
+ packageId:'',
|
|
|
+ goodsId:[],
|
|
|
+ goodsNum:[],
|
|
|
+ province:'',
|
|
|
+ // city:'',
|
|
|
+ // county:'',
|
|
|
+ lgaName:'',
|
|
|
+ cityName:'',
|
|
|
+ acceptMobile:'',
|
|
|
+
|
|
|
+ },
|
|
|
+ num: 1,
|
|
|
+ tableData:null,
|
|
|
+ tableDatas:null,
|
|
|
+ allDecPackage:{},
|
|
|
+ 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 => {
|
|
|
+ this.form.addAt=response.baseInfo.ADD_AT
|
|
|
+ this.form.userRealName=response.baseInfo.REAL_NAME
|
|
|
+ this.form.userDecName=response.baseInfo.DEC_NAME
|
|
|
+ this.isMax = response.baseInfo.IS_MAX
|
|
|
+ this.upgradeOption = response.baseInfo.LEVEL_LIST
|
|
|
+ this.form.upgradeFunc = response.baseInfo.UPGRADE_FUNC //upgradeFunc升级方式
|
|
|
+ this.nowPerf = response.baseInfo.NOW_PERF // 用户当前业绩
|
|
|
+ this.nextPerf = response.baseInfo.NEXT_PERF
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeLevel(data) {
|
|
|
+ let { value,diffPv } = data
|
|
|
+ this.needDiffPv = diffPv
|
|
|
+ this.toLevel = value
|
|
|
+ },
|
|
|
+ getSum(){
|
|
|
+ let sell_price_sum=0,price_pv_sum=0;
|
|
|
+ this.multipleSelection.map((item,index)=>{
|
|
|
+ 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);
|
|
|
+ },
|
|
|
+ getData () {
|
|
|
+ network.getData(`user/upgrade`).then(response => {
|
|
|
+ this.decUserName = response.decUserName
|
|
|
+ this.loading = false;
|
|
|
+ this.allDecPackage = response.allDecPackage;
|
|
|
+ this.allGoods = response.allGoods;
|
|
|
+ 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;
|
|
|
+
|
|
|
+ }).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) {
|
|
|
+ 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() {
|
|
|
+ if (!this.form.insertUserName) {
|
|
|
+ this.$message({
|
|
|
+ message: '请输入会员编号',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!this.toLevel) {
|
|
|
+ this.$message({
|
|
|
+ message: '请选择级别',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getGoods();
|
|
|
+ this.submitButtonStat = true
|
|
|
+ let path = 'user/upgrade'
|
|
|
+ let postData = {
|
|
|
+ decUserName:this.decUserName,
|
|
|
+ packageId: this.form.packageId,
|
|
|
+ goodsId: this.form.goodsId,
|
|
|
+ goodsNum: this.form.goodsNum,
|
|
|
+ location: this.form.location,
|
|
|
+ decWay:this.decWay,
|
|
|
+ decLv:this.toLevel, // 用户想升级到什么级别
|
|
|
+ insertUserName:this.form.insertUserName, // 要升级的用户的编号
|
|
|
+ remark:this.form.remark,
|
|
|
+ address: this.form.address,
|
|
|
+ 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] : '',
|
|
|
+ lgaName: this.form.lgaName,
|
|
|
+ cityName: this.form.cityName,
|
|
|
+ nowPerf:this.nowPerf,
|
|
|
+ nextPerf:this.nextPerf
|
|
|
+ }
|
|
|
+
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ .form-page{
|
|
|
+ width:100% !important;
|
|
|
+ }
|
|
|
+</style>
|