zhangqiOMG 2 years ago
parent
commit
03ed9d6101

+ 140 - 83
src/HDrpManagement/orderManage/modules/edit.vue

@@ -14,141 +14,155 @@
       </div>
     </div>
     <div class="drawer__panel">
+      <div>
+        <div class="mt-10">
+          <p class="normal-title inline-16">选择账户</p>
+          <el-popover
+            placement="bottom"
+            title="选择账户"
+            trigger="click"
+            v-model="visible3">
+            <el-table
+              :data="accountlist"
+              style="width: 100%"
+              size="mini">
+              <el-table-column
+                prop="accountname"
+                label="账户名称"
+                width="120">
+              </el-table-column>
+              <el-table-column
+                prop="balance"
+                label="账户余额"
+                width="120">
+                <template slot-scope="scope">
+                  ¥{{tool.formatAmount(scope.row.balance,2)}}
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="操作"
+                width="90">
+                <template slot-scope="scope">
+                  <el-button type="text" @click="(defaultData.accountclass = scope.row,visible3 = false)" size="mini">选 择</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-button slot="reference" type="text" size="mini">选择其他账户</el-button>
+          </el-popover>
+        </div>
+        <div class="reveive__panel normal-margin">
+          <p><b>¥{{tool.formatAmount(defaultData.accountclass.balance?defaultData.accountclass.balance:0,2)}}</b></p>
+          <small>{{defaultData.accountclass.accountname?defaultData.accountclass.accountname:'未选择账户'}}</small>
+          <div v-if="(data.type === '标准订单' ||  data.type === '特殊订单') && isusedrebate === 1">
+            <el-checkbox v-model="checked" :true-label="1" :false-label="0">使用返利金</el-checkbox>
+            <div v-if="checked" class="flex-align-center">
+              <p class="inline-16"><b>返利金余额:{{tool.formatAmount(rebateAccount[0]?rebateAccount[0].balance:0,2)}}</b></p>
+              <el-input class="inline-16" size="mini" style="width:150px" v-model="rebateamount" @blur="useRebate" placeholder="输入使用金额"></el-input>
+              <small>(返利金最高使用比例{{data.order_rebate_userate}}%)</small>
+            </div>
+          </div>
+        </div>
+      </div>
       <div class="flex-align-center normal-margin">
         <div style="flex:1;margin-right:10px">
           <div class="mt-10">
-            <p class="normal-title inline-16">收货信息</p>
+            <p class="normal-title inline-16">选择财务信息</p>
             <el-popover
               placement="bottom"
-              title="选择地址"
+              title="选择财务信息"
               trigger="click"
-              v-model="visible">
+              v-model="visible2">
               <el-table
-                :data="receiveAddresslist"
+                :data="financiallist"
                 style="width: 100%"
                 size="mini">
                 <el-table-column
-                  prop="name"
-                  label="联系人"
-                  width="90">
+                  prop="enterprisename"
+                  label="公司抬头"
+                  width="120">
                 </el-table-column>
                 <el-table-column
-                  prop="phonenumber"
-                  label="电话"
+                  prop="address"
+                  label="开票地址"
                   width="120">
                 </el-table-column>
                 <el-table-column
-                  label="地址"
-                  width="360">
-                  <template slot-scope="scope">
-                    {{scope.row.province}}{{scope.row.city}}{{scope.row.county}}{{scope.row.address}}
-                  </template>
+                  prop="bank"
+                  label="开户行"
+                  width="120">
+                </el-table-column>
+                <el-table-column
+                  prop="bankcardno"
+                  label="开户账号"
+                  width="120">
                 </el-table-column>
                 <el-table-column
                   label="操作"
                   width="90">
                   <template slot-scope="scope">
-                    <el-button type="text" @click="(defaultData.re_info = scope.row,visible = false)" size="mini">选 择</el-button>
+                    <el-button type="text" @click="(defaultData.fin_info = scope.row,visible2 = false)" size="mini">选 择</el-button>
                   </template>
                 </el-table-column>
               </el-table>
-              <el-button slot="reference" type="text" size="mini">选择其他地址</el-button>
+              <el-button slot="reference" type="text" size="mini">选择其他</el-button>
             </el-popover>
           </div>
           <div class="reveive__panel normal-margin">
-            <p><span class="inline-16"><b>{{defaultData.re_info.name}}</b></span><small>{{defaultData.re_info.phonenumber}}</small></p>
-            <small>{{defaultData.re_info.province}}{{defaultData.re_info.city}}{{defaultData.re_info.county}}{{defaultData.re_info.address?defaultData.re_info.address:'--'}}</small>
+            <p><small>抬头:&nbsp;</small><span class="inline-16"><b>{{defaultData.fin_info.enterprisename}}</b></span></p>
+            <div class="flex-align-center">
+              <p class="inline-16"><small>开票地址:&nbsp;</small>{{defaultData.fin_info.address?defaultData.fin_info.address:'--'}}</p>
+              <p><small>开户行:&nbsp;</small> {{defaultData.fin_info.bank}} &emsp;<small>开户账号:&nbsp;</small> {{defaultData.fin_info.bankcardno}}</p>
+            </div>
           </div>
         </div>
-        <div style="flex:1">
+        <div style="flex:1;">
           <div class="mt-10">
-            <p class="normal-title inline-16">选择账户</p>
+            <p class="normal-title inline-16">收货信息</p>
             <el-popover
               placement="bottom"
-              title="选择账户"
+              title="选择地址"
               trigger="click"
-              v-model="visible3">
+              v-model="visible">
               <el-table
-                :data="accountlist"
+                :data="receiveAddresslist"
                 style="width: 100%"
                 size="mini">
                 <el-table-column
