zhc4dev
wangjiadong 2 years ago
parent 8e75680fc7
commit 65de4b93b4
  1. 43
      ant-design-vue-jeecg/src/views/shopping/components/billTitle.vue
  2. 8
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/mapper/CustomerInvoiceMapper.java
  3. 4
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/ICustomerInvoiceService.java
  4. 11
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customerinvoice/service/impl/CustomerInvoiceServiceImpl.java
  5. 42
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/ApeopersionController.java

@ -8,7 +8,7 @@
</div> </div>
<div class="addrList" v-if="billTitle.length != 0"> <div class="addrList" v-if="billTitle.length != 0">
<div class="item" v-for="(item,index) in billTitle" :key="index"> <div class="item" v-for="(item,index) in billTitle" :key="index">
<p class="default" v-if="item.flag"><span class="f_12">默认抬头</span></p> <p class="default" v-if="item.sort==0"><span class="f_12">默认抬头</span></p>
<div class="d-flex"> <div class="d-flex">
<div><span v-if="item.invoiceType == 1">普通增值税发票</span><span v-if="item.invoiceType == 2">专用增值税发票</span></div> <div><span v-if="item.invoiceType == 1">普通增值税发票</span><span v-if="item.invoiceType == 2">专用增值税发票</span></div>
@ -27,7 +27,7 @@
cancel-text="No" cancel-text="No"
@confirm="confirm2(item.id)" @confirm="confirm2(item.id)"
@cancel="cancel" @cancel="cancel"
v-if="!item.flag" v-if="!item.sort==0"
><span class="btn">将其设置为默认抬头</span></a-popconfirm> ><span class="btn">将其设置为默认抬头</span></a-popconfirm>
<!-- <span class="btn" v-if="!item.flag" @click="handleDefault(item.id)">将其设置为默认抬头</span>--> <!-- <span class="btn" v-if="!item.flag" @click="handleDefault(item.id)">将其设置为默认抬头</span>-->
</div> </div>
@ -115,7 +115,7 @@
</template> </template>
<script> <script>
import { httpAction, getAction } from '@/api/manage' import { httpAction, getAction } from '@/api/manage'
import { deleteAction } from '@/api/manage'
export default { export default {
@ -204,7 +204,9 @@
}, },
url: { url: {
findbill: "/getuserpersion/findbill" findbill: "/getuserpersion/findbill",
szfpmr: "/getuserpersion/szfpmr",
deletefp: "/getuserpersion/deletefp"
}, },
@ -318,14 +320,35 @@
this.flag = 'edit' this.flag = 'edit'
this.form = item this.form = item
}, },
confirm1(id) {
let itemIndex = this.billTitle.findIndex(item =>item.id == id)
this.billTitle.splice(itemIndex,1)
},
confirm2(id) { confirm2(id) {
this.changeDefault()
getAction(this.url.szfpmr,{id,id}).then((res) => {
if(res.success) {
this.loadData(1);
} else {
}
});
/* let itemIndex = this.billTitle.findIndex(item =>item.id == id)
this.billTitle.splice(itemIndex,1)*/
},
confirm1(id) {
deleteAction(this.url.deletefp,{id,id}).then((res) => {
if(res.success) {
this.loadData(1);
} else {
}
});
/*this.changeDefault()
let itemIndex2 = this.billTitle.findIndex(item =>item.id == id) let itemIndex2 = this.billTitle.findIndex(item =>item.id == id)
this.billTitle[itemIndex2].flag = true this.billTitle[itemIndex2].flag = true*/
}, },
cancel(e) { cancel(e) {
this.$message.warning('已取消'); this.$message.warning('已取消');

@ -32,6 +32,12 @@ public interface CustomerInvoiceMapper extends BaseMapper<CustomerInvoice> {
@Select("select sort from customer_invoice where id=#{id} ") @Select("select sort from customer_invoice where id=#{id} ")
int findSort(String id); int findSort(String id);
@Select("select * from customer_invoice where create_by=#{username} ") @Select("select * from customer_invoice where user_id=#{username} ")
List<CustomerInvoice> getfapiao(String username); List<CustomerInvoice> getfapiao(String username);
@Select("select * from customer_invoice where user_id=#{userId} and sort=0")
CustomerInvoice getmoren(String userId);
@Select("SELECT * FROM customer_invoice WHERE user_id=#{userId} ORDER BY sort DESC LIMIT 1")
CustomerInvoice getcmzuida(String userId);
} }

@ -20,4 +20,8 @@ public interface ICustomerInvoiceService extends IService<CustomerInvoice> {
void up(String id); void up(String id);
List<CustomerInvoice> getfapiao(String username); List<CustomerInvoice> getfapiao(String username);
CustomerInvoice getmoren(String userId);
CustomerInvoice getcmzuida(String userId);
} }

@ -41,6 +41,17 @@ public class CustomerInvoiceServiceImpl extends ServiceImpl<CustomerInvoiceMappe
return customerInvoiceMapper.getfapiao(username); return customerInvoiceMapper.getfapiao(username);
} }
@Override
public CustomerInvoice getmoren(String userId) {
return customerInvoiceMapper.getmoren(userId);
}
@Override
public CustomerInvoice getcmzuida(String userId) {
return customerInvoiceMapper.getcmzuida(userId);
}
@Override @Override
public int findSort(String id) { public int findSort(String id) {
return customerInvoiceMapper.findSort(id); return customerInvoiceMapper.findSort(id);

@ -307,8 +307,48 @@ public class ApeopersionController {
//这里方便获取当前登陆信息 //这里方便获取当前登陆信息
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//这里获取当前登陆的用户名 //这里获取当前登陆的用户名
String username = loginUser.getUsername(); String username = loginUser.getId();
List<CustomerInvoice> fapiao= customerInvoiceService.getfapiao(username); List<CustomerInvoice> fapiao= customerInvoiceService.getfapiao(username);
return Result.OK(fapiao); return Result.OK(fapiao);
} }
//这个是获取个人中心的发票列表的设置默认
@RequestMapping(value = "/szfpmr", method = RequestMethod.GET)
public Result<?> szfpmr(@RequestParam(name = "id", required = true) String id) {
//得到了发票抬头的id
String fpid = id;
//根据发票id获取发票的详细信息
CustomerInvoice cmi = customerInvoiceService.getById(id);
//查询是否有默认排序
CustomerInvoice cmimoren= customerInvoiceService.getmoren(cmi.getUserId());
if (cmimoren==null){
cmi.setSort(0);
customerInvoiceService.updateById(cmi);
}else{
cmimoren.setSort(cmi.getSort());
cmi.setSort(0);
customerInvoiceService.updateById(cmimoren);
customerInvoiceService.updateById(cmi);
}
return Result.OK("ok");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "顾客地址表-通过id删除")
@ApiOperation(value="顾客地址表-通过id删除", notes="顾客地址表-通过id删除")
@DeleteMapping(value = "/deletefp")
public Result<?> deletefp(@RequestParam(name="id",required=true) String id) {
customerInvoiceService.removeById(id);
return Result.OK("删除成功!");
}
} }

Loading…
Cancel
Save