2
3
Эх сурвалжийг харах

发票推送加字段;supplier表加发票地址;确认发票时可修改信息

wd 3 жил өмнө
parent
commit
88b77ada1e

+ 3 - 1
src/dashoo.cn/backend/api/business/oilsupplier/supplier/oilsupplier.go

@@ -1,9 +1,10 @@
 package supplier
 
 import (
+	"time"
+
 	"dashoo.cn/backend/api/business/oilsupplier/suppliercertsub"
 	"dashoo.cn/backend/api/business/oilsupplier/supplierfile"
-	"time"
 )
 
 type OilSupplier struct {
@@ -24,6 +25,7 @@ type OilSupplier struct {
 	LocalTaxNo          string    `xorm:"comment('税务登记证地税编号') VARCHAR(50)"`
 	Address             string    `xorm:"comment('单位地址') VARCHAR(500)"`
 	AllAddress          string    `xorm:"comment('注册地址') VARCHAR(500)"`
+	InvoiceAddress      string    `xorm:"comment('发票开票地址') VARCHAR(500)"`
 	LinkAllAddress      string    `xorm:"comment('通信地址') VARCHAR(500)"`
 	Province            string    `xorm:"comment('省直辖市') VARCHAR(20)"`
 	City                string    `xorm:"comment('地市区县') VARCHAR(20)"`

+ 5 - 1
src/dashoo.cn/backend/api/controllers/invoice/invoice.go

@@ -213,7 +213,11 @@ func (this *OilInvoiceController) UpdateIsInvoice() {
 		//paramsString += "{'goodsname':'" + pay.SupplierTypeName + " " + typeString + "','num':'','price':'','hsbz':'1','taxrate':'" + rate + "','spec':'','unit':'','spbm':'10101150101','zsbm':'','fphxz':'0','yhzcbs':'" + yhzcbs + "','zzstsgl':'" + zzstsgl + "','lslbs':'" + israte + "','kce':'','taxfreeamt':" + fmt.Sprintf("%.2f", amount-a) + ",'tax':" + tax + ",'taxamt':" + strconv.Itoa(int(amount)) + "}"
 		//detail.Goodsname = pay.SupplierTypeName + " " + typeString
 		detail.Goodsname = "资质认证服务费"
-		detail.Hsbz = "1"
+		detail.Num = "1" // 数量
+		detail.Price = pay.OilPaymentInfo.Amount //单价
+		detail.Spec = "服务费" //规格型号
+		detail.Unit = "项" //单位
+		detail.Hsbz = "0" // 单价含税标志,0:不含税,1:含税
 		detail.Taxrate = rate
 		detail.Fphxz = "0"
 		detail.Yhzcbs = yhzcbs

+ 1 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

@@ -843,7 +843,7 @@ func (this *InfoChangeController) DelFile() {
 
 	// 之前的资质改状态, 新增资质删除
 	var err error
-	if file.FileUrl != "" {
+	if file.SupType != 2 && file.SupType != 4 {
 		cols := []string{"IsDelete"}
 		file.IsDelete = 1
 		_, err = svc.UpdateEntityByIdCols(Id, &file, cols)

+ 5 - 1
src/dashoo.cn/backend/api/controllers/oilsupplier/paymentinfo.go

@@ -782,7 +782,11 @@ func (this *PaymentInfoController) ReceiveMoneyBillList() {
 		invoiceInfo.SupplierId = supplierId
 		invoiceInfo.SupplierName = suppentity.SupplierName
 		invoiceInfo.CommercialNo = suppentity.CommercialNo
-		invoiceInfo.Address = strings.Replace(suppentity.AllAddress, "/", "", -1) + suppentity.Address
+		if suppentity.InvoiceAddress != "" {
+			invoiceInfo.Address = suppentity.InvoiceAddress
+		} else {
+			invoiceInfo.Address = strings.Replace(suppentity.AllAddress, "/", "", -1) + suppentity.Address
+		}
 		invoiceInfo.BankAccount = suppentity.BankAccount
 		invoiceInfo.DepositBank = suppentity.DepositBank
 		invoiceInfo.Email = suppentity.EMail

+ 24 - 0
src/dashoo.cn/backend/api/controllers/oilsupplier/supplier.go

@@ -4789,3 +4789,27 @@ func (this *OilSupplierController) getTodoNum(stype string) int {
 
 	return int(pagingResult.Total)
 }
+
+// @Title 修改发票信息
+// @Description 修改发票信息
+// @Success	200	{object} controllers.Request
+// @router /updateInvoiceInfo [post]
+func (this *OilSupplierController) UpdateInvoiceInfo() {
+	var supplierEntity supplier.OilSupplier
+	var jsonBlob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonBlob, &supplierEntity)
+	var errInfo ErrorInfo
+
+	supplierService := supplier.GetOilSupplierService(utils.DBE)
+	err := supplierService.UpdateEntityBywheretbl(OilSupplierName, &supplierEntity, []string{"CompanyTel", "EMail", "DepositBank", "BankAccount", "InvoiceAddress"}, "id = " + utils.ToStr(supplierEntity.Id))
+
+	if err != nil {
+		errInfo.Code = -1
+		errInfo.Message = "修改失败!"
+	} else {
+		errInfo.Code = 0
+		errInfo.Message = "修改成功!"
+	}
+	this.Data["json"] = &errInfo
+	this.ServeJSON()
+}

+ 7 - 0
src/dashoo.cn/frontend_web/src/api/oilsupplier/supplier.js

@@ -259,5 +259,12 @@ export default {
       url: '/supplier/getSupplierCertId/' + Id,
       method: 'get'
     })
+  },
+  updateInvoiceInfo (params, myAxios) {
+    return myAxios({
+      url: '/supplier/updateInvoiceInfo',
+      method: 'post',
+      data: params
+    })
   }
 }

+ 138 - 3
src/dashoo.cn/frontend_web/src/pages/oilsupplier/paymentinfo/paymentsure.vue

@@ -24,6 +24,7 @@
               <el-button type="primary" size="mini" icon="el-icon-search" @click="handleSearch">获取账单</el-button>
             </el-form-item>
             <el-form-item>
+              <el-button type="primary" size="mini" @click="invoiceDialog" v-if="entityList && entityList.length > 0">修改发票信息</el-button>
               <el-button type="primary" size="mini" style="margin-right: 15px" @click="printBtn">打印</el-button>
               <el-button type="primary" plain title="查看详情" size="mini" v-if="entityList && entityList.length > 0" :loading="sureLoading" @click="BillSureClickConfirm">确认交费单</el-button>
             </el-form-item>
@@ -34,13 +35,14 @@
         <el-row>
           <el-col :span="6" class="table-cell-title">单位名称</el-col>
           <el-col :span="6" class="table-cell-title">税号</el-col>
-          <el-col :span="12" class="table-cell-title">注册地址</el-col>
+          <el-col :span="12" class="table-cell-title">开票地址</el-col>
         </el-row>
 
         <el-row>
           <el-col :span="6" class="table-cell" :title="formDataSup.SupplierName">{{this.formDataSup.SupplierName}}</el-col>
           <el-col :span="6" class="table-cell">{{this.formDataSup.CommercialNo}}</el-col>
-          <el-col :span="12" class="table-cell">{{this.formDataSup.AllAddress}} {{this.formDataSup.Address}}</el-col>
+          <el-col :span="12" class="table-cell" v-if="this.formDataSup.InvoiceAddress === ''">{{this.formDataSup.AllAddress}} {{this.formDataSup.Address}}</el-col>
+          <el-col :span="12" class="table-cell" v-else>{{this.formDataSup.InvoiceAddress}}</el-col>
         </el-row>
         <el-row>
           <el-col :span="6" class="table-cell-title">开户银行</el-col>
@@ -111,6 +113,52 @@
       </el-table>
     </el-card>
 
+    <el-dialog title="修改发票信息" :visible.sync="updateVisible">
+      <el-form label-width="100px" ref="updateFormData" :rules="rules" :model="formDataSupCopy" size="small">
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="单位名称" label-width="100px" style="width: 100%" prop="SupplierName">
+              <el-input v-model="formDataSupCopy.SupplierName" readonly></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="税号" label-width="100px" style="width: 100%" prop="CommercialNo">
+              <el-input v-model="formDataSupCopy.CommercialNo" readonly></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="开票地址" label-width="100px" style="width: 100%" prop="InvoiceAddress">
+              <el-input v-model="formDataSupCopy.InvoiceAddress"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="开户银行" label-width="100px" style="width: 100%" prop="DepositBank">
+              <el-input v-model="formDataSupCopy.DepositBank"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="银行账号" label-width="100px" style="width: 100%" prop="BankAccount">
+              <el-input v-model="formDataSupCopy.BankAccount"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="财务电话" label-width="100px" style="width: 100%" prop="CompanyTel">
+              <el-input v-model="formDataSupCopy.CompanyTel"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="电子邮箱" label-width="100px" style="width: 100%" prop="EMail">
+              <el-input v-model="formDataSupCopy.EMail"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <div slot="footer" class="dialog-footer" style="margin-top: -25px">
+        <el-button size="mini" @click="updateVisible = false">取消</el-button>
+        <el-button type="primary" size="mini" @click="updateInvoice">确定</el-button>
+      </div>
+    </el-dialog>
+
     <el-dialog
       title="打印内容"
       :visible.sync="dialogVisible"
@@ -134,7 +182,8 @@
             <div class="table-cell-title2">地址、财务电话:</div>
           </el-col>
           <el-col :span="16">
-            <div class="table-cell2">{{this.formDataSup.AllAddress}} {{this.formDataSup.Address}}&nbsp;&nbsp;&nbsp;&nbsp;{{this.formDataSup.CompanyTel}}</div>
+            <div class="table-cell2" v-if="this.formDataSup.InvoiceAddress === ''">{{this.formDataSup.AllAddress}} {{this.formDataSup.Address}}&nbsp;&nbsp;&nbsp;&nbsp;{{this.formDataSup.CompanyTel}}</div>
+            <div class="table-cell2" v-else>{{this.formDataSup.InvoiceAddress}}&nbsp;&nbsp;&nbsp;&nbsp;{{this.formDataSup.CompanyTel}}</div>
           </el-col>
           <el-col :span="8">
             <div class="table-cell-title2">开户行及账号:</div>
@@ -164,6 +213,7 @@
     mapGetters
   } from 'vuex'
   import api from '@/api/oilsupplier/paymentinfo'
+  import supplierApi from '@/api/oilsupplier/supplier'
 
   export default {
     computed: {
@@ -174,9 +224,48 @@
     name: 'paymentinfoEdit',
 
     data () {
+      var checkEmail = (rule, value, callback) => {
+        if (value) {
+          let re = /^([a-zA-Z0-9]+[_|-|.|-]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|-|.|-]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/
+          if (!re.test(value)) {
+            callback(new Error('请输入正确的邮箱地址'))
+          } else {
+            callback()
+          }
+        } else {
+          callback()
+        }
+      }
+      var checkBankAccount = (rule, value, callback) => {
+        if (value === '') {
+          callback(new Error('请输入银行账号'))
+        } else {
+          if (value.length < 9) {
+            callback(new Error('请填写正确位数的银行账号'))
+          } else {
+            callback()
+          }
+        }
+      }
       return {
         dialogVisible: false,
+        updateVisible: false,
         serviceId: '',
+        rules: {
+          SupplierName: [{required: true, message: '公司名称不能为空', trigger: 'blur'}],
+          CommercialNo: [{required: true, message: '税号不能为空', trigger: 'blur'}],
+          InvoiceAddress: [{required: true, message: '地址不能为空', trigger: 'blur'}],
+          CompanyTel: [{required: true, message: '财务电话不能为空', trigger: 'blur'}],
+          EMail: [
+            {required: true, message: '电子邮箱不能为空', trigger: 'blur'},
+            {required: true, validator: checkEmail, trigger: 'change'}
+          ],
+          DepositBank: [{required: true, message: '开户行不能为空', trigger: 'blur'}],
+          BankAccount: [
+            {required: true, message: '银行账号不能为空', trigger: 'blur'},
+            {required: true, validator: checkBankAccount, trigger: 'change'}
+          ]
+        },
         entityList: [],
         entityList2: [],
         amount1: 0,
@@ -196,6 +285,16 @@
         formDataSup: {},
         searchForm: {
           commercialNo: ''
+        },
+        formDataSupCopy: {
+          SupplierName: '',
+          Id: '',
+          CommercialNo: '',
+          InvoiceAddress: '',
+          DepositBank: '',
+          BankAccount: '',
+          CompanyTel: '',
+          EMail: '',
         }
       }
     },
@@ -207,6 +306,42 @@
       handleSearch () {
         this.initDatas()
       },
+      invoiceDialog () {
+        this.updateVisible = true
+        this.formDataSupCopy.SupplierName = this.formDataSup.SupplierName
+        this.formDataSupCopy.Id = this.formDataSup.Id
+        this.formDataSupCopy.CommercialNo = this.formDataSup.CommercialNo
+        this.formDataSupCopy.InvoiceAddress = this.formDataSup.InvoiceAddress === '' ? this.formDataSup.AllAddress + this.formDataSup.Address : this.formDataSup.InvoiceAddress
+        this.formDataSupCopy.DepositBank = this.formDataSup.DepositBank
+        this.formDataSupCopy.BankAccount = this.formDataSup.BankAccount
+        this.formDataSupCopy.CompanyTel = this.formDataSup.CompanyTel
+        this.formDataSupCopy.EMail = this.formDataSup.EMail
+      },
+      updateInvoice () {
+        console.log('修改发票信息')
+        this.$refs["updateFormData"].validate((valid) => {
+          if (valid) {
+            supplierApi.updateInvoiceInfo(this.formDataSupCopy, this.$axios).then(res => {
+              this.initDatas()
+              this.updateVisible = false
+              let type = 'success'
+              if (res.data.code === -1) {
+                type = 'warning'
+              }
+              this.$message({
+                duration: 10000,
+                type: type,
+                message: res.data.message
+              })
+            }).catch(err => {
+              console.error(err)
+            })
+          } else {
+            console.log('error submit!!');
+            return false;
+          }
+        })
+      },
       NoChange (val) {
         let obj = {}
         obj = this.NoOptions.find((item) => {