Jelajahi Sumber

新增价格管理

ymy 1 tahun lalu
induk
melakukan
e34cd8ff9c

+ 2 - 2
.env.production

@@ -8,8 +8,8 @@ ENV = 'production'
 VUE_APP_BASE_API = '/prod-api'
 
 # 登录地址 正式
-VUE_APP_LOGIN_URL = 'https://sso.lzlxylsf.com/#/'
+# VUE_APP_LOGIN_URL = 'https://sso.lzlxylsf.com/#/'
 # 开发
 # VUE_APP_LOGIN_URL = 'https://sso.benyuntech.com/#/'
 # 测试
-# VUE_APP_LOGIN_URL = 'https://ssotest.benyuntech.com/#/sso/auth'
+VUE_APP_LOGIN_URL = 'https://ssotest.benyuntech.com/#/sso/auth'

+ 35 - 0
src/api/priceManage.ts

@@ -0,0 +1,35 @@
+import request from '@/benyun/utils/request'
+//查询
+export function queryPrice(data:any){
+	return request({
+		url: '/omsOrder/gradePrice/queryAll',
+		method: 'GET',
+    params:data
+	})
+}
+// 新增
+export function add(data:any){
+	return request({
+		url: '/omsOrder/gradePrice/save',
+		method: 'POST',
+    data:data
+	})
+}
+
+// 新增
+export function update(data:any){
+	return request({
+		url: '/omsOrder/gradePrice/update',
+		method: 'POST',
+    data:data
+	})
+}
+
+// 删除
+export function del(data:any) {
+  return request({
+		url: '/omsOrder/gradePrice/delete',
+		method: 'POST',
+    params:data
+	})
+}

+ 5 - 1
src/benyun/components/byInput/byInput.vue