-                  prop="accountname"
-                  label="账户名称"
-                  width="120">
+                  prop="name"
+                  label="联系人"
+                  width="90">
                 </el-table-column>
                 <el-table-column
-                  prop="balance"
-                  label="账户余额"
+                  prop="phonenumber"
+                  label="电话"
                   width="120">
+                </el-table-column>
+                <el-table-column
+                  label="地址"
+                  width="360">
                   <template slot-scope="scope">
-                    ¥{{tool.formatAmount(scope.row.balance,2)}}
+                    {{scope.row.province}}{{scope.row.city}}{{scope.row.county}}{{scope.row.address}}
                   </template>
                 </el-table-column>
                 <el-table-column
                   label="操作"
                   width="90">
                   <template slot-scope="scope">
-                    <el-button type="text" @click="(defaultData.accountclass = scope.row,visible3 = false)" size="mini">选 择</el-button>
+                    <el-button type="text" @click="(defaultData.re_info = scope.row,visible = false)" size="mini">选 择</el-button>
                   </template>
                 </el-table-column>
               </el-table>
-              <el-button slot="reference" type="text" size="mini">选择其他账户</el-button>
+              <el-button slot="reference" type="text" size="mini">选择其他地址</el-button>
             </el-popover>
           </div>
           <div class="reveive__panel normal-margin">
-            <p><b>¥{{tool.formatAmount(defaultData.accountclass.balance,2)}}</b></p>
-            <small>{{defaultData.accountclass.accountname}}</small>
+            <p><span class="inline-16"><b>{{defaultData.re_info.name}}</b></span><small>{{defaultData.re_info.phonenumber}}</small></p>
+            <small>{{defaultData.re_info.province}}{{defaultData.re_info.city}}{{defaultData.re_info.county}}{{defaultData.re_info.address?defaultData.re_info.address:'--'}}</small>
           </div>
         </div>
+        
       </div>
-      <div class="mt-10">
-        <p class="normal-title inline-16">选择财务信息</p>
-        <el-popover
-          placement="bottom"
-          title="选择财务信息"
-          trigger="click"
-          v-model="visible2">
-          <el-table
-            :data="financiallist"
-            style="width: 100%"
-            size="mini">
-            <el-table-column
-              prop="enterprisename"
-              label="公司抬头"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              prop="address"
-              label="开票地址"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              prop="bank"
-              label="开户行"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              prop="bankcardno"
-              label="开户账号"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              label="操作"
-              width="90">
-              <template slot-scope="scope">
-                <el-button type="text" @click="(defaultData.fin_info = scope.row,visible2 = false)" size="mini">选 择</el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-          <el-button slot="reference" type="text" size="mini">选择其他</el-button>
-        </el-popover>
-      </div>
-      <div class="reveive__panel normal-margin">
-        <p><small>抬头:&nbsp;</small><span class="inline-16"><b>{{defaultData.fin_info.enterprisename}}</b></span></p>
-        <p><small>开票地址:&nbsp;</small>{{defaultData.fin_info.address}}</p>
-        <p><small>开户行:&nbsp;</small> {{defaultData.fin_info.bank}} &emsp;<small>开户账号:&nbsp;</small> {{defaultData.fin_info.bankcardno}}</p>
-      </div>
+
       <div class="mt-10">
         <p class="normal-title inline-16">领域明细</p>
       </div>
@@ -232,7 +246,11 @@ export default {
       },
       agnetInfo:{},
       total:0,
-      setcol:24
+      setcol:24,
+      checked:0,
+      rebateamount:null,
+      isusedrebate:0,
+      rebateAccount:[]
     }
   },
   methods:{
@@ -257,6 +275,11 @@ export default {
       this.queryLogisticcom()
 
       this.queryFinancial()
+
+      this.queryUsedrebate()
+
+      this.checked = this.data.rebate_used
+      this.rebateamount = this.data.rebateamount
     },
     // 收货信息:合作企业联系人
     async receiveAddress () {
@@ -286,7 +309,12 @@ export default {
           }
         }
       })
-      this.accountlist = res.data
+     this.accountlist = res.data.filter(e=>{
+        return e.isrebate !== 1
+      })
+      this.rebateAccount = res.data.filter(e=>{
+        return e.isrebate === 1
+      })
       this.defaultData.accountclass = this.data.accountclass
     },
 
@@ -300,6 +328,7 @@ export default {
         }
       })
       this.logisticcomlist = res.data
+      
       this.defaultData.logist_info = this.data.logiscomp
     },
     // 财务信息
@@ -340,7 +369,7 @@ export default {
       this.tool.showMessage(res,()=>{
         console.log(this.data)
         this.$emit('onSuccess')
-        // this.onConfirm()
+        this.useRebate()
         this.drawer = false
       })
     },
@@ -372,6 +401,34 @@ export default {
         this.setcol = 24
         this.$refs['prolist'].listData()
       })
