billHistoryEdit.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="content flex flex_column" v-if="billInfo">
  3. <view class="b_head">
  4. <view class="head_list">
  5. <text>分享时间</text>
  6. <text>{{ billInfo.createDate }}</text>
  7. </view>
  8. <view class="head_list" v-if="billInfo.customer">
  9. <text>客户名称</text>
  10. <text>{{ billInfo.customer.customerName }}</text>
  11. </view>
  12. <!-- <view class="head_list">
  13. <text>对账周期</text>
  14. <text>{{ timeInfo || '--' }}</text>
  15. </view> -->
  16. <view class="head_list">
  17. <text>付款状态</text>
  18. <text>{{ billInfo.billStatus == 'UNSETTLE' ? '未付款' : billInfo.settleStyleSnDictValue ? '已结清(' + billInfo.settleStyleSnDictValue + ')' : '已结清' }}</text>
  19. </view>
  20. </view>
  21. <view class="b_detail">
  22. <view class="detail_list u-flex">
  23. <view class="detail_box">
  24. <text>总单数:</text>
  25. <text>{{ billInfo.detailNum }}</text>
  26. </view>
  27. <view class="detail_box">
  28. <text>待收金额合计:</text>
  29. <text>¥{{ billInfo.totalAmount ||billInfo.totalAmount == 0 ? toThousands(billInfo.totalAmount,2):'--' }}</text>
  30. </view>
  31. </view>
  32. <view class="detail_list u-flex">
  33. <view class="detail_box">
  34. <text>折让金额:</text>
  35. <text>¥{{ billInfo.discountAmount||billInfo.discountAmount==0? toThousands(billInfo.discountAmount,2):'--'}}</text>
  36. </view>
  37. <view class="detail_box">
  38. <text>折让后待收金额:</text>
  39. <text>¥{{ billInfo.settleAmount||billInfo.settleAmount ==0? toThousands(billInfo.settleAmount,2):'--' }}</text>
  40. </view>
  41. </view>
  42. <view class="detail_list u-flex" v-if="billInfo.billStatus != 'UNSETTLE'">
  43. <view class="detail_box">
  44. <text>实际折让金额:</text>
  45. <text>¥{{ billInfo.discountAmount||billInfo.discountAmount==0? toThousands(billInfo.discountAmount,2):'--'}}</text>
  46. </view>
  47. <view class="detail_box">
  48. <text>实际收款金额:</text>
  49. <text>¥{{ billInfo.settleAmount||billInfo.settleAmount ==0? toThousands(billInfo.settleAmount,2):'--' }}</text>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="detail_con"><billList ref="billBox" :list="billArr" :showCheck="isShowEdit" @allChecked="chooseBillList"></billList></view>
  54. <view class="footer flex align_center" v-if="billInfo.billStatus == 'UNSETTLE' && billArr&&billArr.length!=0">
  55. <u-checkbox-group style="flex:1;">
  56. <u-checkbox v-model="checkedAll" shape="circle" @change="chooseAll">{{checkedAll?'取消全选':'全选'}}</u-checkbox>
  57. </u-checkbox-group>
  58. <view class="u-flex u-row-right">
  59. <u-button type="error" shape="circle" :loading="btnLoading" @click="handleEvents('del')" :custom-style="customStyle">删除</u-button>
  60. <u-button type="warning" shape="circle" style="margin-left: 30rpx;" @click="handleEvents('update')">一键刷新</u-button>
  61. </view>
  62. </view>
  63. <u-modal v-model="modalShow" :show-title="false" :content="modalCon" :show-cancel-button="true" @confirm="handleConfirm"></u-modal>
  64. </view>
  65. </template>
  66. <script>
  67. import billList from './billListComponent.vue';
  68. import { findBySn, insert,flushBill,deleteDetails } from '@/api/verify.js';
  69. import getDate from '@/libs/getDate.js';
  70. import { toThousands } from '@/libs/tools.js'
  71. export default {
  72. components: { billList },
  73. data() {
  74. return {
  75. customStyle: {
  76. width:'200rpx',
  77. color: '#fff'
  78. },
  79. verifySn: '',
  80. billInfo: null,
  81. billArr: [],
  82. timeInfo: '',
  83. btnLoading: false,
  84. shareShow: false,
  85. isShowEdit:true,//删除
  86. shareContent: `是否同意发送对账单给微信好友?`,
  87. toThousands,
  88. form:{
  89. money:''
  90. },
  91. checkedAll:false,
  92. rules: {
  93. money: [
  94. {
  95. required: true,
  96. message: '请输入实际收款金额',
  97. trigger: ['change','blur'],
  98. }
  99. ]
  100. },
  101. orderList:[],
  102. modalShow:false,
  103. modalCon:'刷新后,将删除对账单中已收款的订单,更新待收款单据。确定刷新吗?',
  104. eventsType:'' //打开弹窗类型 del删除 update更新
  105. };
  106. },
  107. onReady() {
  108. uni.setNavigationBarColor({
  109. frontColor: '#ffffff',
  110. backgroundColor: this.$config('primaryColor')
  111. });
  112. },
  113. onLoad(options) {
  114. if (options && options.billId) {
  115. this.verifySn = options.billId;
  116. this.loadData({ verifySn: options.billId });
  117. }
  118. },
  119. onBackPress(e){
  120. uni.redirectTo({
  121. url: '/pages/sales/billHistoryDetail?billId=' + this.verifySn
  122. })
  123. return true;
  124. },
  125. computed: {
  126. //经销商信息
  127. userData() {
  128. return this.$store.state.vuex_userData;
  129. }
  130. },
  131. methods: {
  132. //一键刷新
  133. handleUpdate(){
  134. flushBill({verifySn:this.verifySn}).then(res => {
  135. if (res.status == 200) {
  136. this.loadData({ verifySn: this.verifySn })
  137. }
  138. });
  139. },
  140. //删除
  141. deleteOrder(){
  142. let that=this
  143. deleteDetails({verifySn:that.verifySn,detailSnList:that.orderList}).then(res => {
  144. if (res.status == 200) {
  145. uni.showToast({
  146. title:res.message,
  147. duration: 2000
  148. })
  149. that.loadData({ verifySn: that.verifySn });
  150. }
  151. });
  152. },
  153. handleEvents(type){
  154. this.eventsType=type
  155. if(type == 'del'){
  156. let allList=this.$refs.billBox.getAllData();
  157. let newChooseList = []
  158. let num = 0
  159. allList.forEach(item=>{
  160. if(item.checked){
  161. newChooseList.push(item.detailSn)
  162. num+=item.unsettleAmount
  163. }
  164. })
  165. if(newChooseList.length == 0){
  166. uni.showToast({
  167. title:'请先选择要删除的对账单',
  168. icon:'none'
  169. })
  170. return
  171. }
  172. this.orderList=newChooseList
  173. let newNum=toThousands(num,2)
  174. this.modalCon = '选中'+newChooseList.length+'项,待收金额¥'+newNum+',确认删除吗?'
  175. }
  176. let that=this
  177. that.$nextTick(()=>{
  178. that.modalShow = true
  179. })
  180. },
  181. //确定提交删除、刷新
  182. handleConfirm(){
  183. if(this.eventsType=='del'){
  184. this.deleteOrder();
  185. }else{
  186. this.handleUpdate();
  187. }
  188. },
  189. chooseBillList(flag){
  190. this.checkedAll = flag
  191. },
  192. chooseAll(){
  193. this.$refs.billBox.allSelect(!this.checkedAll);
  194. },
  195. loadData(ajaxData) {
  196. let that = this;
  197. findBySn(ajaxData).then(res => {
  198. if (res.status == 200) {
  199. that.billInfo = res.data;
  200. that.billArr = res.data.detailList;
  201. let timeobj = getDate.editDay(res.data.bizBeginDate, res.data.bizEndDate);
  202. that.timeInfo = timeobj.starttime + '~' + timeobj.endtime;
  203. that.$nextTick(() => {
  204. that.$refs.billBox.setData(res.data.detailList);
  205. });
  206. }
  207. });
  208. }
  209. }
  210. };
  211. </script>
  212. <style lang="scss" scoped>
  213. .content {
  214. height: 100vh;
  215. width: 100%;
  216. box-sizing: border-box;
  217. .b_head {
  218. background-color: #fff;
  219. .head_list {
  220. padding: 14rpx 20rpx;
  221. border-bottom: 1rpx solid #f8f8f8;
  222. text {
  223. &:first-child {
  224. color: $uni-text-color-grey;
  225. display: inline-block;
  226. width: 160rpx;
  227. }
  228. }
  229. }
  230. }
  231. .b_detail {
  232. margin: 6rpx 0;
  233. background-color: #fff;
  234. padding: 20rpx;
  235. box-sizing: border-box;
  236. .detail_list {
  237. margin-bottom: 10rpx;
  238. &:last-child {
  239. margin-bottom: 0rpx;
  240. }
  241. .detail_box::after {
  242. content: ';';
  243. color: $uni-text-color-grey;
  244. }
  245. .detail_box {
  246. text {
  247. &:first-child {
  248. color: $uni-text-color-grey;
  249. }
  250. &:last-child {
  251. color: $uni-color-warning;
  252. font-weight: 600;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. .detail_con {
  259. flex-grow: 1;
  260. overflow: auto;
  261. background-color: #fff;
  262. }
  263. .footer {
  264. width: 100%;
  265. box-sizing: border-box;
  266. padding: 10rpx 20rpx;
  267. background: #fff;
  268. }
  269. }
  270. // 确认收款弹窗
  271. .slot-content{
  272. .u-form-item{
  273. line-height:0 !important;
  274. }
  275. .paymentFooter{
  276. border-top:1rpx solid #eee;
  277. view{
  278. width: 50%;
  279. text-align:center;
  280. padding:26rpx 0;
  281. }
  282. }
  283. .paymentFooter view:last-child{
  284. color:#007aff;
  285. border-left:1rpx solid #eee;
  286. }
  287. }
  288. </style>