|
|
@@ -233,268 +233,267 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import Vue from 'vue'
|
|
|
- import network from '@/utils/network'
|
|
|
- import baseInfo from '@/utils/baseInfo'
|
|
|
- import userInfo from '@/utils/userInfo'
|
|
|
- import store from '@/utils/vuexStore'
|
|
|
- import tool from '@/utils/tool'
|
|
|
-
|
|
|
- export default {
|
|
|
- name: 'user_dec',
|
|
|
- mounted() {
|
|
|
- this.getData()
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.getDecName()
|
|
|
- },
|
|
|
- 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 {
|
|
|
- currentRow:null,
|
|
|
- decWay:'1',
|
|
|
- regionData: store.state.regionInfo.regionData,
|
|
|
- form: {
|
|
|
-
|
|
|
- realName:'',
|
|
|
- decLv: '',
|
|
|
- insertUserName:'',
|
|
|
- decUserName:'',
|
|
|
- recUserName:'',
|
|
|
- conUserName:'',
|
|
|
- insertUserIdCard:'',
|
|
|
- consignee:'',
|
|
|
- acceptMobile:'',
|
|
|
- areaSelected: [],
|
|
|
- address: '',
|
|
|
- openBank:'',
|
|
|
- bankAddress: '',
|
|
|
- bankProvince: '',
|
|
|
- bankCity: '',
|
|
|
- bankCounty: '',
|
|
|
- bankNo: '',
|
|
|
- bankAreaSelected: [],
|
|
|
- password:'',
|
|
|
- payPassword:'',
|
|
|
- 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: {
|
|
|
- getDecName() {
|
|
|
- this.form.decUserName = userInfo.userName()
|
|
|
- },
|
|
|
- idcarChange() {
|
|
|
- if (this.form.insertUserIdCard.length >= 6) {
|
|
|
- this.form.payPassword = this.form.password = this.form.insertUserIdCard.substring(this.form.insertUserIdCard.length-6,this.form.insertUserIdCard.length);
|
|
|
- } else {
|
|
|
- this.form.payPassword = this.form.password = '111111'
|
|
|
- }
|
|
|
- },
|
|
|
- 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/dec`).then(response => {
|
|
|
- this.loading = false;
|
|
|
- this.form.insertUserName = response.userName;
|
|
|
- this.allOpenBank = response.allOpenBank;
|
|
|
- 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;
|
|
|
- // this.tableDatas=this.allGoods.map(item=>{return {...item,goodsNum:1}});
|
|
|
- }).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/dec'
|
|
|
- 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/dec`).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
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
+import Vue from 'vue'
|
|
|
+import network from '@/utils/network'
|
|
|
+import baseInfo from '@/utils/baseInfo'
|
|
|
+import userInfo from '@/utils/userInfo'
|
|
|
+import store from '@/utils/vuexStore'
|
|
|
+import tool from '@/utils/tool'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'user_dec',
|
|
|
+ mounted () {
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.getDecName()
|
|
|
+ },
|
|
|
+ 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 {
|
|
|
+ currentRow: null,
|
|
|
+ decWay: '1',
|
|
|
+ regionData: store.state.regionInfo.regionData,
|
|
|
+ form: {
|
|
|
+ realName: '',
|
|
|
+ decLv: '',
|
|
|
+ insertUserName: '',
|
|
|
+ decUserName: '',
|
|
|
+ recUserName: '',
|
|
|
+ conUserName: '',
|
|
|
+ insertUserIdCard: '',
|
|
|
+ consignee: '',
|
|
|
+ acceptMobile: '',
|
|
|
+ areaSelected: [],
|
|
|
+ address: '',
|
|
|
+ openBank: '',
|
|
|
+ bankAddress: '',
|
|
|
+ bankProvince: '',
|
|
|
+ bankCity: '',
|
|
|
+ bankCounty: '',
|
|
|
+ bankNo: '',
|
|
|
+ bankAreaSelected: [],
|
|
|
+ password: '',
|
|
|
+ payPassword: '',
|
|
|
+ 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: {
|
|
|
+ getDecName () {
|
|
|
+ this.form.decUserName = userInfo.userName()
|
|
|
+ },
|
|
|
+ idcarChange () {
|
|
|
+ if (this.form.insertUserIdCard.length >= 6) {
|
|
|
+ this.form.payPassword = this.form.password = this.form.insertUserIdCard.substring(this.form.insertUserIdCard.length - 6, this.form.insertUserIdCard.length)
|
|
|
+ } else {
|
|
|
+ this.form.payPassword = this.form.password = '111111'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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/dec`).then(response => {
|
|
|
+ this.loading = false
|
|
|
+ this.form.insertUserName = response.userName
|
|
|
+ this.allOpenBank = response.allOpenBank
|
|
|
+ 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
|
|
|
+ // this.tableDatas=this.allGoods.map(item=>{return {...item,goodsNum:1}});
|
|
|
+ }).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/dec'
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ if (this.form.goodsId.length === 0 && this.form.packageId.length === 0) {
|
|
|
+ this.$message({
|
|
|
+ message: '未选择商品或套餐',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ this.submitButtonStat = false
|
|
|
+ }
|
|
|
+ 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/dec`).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>
|