+    },
+     async useRebate () {
+      if (this.rebateamount == null) return this.$message({
+          message:"返利金不能为空",
+          type:'error'
+        })
+      const res = await this.$api.requested({
+        "id": 20230218225002,
+        "content": {
+          "sa_orderid": this.data.sa_orderid, //订单金额
+          "isused": this.checked, //是否使用
+          "rebateamount": this.rebateamount //返利金使用金额
+        },
+      })
+      if (res.code === 0) this.$message({
+        message:`使用返利金失败!${res.msg}`,
+        type:'error'
+      })
+    },
+    // 查询站点是否使用返利金
+    async queryUsedrebate () {
+      const res = await this.$api.requested({
+         "classname": "webmanage.site.site",
+        "method": "querySite_Parameter",
+        "content": {
+        }
+      })
+      this.isusedrebate = res.data.order_rebate_used
     }
   },
   mounted () {

+ 149 - 183
src/SDrpManagement/agentOrder/modules/edit.vue

@@ -14,179 +14,127 @@
       </div>
     </div>
     <div class="drawer__panel">
+      <div>
+        <div style="flex:1">
+          <div class="mt-10">
+            <p class="normal-title inline-16">支付信息</p>
+          </div>
+          <div class="reveive__panel normal-margin">
+            <p class="flex-align-center"><small>结算企业:&nbsp;</small><b>{{defaultData.finance.enterprisename}}</b>&nbsp;<financeEnterprise @select="onSelect"></financeEnterprise></p>
+            <div class="flex-align-center">
+              <p class="inline-16"><small>账户余额:&nbsp;</small><b>¥{{tool.formatAmount(defaultData.accountclass.balance?defaultData.accountclass.balance:0,2)}}</b></p>
+              <p class="inline-16"><small>账户名称:&nbsp;</small>{{defaultData.accountclass.accountname?defaultData.accountclass.accountname:'未选择账户'}}</p>
+              <p><small>本单金额:&nbsp;</small>{{tool.formatAmount(data.amount - rebateamount,2)}}</p>
+            </div>
+            <div v-if="(data.type === '标准订单' ||  data.type === '特殊订单') && isusedrebate === 1">
+              <el-checkbox v-model="checked" :true-label="1" :false-label="0">使用返利金</el-checkbox>
+              <div v-if="checked" class="flex-align-center">
+                <p class="inline-16"><b>返利金余额:{{tool.formatAmount(defaultData.rebatebalance,2)}}</b></p>
+                <el-input class="inline-16" size="mini" style="width:150px" v-model="rebateamount" @blur="useRebate" placeholder="输入使用金额"></el-input>
+                <small>(返利金最高使用比例{{data.order_rebate_userate}}%,本单上限:{{tool.formatAmount(data.amount * data.order_rebate_userate / 100,2)}})</small>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
       <div class="flex-align-center normal-margin">
-        <div style="flex:1;margin-right:10px">
+        <div style="flex:1; margin-right:10px">
           <div class="mt-10">
-            <p class="normal-title inline-16">收货信息</p>
+            <p class="normal-title inline-16">选择财务信息</p>
             <el-popover
               placement="bottom"
-              title="选择地址"
+              title="选择财务信息"
               trigger="click"
-              v-model="visible">
+              v-model="visible2">
               <el-table
-                :data="receiveAddresslist"
+                :data="financiallist"
                 style="width: 100%"
                 size="mini">
                 <el-table-column
-                  prop="name"
-                  label="联系人"
-                  width="90">
-                </el-table-column>
-                <el-table-column
-                  prop="phonenumber"
-                  label="电话"
+                  prop="enterprisename"
+                  label="公司抬头"
                   width="120">
                 </el-table-column>
                 <el-table-column
-                  label="地址"
-                  width="360">
-                  <template slot-scope="scope">
-                    {{scope.row.province}}{{scope.row.city}}{{scope.row.county}}{{scope.row.address}}
-                  </template>
-                </el-table-column>
-                <el-table-column
-                  label="操作"
-                  width="90">
-                  <template slot-scope="scope">
-                    <el-button type="text" @click="(defaultData.re_info = scope.row,visible = false)" size="mini">选 择</el-button>
-                  </template>
+                  prop="address"
+                  label="开票地址"
+                  width="120">
                 </el-table-column>
-              </el-table>
-              <el-button slot="reference" type="text" size="mini">选择其他地址</el-button>
-            </el-popover>
-          </div>
-          <div class="reveive__panel normal-margin">
-            <p><span class="inline-16"><b>{{defaultData.re_info.name}}</b></span><small>{{defaultData.re_info.phonenumber}}</small></p>
-            <small>{{defaultData.re_info.province}}{{defaultData.re_info.city}}{{defaultData.re_info.county}}{{defaultData.re_info.address?defaultData.re_info.address:'--'}}</small>
-          </div>
-        </div>
-        <div style="flex:1;margin-right:10px">
-          <div class="mt-10">
-            <p class="normal-title inline-16">物流公司</p>
-            <el-popover
-              placement="bottom"
-              title="选择公司"
-              trigger="click"
-              v-model="visible1">
-              <el-table
-                :data="logisticcomlist"
-                style="width: 100%"
-                size="mini">
                 <el-table-column
-                  prop="abbreviation"
-                  label="公司简称"
+                  prop="bank"
+                  label="开户行"
                   width="120">
                 </el-table-column>
                 <el-table-column
-                  prop="kd100id"
-                  label="快递100ID"
+                  prop="bankcardno"
+                  label="开户账号"
                   width="120">
                 </el-table-column>
                 <el-table-column
                   label="操作"
                   width="90">
                   <template slot-scope="scope">
-                    <el-button type="text" @click="(defaultData.logist_info = scope.row,visible1 = false)" size="mini">选 择</el-button>
+                    <el-button type="text" @click="(defaultData.fin_info = scope.row,visible2 = false)" size="mini">选 择</el-button>
                   </template>
                 </el-table-column>
               </el-table>
-              <el-button slot="reference" type="text" size="mini">选择其他公司</el-button>
+              <el-button slot="reference" type="text" size="mini">选择其他</el-button>
             </el-popover>
           </div>
           <div class="reveive__panel normal-margin">
-            <p><span class="inline-16"><b>{{defaultData.logist_info.abbreviation}}</b></span></p>
-            <small>快递100ID: {{defaultData.logist_info.kd100id}}</small>
+            <p><small>抬头:&nbsp;</small><span class="inline-16"><b>{{defaultData.fin_info.enterprisename}}</b></span></p>
+            <div class="flex-align-center">
+              <p class="inline-16"><small>开票地址:&nbsp;</small>{{defaultData.fin_info.address?defaultData.fin_info.address:'--'}}</p>
+              <p><small>开户行:&nbsp;</small> {{defaultData.fin_info.bank}} &emsp;<small>开户账号:&nbsp;</small> {{defaultData.fin_info.bankcardno}}</p>
+            </div>
           </div>
         </div>
-        <div style="flex:1">
+        <div style="flex:1;">
           <div class="mt-10">
-            <p class="normal-title inline-16">选择账户</p>
+            <p class="normal-title inline-16">收货信息</p>
             <el-popover
               placement="bottom"
-              title="选择账户"
+              title="选择地址"
               trigger="click"
-              v-model="visible3">
+              v-model="visible">
               <el-table
-                :data="accountlist"
+                :data="receiveAddresslist"
                 style="width: 100%"
                 size="mini">
                 <el-table-column
-                  prop="accountname"
-                  label="账户名称"
-                  width="120">
+                  prop="name"
+                  label="联系人"
+                  width="90">
                 </el-table-column>
                 <el-table-column
-                  prop="balance"
-                  label="账户余额"
+                  prop="phonenumber"
+                  label="电话"
                   width="120">
+                </el-table-column>
+                <el-table-column
+                  label="地址"
+                  width="360">
                   <template slot-scope="scope">
-                    ¥{{tool.formatAmount(scope.row.balance,2)}}
+                    {{scope.row.province}}{{scope.row.city}}{{scope.row.county}}{{scope.row.address}}
                   </template>
                 </el-table-column>
                 <el-table-column
                   label="操作"
                   width="90">
                   <template slot-scope="scope">
-                    <el-button type="text" @click="(defaultData.accountclass = scope.row,visible3 = false)" size="mini">选 择</el-button>
+                    <el-button type="text" @click="(defaultData.re_info = scope.row,visible = false)" size="mini">选 择</el-button>
                   </template>
                 </el-table-column>
               </el-table>
-              <el-button slot="reference" type="text" size="mini">选择其他账户</el-button>
+              <el-button slot="reference" type="text" size="mini">选择其他地址</el-button>
             </el-popover>
           </div>
           <div class="reveive__panel normal-margin">
-            <p><b>¥{{tool.formatAmount(defaultData.accountclass.balance,2)}}</b></p>
-            <small>{{defaultData.accountclass.accountname}}</small>
+            <p><span class="inline-16"><b>{{defaultData.re_info.name}}</b></span><small>{{defaultData.re_info.phonenumber}}</small></p>
+            <small>{{defaultData.re_info.province?defaultData.re_info.province:'--'}}{{defaultData.re_info.city}}{{defaultData.re_info.county}}{{defaultData.re_info.address?defaultData.re_info.address:''}}</small>
           </div>
         </div>
-      </div>
-      
-      <div class="mt-10">
-        <p class="normal-title inline-16">选择财务信息</p>
-        <el-popover
-          placement="bottom"
-          title="选择财务信息"
-          trigger="click"
-          v-model="visible2">
-          <el-table
-            :data="financiallist"
-            style="width: 100%"
-            size="mini">
-            <el-table-column
-              prop="enterprisename"
-              label="公司抬头"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              prop="address"
-              label="开票地址"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              prop="bank"
-              label="开户行"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              prop="bankcardno"
-              label="开户账号"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              label="操作"
-              width="90">
-              <template slot-scope="scope">
-                <el-button type="text" @click="(defaultData.fin_info = scope.row,visible2 = false)" size="mini">选 择</el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-          <el-button slot="reference" type="text" size="mini">选择其他</el-button>
-        </el-popover>
-      </div>
-      <div class="reveive__panel normal-margin">
-        <p><small>抬头:&nbsp;</small><span class="inline-16"><b>{{defaultData.fin_info.enterprisename}}</b></span></p>
-        <p><small>开票地址:&nbsp;</small>{{defaultData.fin_info.address}}</p>
-        <p><small>开户行:&nbsp;</small> {{defaultData.fin_info.bank}} &emsp;<small>开户账号:&nbsp;</small> {{defaultData.fin_info.bankcardno}}</p>
+        
       </div>
       <div class="mt-10">
         <div>
@@ -198,7 +146,7 @@
             <product-list ref="prolist" :data="data" :type="'edit'" @onSuccess="onEditSuccess"></product-list>
           </el-col>
           <el-col :span="24 - setcol">
-            <add-product ref="addpro" @onConfirm="onConfirm"></add-product>
+            <add-product ref="addpro" :data="data" @onConfirm="onConfirm"></add-product>
           </el-col>
         </el-row>
       </div>
@@ -215,15 +163,18 @@
 import previewImage from '@/components/previewImage/index.vue'
 import productList from './productlist.vue'
 import addProduct from '@/template/orderCanUseProduct/index.vue'
+import financeEnterprise from '@/template/orderCanUseFinance/index.vue'
 export default {
   props:['data'],
   components:{
     previewImage,
     productList,
-    addProduct
+    addProduct,
+    financeEnterprise
   },
   data () {
     return {
+      checked:0,
       visible:false,
       visible1:false,
       visible2:false,
@@ -231,99 +182,62 @@ export default {
       drawer:false,
       receiveAddresslist:[],
       accountlist:[],
+      rebateAccount:[],
       logisticcomlist:[],
       financiallist:[],
       defaultData:{
         re_info:{},
         logist_info:{},
         fin_info:{},
+        finance:{},
         accountclass:{},
         account_index:0,
         remarks:this.data.remarks
       },
-      agnetInfo:{},
       total:0,
-      setcol:24
+      setcol:24,
+      rebateamount:null,
+      isusedrebate:0
     }
   },
   methods:{
     onShow () {
-      this.queryAgentiInfo()
+      this.initPage()
     },
-    async queryAgentiInfo () {
-      const res = await this.$api.requested({
-        "id": "20221022165203",
-        "content": {
-          sys_enterpriseid:this.data.sys_enterpriseid
-        }
-      })
-      this.agnetInfo = res.data
+    async initPage () {
 
-      this.receiveAddress()
+      this.setDefaultData()
 
-      this.queryAccount()
+      this.receiveAddress()
 
-      this.queryLogisticcom()
+      this.queryUsedrebate()
 
-      this.queryFinancial()
+      this.checked = this.data.rebate_used
+      this.rebateamount = this.data.rebateamount
     },
     // 收货信息:合作企业联系人
     async receiveAddress () {
       const res = await this.$api.requested({
-        "id": "20221009155803",
+        "id": "20230220002602",
         "content": {
-        "sys_enterpriseid":this.agnetInfo.sys_enterpriseid,
-          "where":{
-            "condition":"",
-            "workaddress":0
+          "pageSize":100,
+          "where": {
+              "condition": ""
           }
-        }
+        },
       })
       this.receiveAddresslist = res.data
-      this.defaultData.re_info = res.data[0]
-    },
-
-    // 账号信息
-    async queryAccount () {
-      const res = await this.$api.requested({
-        "id": "20221008134803",
-        "content": {
-          "pageNumber": 1,
-          "pageSize": 100,
-          "where":{
-            "isused":1
-          }
-        }
-      })
-      this.accountlist = res.data
-      this.defaultData.accountclass = this.data.accountclass
     },
 
-    // 物流企业
-    async queryLogisticcom () {
-      const res = await this.$api.requested({
-        "id": "20221121135804",
-        "content": {
-          "pageNumber": 1,
-          "pageSize": 100
-        }
-      })
-      this.logisticcomlist = res.data
-      this.defaultData.logist_info = this.data.logiscomp
-    },
-    // 财务信息
-    async queryFinancial () {
-      const res = await this.$api.requested({
-        "id": "20221013160602",
-        "content": {
-          "sys_enterpriseid":this.agnetInfo.sys_enterpriseid,
-          "pageNumber": 1,
-          "pageSize": 100
-        }
-      })
-      this.financiallist = res.data
+    // 账号信息与结算企业
+    async setDefaultData () {
+      this.defaultData.rebatebalance = this.data.rebatebalance
+      this.defaultData.finance = this.data.finance
       this.defaultData.fin_info = this.data.finance
+      this.defaultData.accountclass = this.data.accountclass
+      this.defaultData.re_info = this.data.contacts
     },
+   
     async onSubmit() {
       const res = await this.$api.requested({
         "id": 20221108111402,
@@ -347,7 +261,7 @@ export default {
       })
       this.tool.showMessage(res,()=>{
         this.$emit('onSuccess')
-        // this.onConfirm()
+        this.useRebate()
         this.drawer = false
       })
     },
@@ -378,10 +292,62 @@ export default {
       this.tool.showMessage(res,()=>{
         this.setcol = 24
         this.$refs['prolist'].listData()
+        this.$emit('onSuccess')
       })
-    }
+    },
+    async useRebate () {
+      let that = this
+      if (this.rebateamount > this.defaultData.rebatebalance ||this.rebateamount > (this.data.amount * this.data.order_rebate_userate / 100) ) return  this.$message({
+        message:`余额不足或已超过可用上限!`,
+        type:function () {
+          that.rebateamount = 0
+          return 'error'
+        }()
+      })
+      if (this.rebateamount == null) return this.$message({
+          message:"返利金不能为空",
+          type:'error'
+        })
+      const res = await this.$api.requested({
+        "id": 20230218225002,
+        "content": {
+          "sa_orderid": this.data.sa_orderid, //订单金额
+          "isused": this.checked, //是否使用
+          "rebateamount": this.rebateamount //返利金使用金额
+        },
+      })
+      if (res.code === 0) this.$message({
+        message:`使用返利金失败!${res.msg}`,
+        type:'error'
+      })
+    },
+    // 查询站点是否使用返利金
+    async queryUsedrebate () {
+      const res = await this.$api.requested({
+         "classname": "webmanage.site.site",
+        "method": "querySite_Parameter",
+        "content": {
+        }
+      })
+      this.isusedrebate = res.data.order_rebate_used
+    },
+    // 选择结算企业
+    onSelect (data) {
+      console.log(data)
+      this.defaultData.finance = data
+      this.financiallist = data.finance
+      data.finance.forEach(e => {
+        if (e.isdefault === 1) {
+           this.defaultData.fin_info = e
+        } else {
+          this.defaultData.fin_info = data.finance.length > 0 ?data.finance[0]:{}
+        }
+      });
+     
+    },
   },
   mounted () {
+    
   }
 }
 
@@ -390,14 +356,14 @@ export default {
 </style>
 <style scoped>
 .reveive__panel{
-  font-size: 14px;
+  font-size: 16px;
   line-height: 30px;
   padding: 10px;
   background: #d9ecff;
   border: 1px dashed #0676e7;
 }
 .account__panel small,.reveive__panel small{
-  color:#666
+  color:#888
 }
 .account__panel{
   width: calc(25% - 26px);

+ 1 - 1
src/SDrpManagement/agentOrder/modules/productlist.vue

@@ -104,7 +104,7 @@
           <p style="color:red;font-weight:500">¥&nbsp;{{tool.formatAmount(scope.row.price * scope.row.qty,2)}}</p>
         </template>
       </el-table-column>
-      <el-table-column v-if="type === 'edit'" width="90" fixed="right">
+      <el-table-column width="90" fixed="right">
         <template slot-scope="scope">
           <el-button type="text" size="mini" @click="deleteOrderProduct(scope.row)">删 除</el-button>
         </template>

+ 133 - 119
src/SDrpManagement/salerOrder/modules/edit.vue

@@ -14,180 +14,153 @@
       </div>
     </div>
     <div class="drawer__panel">
+      <div>
+        <div class="mt-10">
+          <p class="normal-title inline-16">选择账户</p>
+          <el-popover
+            placement="bottom"
+            title="选择账户"
+            trigger="click"
+            v-model="visible3">
+            <el-table
+              :data="accountlist"
+              style="width: 100%"
+              size="mini">
+              <el-table-column
+                prop="accountname"
+                label="账户名称"
+                width="120">
+              </el-table-column>
+              <el-table-column
+                prop="balance"
+                label="账户余额"
+                width="120">
+                <template slot-scope="scope">
+                  ¥{{tool.formatAmount(scope.row.balance,2)}}
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="操作"
+                width="90">
+                <template slot-scope="scope">
+                  <el-button type="text" @click="(defaultData.accountclass = scope.row,visible3 = false)" size="mini">选 择</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-button slot="reference" type="text" size="mini">选择其他账户</el-button>
+          </el-popover>
+        </div>
+        <div class="reveive__panel normal-margin">
+          <p><b>¥{{tool.formatAmount(defaultData.accountclass.balance?defaultData.accountclass.balance:0,2)}}</b></p>
+          <small>{{defaultData.accountclass.accountname?defaultData.accountclass.accountname:'未选择账户'}}</small>
+          <div v-if="(data.type === '标准订单' ||  data.type === '特殊订单') && isusedrebate === 1">
+            <el-checkbox v-model="checked" :true-label="1" :false-label="0">使用返利金</el-checkbox>
+            <div v-if="checked" class="flex-align-center">
+              <p class="inline-16"><b>返利金余额:{{tool.formatAmount(rebateAccount[0]?rebateAccount[0].balance:0,2)}}</b></p>
+              <el-input class="inline-16" size="mini" style="width:150px" v-model="rebateamount" @blur="useRebate" placeholder="输入使用金额"></el-input>
+              <small>(返利金最高使用比例{{data.order_rebate_userate}}%)</small>
+            </div>
+          </div>
+        </div>
+      </div>
       <div class="flex-align-center normal-margin">
-        <div style="flex:1;margin-right:10px">
+        <div slot="flex:1;margin-right:10px">
           <div class="mt-10">
-            <p class="normal-title inline-16">收货信息</p>
+            <p class="normal-title inline-16">选择财务信息</p>
             <el-popover
               placement="bottom"
-              title="选择地址"
+              title="选择财务信息"
               trigger="click"
-              v-model="visible">
+              v-model="visible2">
               <el-table
-                :data="receiveAddresslist"
+                :data="financiallist"
                 style="width: 100%"
                 size="mini">
                 <el-table-column
-                  prop="name"
-                  label="联系人"
-                  width="90">
-                </el-table-column>
-                <el-table-column
-                  prop="phonenumber"
-                  label="电话"
+                  prop="enterprisename"
+                  label="公司抬头"
                   width="120">
                 </el-table-column>
                 <el-table-column
-                  label="地址"
-                  width="360">
-                  <template slot-scope="scope">
-                    {{scope.row.province}}{{scope.row.city}}{{scope.row.county}}{{scope.row.address}}
-                  </template>
+                  prop="address"
+                  label="开票地址"
+                  width="120">
                 </el-table-column>
                 <el-table-column
-                  label="操作"
-                  width="90">
-                  <template slot-scope="scope">
-                    <el-button type="text" @click="(defaultData.re_info = scope.row,visible = false)" size="mini">选 择</el-button>
-                  </template>
-                </el-table-column>
-              </el-table>
-              <el-button slot="reference" type="text" size="mini">选择其他地址</el-button>
-            </el-popover>
-          </div>
-          <div class="reveive__panel normal-margin">
-            <p><span class="inline-16"><b>{{defaultData.re_info.name}}</b></span><small>{{defaultData.re_info.phonenumber}}</small></p>
-            <small>{{defaultData.re_info.province}}{{defaultData.re_info.city}}{{defaultData.re_info.county}}{{defaultData.re_info.address?defaultData.re_info.address:'--'}}</small>
-          </div>
-        </div>
-        <div style="flex:1;margin-right:10px">
-          <div class="mt-10">
-            <p class="normal-title inline-16">物流公司</p>
-            <el-popover
-              placement="bottom"
-              title="选择公司"
-              trigger="click"
-              v-model="visible1">
-              <el-table
-                :data="logisticcomlist"
-                style="width: 100%"
-                size="mini">
-                <el-table-column
-                  prop="abbreviation"
-                  label="公司简称"
+                  prop="bank"
+                  label="开户行"
                   width="120">
                 </el-table-column>
                 <el-table-column
-                  prop="kd100id"
-                  label="快递100ID"
+                  prop="bankcardno"
+                  label="开户账号"
                   width="120">
                 </el-table-column>
                 <el-table-column
                   label="操作"
                   width="90">
                   <template slot-scope="scope">
-                    <el-button type="text" @click="(defaultData.logist_info = scope.row,visible1 = false)" size="mini">选 择</el-button>
+                    <el-button type="text" @click="(defaultData.fin_info = scope.row,visible2 = false)" size="mini">选 择</el-button>
                   </template>
                 </el-table-column>
               </el-table>
-              <el-button slot="reference" type="text" size="mini">选择其他公司</el-button>
+              <el-button slot="reference" type="text" size="mini">选择其他</el-button>
             </el-popover>
           </div>
           <div class="reveive__panel normal-margin">
-            <p><span class="inline-16"><b>{{defaultData.logist_info.abbreviation}}</b></span></p>
-            <small>快递100ID: {{defaultData.logist_info.kd100id}}</small>
+            <p><small>抬头:&nbsp;</small><span class="inline-16"><b>{{defaultData.fin_info.enterprisename}}</b></span></p>
+            <div class="flex-align-center">
+              <p class="inline-16"><small>开票地址:&nbsp;</small>{{defaultData.fin_info.address?defaultData.fin_info.address:'--'}}</p>
+              <p><small>开户行:&nbsp;</small> {{defaultData.fin_info.bank}} &emsp;<small>开户账号:&nbsp;</small> {{defaultData.fin_info.bankcardno}}</p>
+            </div>
           </div>
         </div>
-        <div style="flex:1">
+        <div style="flex:1;">
           <div class="mt-10">
-            <p class="normal-title inline-16">选择账户</p>
+            <p class="normal-title inline-16">收货信息</p>
             <el-popover
               placement="bottom"
-              title="选择账户"
+              title="选择地址"
               trigger="click"
-              v-model="visible3">
+              v-model="visible">
               <el-table
-                :data="accountlist"
+                :data="receiveAddresslist"
                 style="width: 100%"
                 size="mini">
                 <el-table-column
-                  prop="accountname"
-                  label="账户名称"
-                  width="120">
+                  prop="name"
+                  label="联系人"
+                  width="90">
                 </el-table-column>
                 <el-table-column
-                  prop="balance"
-                  label="账户余额"
+                  prop="phonenumber"
+                  label="电话"
                   width="120">
+                </el-table-column>
+                <el-table-column
+                  label="地址"
+                  width="360">
                   <template slot-scope="scope">
-                    ¥{{tool.formatAmount(scope.row.balance,2)}}
+                    {{scope.row.province}}{{scope.row.city}}{{scope.row.county}}{{scope.row.address}}
                   </template>
                 </el-table-column>
                 <el-table-column
                   label="操作"
                   width="90">
                   <template slot-scope="scope">
-                    <el-button type="text" @click="(defaultData.accountclass = scope.row,visible3 = false)" size="mini">选 择</el-button>
+                    <el-button type="text" @click="(defaultData.re_info = scope.row,visible = false)" size="mini">选 择</el-button>
                   </template>
                 </el-table-column>
               </el-table>
-              <el-button slot="reference" type="text" size="mini">选择其他账户</el-button>
+              <el-button slot="reference" type="text" size="mini">选择其他地址</el-button>
             </el-popover>
           </div>
           <div class="reveive__panel normal-margin">
-            <p><b>¥{{tool.formatAmount(defaultData.accountclass.balance,2)}}</b></p>
-            <small>{{defaultData.accountclass.accountname}}</small>
+            <p><span class="inline-16"><b>{{defaultData.re_info.name}}</b></span><small>{{defaultData.re_info.phonenumber}}</small></p>
+            <small>{{defaultData.re_info.province}}{{defaultData.re_info.city}}{{defaultData.re_info.county}}{{defaultData.re_info.address?defaultData.re_info.address:'--'}}</small>
           </div>
         </div>
       </div>
-      
-      <div class="mt-10">
-        <p class="normal-title inline-16">选择财务信息</p>
-        <el-popover
-          placement="bottom"
-          title="选择财务信息"
-          trigger="click"
-          v-model="visible2">
-          <el-table
-            :data="financiallist"
-            style="width: 100%"
-            size="mini">
-            <el-table-column
-              prop="enterprisename"
-              label="公司抬头"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              prop="address"
-              label="开票地址"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              prop="bank"
-              label="开户行"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              prop="bankcardno"
-              label="开户账号"
-              width="120">
-            </el-table-column>
-            <el-table-column
-              label="操作"
-              width="90">
-              <template slot-scope="scope">
-                <el-button type="text" @click="(defaultData.fin_info = scope.row,visible2 = false)" size="mini">选 择</el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-          <el-button slot="reference" type="text" size="mini">选择其他</el-button>
-        </el-popover>
-      </div>
-      <div class="reveive__panel normal-margin">
-        <p><small>抬头:&nbsp;</small><span class="inline-16"><b>{{defaultData.fin_info.enterprisename}}</b></span></p>
-        <p><small>开票地址:&nbsp;</small>{{defaultData.fin_info.address}}</p>
-        <p><small>开户行:&nbsp;</small> {{defaultData.fin_info.bank}} &emsp;<small>开户账号:&nbsp;</small> {{defaultData.fin_info.bankcardno}}</p>
-      </div>
       <div class="mt-10">
         <div>
           <p class="normal-title inline-16">订单产品</p>
@@ -243,7 +216,11 @@ export default {
       },
       agnetInfo:{},
       total:0,
-      setcol:24
+      setcol:24,
+      rebateamount:null,
+      isusedrebate:0,
+      checked:false,
+      rebateAccount:[]
     }
   },
   methods:{
@@ -266,6 +243,9 @@ export default {
       this.queryLogisticcom()
 
       this.queryFinancial()
+      this.queryUsedrebate()
+      this.checked = this.data.rebate_used
+      this.rebateamount = this.data.rebateamount
     },
     // 收货信息:合作企业联系人
     async receiveAddress () {
@@ -281,6 +261,7 @@ export default {
       })
       this.receiveAddresslist = res.data
       this.defaultData.re_info = res.data[0]
+      
     },
 
     // 账号信息
@@ -295,7 +276,12 @@ export default {
           }
         }
       })
-      this.accountlist = res.data
+      this.accountlist = res.data.filter(e=>{
+        return e.isrebate !== 1
+      })
+      this.rebateAccount = res.data.filter(e=>{
+        return e.isrebate === 1
+      })
       this.defaultData.accountclass = this.data.accountclass
     },
 