@@ -78,7 +78,10 @@ export default class ByInput extends VueViews {
     if(data || data === 0){
       this.value = (this as any).$lodash.cloneDeep(data);
       if(this.attrs.type == 'number'){
-        this.value = Number(data);
+        if(data !== '-') {
+          this.value = Number(data);
+        }
+        
       }
     }else{
       this.value = null;
@@ -95,6 +98,7 @@ export default class ByInput extends VueViews {
   }
 
   onChange(){
+    console.log(this.value)
     this.$emit('onChange',this.value);
     
   }

+ 1 - 1
src/benyun/components/byTable/byTable.vue

@@ -57,7 +57,7 @@
           :tree-node="item.treeNode"
         >
           <template #default="scope">
-            <slot v-if="item.slot" :name='item.field' :row='scope.row'></slot>
+            <slot v-if="item.slot" :name='item.field' :row='scope.row' :rowIndex="scope.rowIndex"></slot>
             <component v-else-if="item.component" :is="item.component" :ref="item.field+'Comp'" :propConfig="item.compConfig" :parentValue="scope.row"
               :propValue="scope.row[item.field]" @onChange="onChange($event, scope,item.field)" />
             <template v-else>

+ 49 - 4
src/views/oms/B2BOrder/components/addOrder.vue

@@ -104,10 +104,20 @@
               </vxe-input>
               <span v-else>{{ row.qty }}</span>
             </template>
-            <template v-slot:price='{ row }'>
+            <template v-slot:price='{ row,rowIndex }'>
               <span v-if="row.isGift == 1">0</span>
-              <vxe-input v-else-if="!orderValue.id" v-model="row.price" placeholder="单价" align="center" size="mini" type="number" @input="priceChange($event, row)" >
-              </vxe-input>
+
+              <!-- <el-input :placeholder="!orderValue.id?'请选择标签':''" :value="value.shopName" :disabled="orderValue.id?true:false" @clear="clearShop" size="small" class="myinpuy-with-select" clearable>
+                <el-button slot="append" v-if="!orderValue.id" icon="el-icon-more" @click="showShop"></el-button>
+              </el-input> -->
+
+              <el-input v-else-if="!orderValue.id" v-model="row.price" placeholder="单价" align="center" size="mini" @input="priceChange($event, row)" >
+                <el-button slot="append" class="price-btn" icon="el-icon-more" @click="showPrice(rowIndex)"></el-button>
+              </el-input>
+              
+              <!-- <el-select v-else-if="!orderValue.id" v-model="row.price" size="mini" filterable allow-create @input="priceChange($event, row)" default-first-option style="width:140px" placeholder="请选择或输入价格">
+                <el-option v-for="item in priceOption" :key="item.id" :label="item.price" :value="item.id"></el-option>
+              </el-select> -->
               <span v-else>{{ row.price }}</span>
             </template>
           </by-table>
@@ -176,6 +186,8 @@
       <el-drawer class="log-drawer" :size="600" append-to-body title="操作日志" :visible.sync="drawer" direction="rtl">
         <byLog :propConfig="logConfig" ref="log" />
       </el-drawer>
+      <!-- 价格弹窗 -->
+      <priceModal ref="priceModal" @priceHandle="priceHandle" />
     </template>
     <template #footer>
       <div class="btn">
@@ -197,7 +209,8 @@ import EditProductModal from "./editProductModal.vue";
 import LabelsModal from "./labelsModal.vue";
 import ShopModal from "./shopModal.vue";
 import BuyerInfoModal from "./buyerInfoModal.vue";
-@Component({components:{AddProductModal,EditProductModal,LabelsModal,ShopModal,BuyerInfoModal}})
+import priceModal from "./priceModal.vue"
+@Component({components:{AddProductModal,EditProductModal,LabelsModal,ShopModal,BuyerInfoModal, priceModal}})
 export default class AddOrder extends Vue {
   logConfig:any={
     request:{
@@ -216,6 +229,7 @@ export default class AddOrder extends Vue {
   orderValue:any={}; //新增订单值
   radioPay=1;
   stepActive:number=0;
+  priceOption:Array<any>=[]; //价格列表
   topStep=['WaitPay','WaitConfirm','Delivering']
   stepCon=['WaitPay','WaitConfirm','WaitFConfirm','WaitOuterSent','Sent','Delivering']
   activeNames:Array<any> =['1','2','3','4','5','save'];
@@ -871,6 +885,30 @@ export default class AddOrder extends Vue {
       callback();
     }
   }
+  proCurrentIndex:any=null;
+  // 显示价格弹窗
+  showPrice(v:any) {
+    this.proCurrentIndex = v;
+    if(this.$refs.priceModal) {
+      (this.$refs.priceModal as any).setShow(true);
+    }
+  }
+  // 已选择的价格
+  priceHandle(v:any) {
+    let data = (this.$refs.table as any).getValue();
+    data[this.proCurrentIndex].price = v;
+
+    if(v && data[this.proCurrentIndex].qty){
+      data[this.proCurrentIndex].amount =multiply(Number(v),Number(data[this.proCurrentIndex].qty))
+    }else{
+      data[this.proCurrentIndex].amount = 0
+    }
+    this.totalAmount();
+    this.amountChange();
+    this.payAmountChange();
+    (this.$refs.table as any).setValue(data);
+    this.$forceUpdate()
+  }
   //订单来源转换文字信息
   getFromText(f:any){
     let t='';
@@ -1627,6 +1665,7 @@ export default class AddOrder extends Vue {
   display: flex;
   justify-content: flex-end;
 }
+
 .btn-save{
   width: 100%;
   display: flex;
@@ -1761,4 +1800,10 @@ export default class AddOrder extends Vue {
     }
   }
 }
+.price-btn{
+  width: 25px !important;
+  display: flex !important;
+  justify-content: center !important;
+  align-items: center !important;
+}
 </style>

+ 84 - 0
src/views/oms/B2BOrder/components/priceModal.vue

@@ -0,0 +1,84 @@
+<template>
+  <vxe-modal v-model="value" id="questModel" width="60%" v-loading="load" @show="show" height="80%" show-zoom resize transfer show-footer>
+    <template #title>
+      <span>异常类型</span>
+    </template>
+    <by-table :propConfig="tableConfig" ref="table" id="quest-table"></by-table>
+    <template #footer>
+      <div class="btn">
+        <el-button plain size="small" @click="value = false">取消</el-button>
+        <el-button type="primary" size="small" @click="btn">确定</el-button>
+      </div>
+    </template>
+  </vxe-modal>
+</template>
+
+<script lang="ts">
+import { Component, Prop, Vue, Watch } from "vue-property-decorator";
+import { queryPrice } from '@/api/priceManage'
+@Component({components:{}})
+export default class QuestModel extends Vue {
+  value=false;
+  load=false;
+  tableConfig:any={
+    attr:{
+      size:'mini',
+      seq:true,
+      align:'center',
+      triggerRowCheck:'row',
+      radio:true
+    },
+    columns:[{
+      title:'价格',
+      field:'price'
+    },
+    {
+      title:'备注',
+      field:'remark'
+    }
+  ]}
+  data:Array<any>=[]
+  mounted(){
+    
+  }
+  btn(){
+    let data:Array<any> = (this.$refs.table as any).getSelectData();
+    if(!data || data.length == 0){
+      this.$message('请选择数据!');
+      return
+    }
+    this.$emit('priceHandle', data[0].price)
+    this.value = false
+  }
+  show(){
+    let height = (document.getElementById('quest-table') as any).parentNode.offsetHeight;
+    this.tableConfig.attr.height=height - 36;
+    (this.$refs.table as any).setConfig(this.tableConfig);
+    this.getList()
+  }
+  //获取数据
+  getList(){
+    this.load = true;
+    this.data = [];
+    queryPrice({}).then((res:any) => {
+      for(const item of res.data) {
+        this.data.push(item)
+      }
+      if(this.$refs.table){
+        (this.$refs.table as any).setValue(this.data);
+      }
+      this.load = false;
+    }).catch((err:any) => {
+      this.load = false;
+    })
+  }
+
+  setShow(v:boolean){
+    this.value = v;
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 2 - 2
src/views/oms/B2BOrder/index.vue

@@ -496,9 +496,9 @@ export default class Order extends Vue {
       return
     }
     let ids:string='';
-    let noStatus = ['WaitPay','Delivering','Merged','Split','Question','Sent','Cancelled'];
+    let noStatus = ['Delivering','Merged','Split','Question','Sent','Cancelled'];
     for(const item of data){
-      if(!(item.isSubmitted == 1 && item.pays && item.pays.length > 0 && noStatus.indexOf(item.status) == -1)){
+      if(!(item.isSubmitted == 1 && noStatus.indexOf(item.status) == -1)){
         ids = ids ? ids + ',' + item.id : item.id;
       }
     }

+ 2 - 2
src/views/oms/B2COrder/index.vue

@@ -486,9 +486,9 @@ export default class Order extends Vue {
       return
     }
     let ids:string='';
-    let noStatus = ['WaitPay','Delivering','Merged','Split','Question','Sent','Cancelled'];
+    let noStatus = ['Delivering','Merged','Split','Question','Sent','Cancelled'];
     for(const item of data){
-      if(!(item.isSubmitted == 1 && item.pays && item.pays.length > 0 && noStatus.indexOf(item.status) == -1)){
+      if(!(item.isSubmitted == 1 && noStatus.indexOf(item.status) == -1)){
         ids = ids ? ids + ',' + item.id : item.id;
       }
     }

+ 264 - 0
src/views/oms/priceManage/index.vue

@@ -0,0 +1,264 @@
+<template>
+  <div class="priceManage">
+    <module-view :propConfig="config" ref="view" v-loading="load" @modalHandle="modalHandle" @onRefresh="getList" 
+    @resert="queryList" @search="queryList" @clickHandle="clickHandle" @detail="detail" />
+  </div>
+</template>
+
+<script lang="ts">
+import { Component, Prop, Vue, Watch } from "vue-property-decorator";
+import { queryPrice, add, update, del } from '@/api/priceManage'
+import { number } from "echarts";
+@Component({components:{}})
+export default class SourceShop extends Vue {
+  load=false;
+  time:any;
+  timeNum = 0;
+  isSearch=false;
+  config:any={
+    attr:{
+      calculateH:true
+    },
+    // search:{
+    //   attr:{
+    //     size:'small'
+    //   },
+    //   columns:[]
+    // },
+    tool:{
+      tools:{
+        add:true,
+        delete:true,
+        // search:true,
+        refresh:true
+      }
+    },
+    table:{
+      attr:{
+        size:'mini',
+        seq:true,
+        align:'center',
+        checkbox:true
+      },
+      columns:[{
+        title:'价格',
+        field:'price',
+        isDetail:true,
+      },
+      // {
+      //   title:'类型',
+      //   field:'type'
+      // },
+      {
+        title:'备注',
+        field:'remark',
+      },
+      {
+        title:'操作',
+        action:true,
+        width:100,
+        plugins:[{
+          name:'删除',
+          event:{
+            click:(item:any) => {
+              this.del([item.id]);
+            }
+          }
+        }]
+      }
+    ]
+    },
+    modal:{
+      tool:{
+        tools:{
+          return:true,
+          add:true
+        }
+      },
+      form:{
+        attr:{
+          width:'800px',
+          size:'small',
+          labelWidth:'130px',
+          rules:{
+            price:[
+              {required: true, message: '请输入价格', trigger: 'blur'}
+            ]
+          }
+        },
+        columns:[
+          [{
+            label:'价格',
+            prop:'price',
+            component:'by-input',
+            compConfig: {
+              attr:{
+                type: 'float'
+              }
+            }
+          }],
+          // [{
+          //   label:'类型',
+          //   prop:'type',
+          //   component:'by-input'
+          // }],
+          [{
+            label:'备注',
+            prop:'remark',
+            component:'by-input'
+          }]
+        ]
+      }
+    }
+  }
+  mounted(){
+    this.$nextTick(()=>{
+      this.getList()
+    })
+  }
+  //删除
+  del(ids:Array<number>){
+    this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning'
+    }).then(() => {
+      this.load = true;
+      del({ids:ids}).then(()=>{
+        this.load = false;
+        this.$message({
+          message:'删除成功!',
+          type:'success'
+        })
+        this.pagination();
+      }).catch(()=>{
+        this.load = false;
+      })
+    }).catch(() => {});
+  }
+  //分页
+  pagination(){
+    if(this.isSearch){
+      this.queryList();
+    }else{
+      this.getList()
+    }
+  }
+  //列表请求(只有分页,不包含搜素条件)
+  getList(){
+    if(!this.$refs.view){
+      if(this.timeNum > 5){
+        return
+      }
+      setTimeout(()=>{
+        this.getList()
+      },500) 
+      this.timeNum ++;
+      return
+    }
+    this.isSearch = false;
+    let data = (this.$refs.view as any).getPage();
+    this.requestList(data);
+  }
+  //列表请求(包含分页和搜素条件)
+  queryList(){
+    this.isSearch = true;
+    let data = (this.$refs.view as any).getQuery();
+    this.requestList(data);
+  }
+  requestList(data:any){
+    this.load = true;
+    queryPrice(data).then((res:any) => {
+      this.load = false;
+      (this.$refs.view as any).setTableValue(res.data);
+      // let page = {
+      //   pageNo: res.data.current, //当前页
+      //   pageSize: res.data.size, //每页条数
+      //   total: res.data.total //总条数
+      // };
+      // (this.$refs.view as any).setPage(page)
+
+    }).catch(()=>{
+      this.load = false;
+    })
+  }
+  //修改价格数据
+  onSave(){
+    let data = (this.$refs.view as any).getFormValue();
+    this.load = true;
+    update(data).then((res:any) => {
+      this.$message({
+        message:res.msg,
+        type:'success'
+      });
+      this.load = false;
+      (this.$refs.view as any).closeModal();
+      this.pagination();
+    }).catch(()=>{
+      this.load = false;
+    })
+  }
+  //表单工具栏按钮事件
+  modalHandle(n:string){
+    if(n == 'onAdd'){
+      (this.$refs.view as any).getFormValidate(this.addPrice)
+    }
+
+    if(n == 'onSave'){
+      (this.$refs.view as any).getFormValidate(this.onSave)
+    }
+  }
+  //表格工具栏按钮事件
+  clickHandle(n:string){ 
+    if(n == 'onAdd'){
+      this.config.modal.tool.tools.add = true;
+      delete this.config.modal.tool.tools.save;
+      (this.$refs.view as any).initFormTool();
+    }
+    if(n == 'onDelete') {
+      let data = (this.$refs.view as any).getSelectData();
+      if(!data || data.length == 0) {
+        this.$message('请选择数据!');
+        return
+      }
+      let ids:Array<number> = [];
+      for(const item of data) {
+        ids.push(item.id)
+      }
+      this.del(ids);
+    }
+  }
+  //添加平台
+  addPrice(){
+    let value = (this.$refs.view as any).getFormValue();
+    if(value){
+      this.load = true;
+      add(value).then((res:any)=>{
+        this.load = false;
+        this.$message({
+          message:res.msg,
+          type:'success'
+        });
+        (this.$refs.view as any).closeModal();
+        this.getList();
+      }).catch(()=>{
+        this.load = false;
+      })
+    }
+  }
+  //点击详情
+  detail(){
+    this.config.modal.tool.tools.save = true;
+    delete this.config.modal.tool.tools.add;
+    (this.$refs.view as any).initFormTool();
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.priceManage{
+  width: 100%;
+  height: 100%;
+  overflow-y: hidden;
+}
+</style>

+ 2 - 2
vue.config.js

@@ -36,12 +36,12 @@ module.exports = defineConfig({
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-      // '/prod-api':{
+      // '/':{
         ws:false,
         target: `http://192.168.2.32`,
         // target: `http://192.168.2.202`,
         // target:`https://omstest.benyuntech.com`,
-        // target: `http://192.168.1.134:8080`,
+        // target: `http://47.107.53.207:9023`,
         changeOrigin: true,
         // pathRewrite: {
         //   ['^' + process.env.VUE_APP_BASE_API]: ''