@@ -347,7 +333,7 @@ export default {
       })
       this.tool.showMessage(res,()=>{
         this.$emit('onSuccess')
-        // this.onConfirm()
+        this.useRebate()
         this.drawer = false
       })
     },
@@ -379,6 +365,34 @@ export default {
         this.setcol = 24
         this.$refs['prolist'].listData()
       })
+    },
+    async useRebate () {
+      if (this.rebateamount == null) return this.$message({
+          message:"返利金不能为空",
+          type:'error'
+        })
+      const res = await this.$api.requested({
+        "id": 20230218225002,
+        "content": {
+          "sa_orderid": this.data.sa_orderid, //订单金额
+          "isused": this.checked, //是否使用
+          "rebateamount": this.rebateamount //返利金使用金额
+        },
+      })
+      if (res.code === 0) this.$message({
+        message:`使用返利金失败!${res.msg}`,
+        type:'error'
+      })
+    },
+    // 查询站点是否使用返利金
+    async queryUsedrebate () {
+      const res = await this.$api.requested({
+         "classname": "webmanage.site.site",
+        "method": "querySite_Parameter",
+        "content": {
+        }
+      })
+      this.isusedrebate = res.data.order_rebate_used
     }
   },
   mounted () {

+ 115 - 0
src/template/orderCanUseFinance/index.vue

@@ -0,0 +1,115 @@
+<template>
+  <div>
+    <el-popover
+      placement="bottom"
+      width="100%"
+      v-model="visible">
+      <div>
+        <div class="flex-align-center flex-between" style="margin-bottom:10px">
+          <el-input style="width:200px" suffix-icon="el-icon-search" size="small" v-model="params.content.where.condition" placeholder="输入经销商信息" @keyup.enter.native="queryEnterpriseArchives(params.content.pageNumber = 1)" @clear="queryEnterpriseArchives(params.content.pageNumber = 1)" clearable></el-input>
+        </div>
+        <el-table
+          :data="ENlist"
+          size="small"
+          stripe
+          style="width: 100%"
+          height="300"
+          border>
+          <el-table-column
+            prop="enterprisename"
+            label="经销商名称"
+            width="180">
+          </el-table-column>
+          <el-table-column
+            prop="contact"
+            label="联系人"
+            width="180">
+          </el-table-column>
+          <el-table-column
+            prop="phone"
+            label="联系电话">
+          </el-table-column>
+          <el-table-column>
+            <template slot-scope="scope">
+              <el-button size="mini" type="text" @click="rowClick(scope.row)">选 择</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+        <div style="margin-top:16px;text-align:right">
+          <el-pagination
+            background
+            small
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="currentPage"
+            :page-size="params.content.pageSize"
+            layout="total, prev, pager, next, jumper"
+            :total="total">
+          </el-pagination>
+        </div>
+      </div>
+      <el-button size="small" type="text" slot="reference" @click="queryEnterpriseArchives">选择企业</el-button>
+    </el-popover>
+  </div>
+</template>
+
+<script>
+export default {
+  props:['sys_enterpriseid'],
+  data () {
+    return {
+      ENlist:[],
+      total:0,
+      currentPage:0,
+      form:{
+        enterprisename:''
+      },
+      params:{
+        "id": 20230104103702,
+        "content": {
+          "pageNumber": 1,
+          "pageSize": 10,
+          "where": {
+            "condition": '',
+          },
+          "sort":[{
+            "sortname":"默认",
+            "sorted":1,
+            "sortid":56,
+            "reversed":1
+          }],
+        }
+      },
+      visible:false
+    }
+  },
+  methods:{
+    async queryEnterpriseArchives () {
+      const res = await this.$api.requested(this.params)
+      this.ENlist = res.data
+      this.total = res.total
+      this.currentPage = res.pageNumber
+      console.log('queryEnterpriseArchives',res.data)
+    },
+    handleSizeChange(val) {
+      this.params.content.pageSize = val
+      this.queryEnterpriseArchives()
+    },
+    handleCurrentChange(val) {
+      this.params.content.pageNumber = val
+      this.queryEnterpriseArchives()
+    },
+    rowClick (row) {
+      this.visible = false
+      this.form.enterprisename = row.enterprisename
+      this.$emit('select',row)
+    },
+  },
+  mounted () {
+    this.queryEnterpriseArchives()
+  }
+}
+
+</script>
+<style>
+</style>

+ 1 - 1
src/template/orderCanUseProduct/index.vue

@@ -1,5 +1,5 @@
 <template>
-<div> 
+<div>
   <div class="flex-align-center flex-between mt-10">
     <el-input style="width:200px" size="small"  suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" clearable></el-input>
     <el-button type="primary" size="small" :disabled="tableSelectData.length === 0" @click="onConfirm">添加选中商品</el-button>

+ 3 - 1
src/utils/tool.js

@@ -46,10 +46,12 @@ export default {
 
   // 操作响应提示
   showMessage (res,success) {
+    
     if (res.code === 0)  return Notification({
       title: '失败',
       message: res.msg,
-      type: 'error'
+      type: 'error',
+      
     });
 
     Notification({