BillList.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <seller-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
  3. <view class="div common-header-wrap">
  4. <view class="status-holder"></view>
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="账单管理" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <!-- header -->
  14. <view class="div order-header">
  15. <view class="ul">
  16. <view
  17. class="li item"
  18. v-for="item in orderNav"
  19. v-bind:key="item.id"
  20. v-bind:class="{ active: bill_state == item.id }"
  21. v-on:click="setOrderNavActive(item.id)"
  22. >
  23. {{ item.name }}
  24. </view>
  25. </view>
  26. </view>
  27. <view class="scroll-view div" style="position:relative">
  28. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div" @scrolltolower="loadMore" scroll-y="true">
  29. <view class="div" v-if="billList && billList.length">
  30. <view class="div settle-item" v-for="bill in billList" :key="bill.ob_no">
  31. <view class="div title">{{$moment.unix(bill.ob_startdate).format('YYYY年MM月DD日')}}~{{$moment.unix(bill.ob_enddate).format('YYYY年MM月DD日')}}</view>
  32. <view class="div content">
  33. <view class="div item">
  34. <view class="div mt">订单金额</view>
  35. <view class="div mc income"><text class="span strong">{{parseFloat(bill.ob_order_totals)}}</text>元</view>
  36. </view>
  37. <view class="div item">
  38. <view class="div mt">退还佣金</view>
  39. <view class="div mc income"><text class="span strong">{{parseFloat(bill.ob_commis_return_totals)}}</text>元</view>
  40. </view>
  41. <view class="div item">
  42. <view class="div mt">平台代金券</view>
  43. <view class="div mc income"><text class="span strong">{{parseFloat(bill.ob_mall_voucher_totals)}}</text>元</view>
  44. </view>
  45. <view class="div item">
  46. <view class="div mt">退单金额</view>
  47. <view class="div mc outlay"><text class="span strong">{{parseFloat(bill.ob_order_return_totals)}}</text>元</view>
  48. </view>
  49. <view class="div item">
  50. <view class="div mt">佣金金额</view>
  51. <view class="div mc outlay"><text class="span strong">{{parseFloat(bill.ob_commis_totals)}}</text>元</view>
  52. </view>
  53. <view class="div item">
  54. <view class="div mt">分销佣金</view>
  55. <view class="div mc outlay"><text class="span strong">{{parseFloat(bill.ob_inviter_totals)}}</text>元</view>
  56. </view>
  57. <view class="div item">
  58. <view class="div mt">促销费用</view>
  59. <view class="div mc outlay"><text class="span strong">{{parseFloat(bill.ob_store_cost_totals)}}</text>元</view>
  60. </view>
  61. </view>
  62. <view class="div payment-account">
  63. <text class="span">应收:{{parseFloat(bill.ob_result_totals)}}</text>
  64. <view v-if="bill.ob_state==1" @click="confirmBill(bill.ob_no)" class="div common-btn ds-button-small default btn">确认</view>
  65. <view v-else class="div common-btn ds-button-small default btn">{{bill.ob_states}}</view>
  66. </view>
  67. </view>
  68. </view>
  69. <empty-record v-else-if="billList && !billList.length"></empty-record>
  70. </scroll-view>
  71. </view>
  72. </view>
  73. </seller-base>
  74. </template>
  75. <script>
  76. import {getFontSize} from '@/util/common'
  77. import TitleHeader from '../../TitleHeader'
  78. import SellerBase from '../SellerBase'
  79. import EmptyRecord from '../../EmptyRecord'
  80. import { getBillList,confirmBill } from '../../../api/sellerBill'
  81. export default {
  82. name: 'BillList',
  83. components:{
  84. TitleHeader,
  85. SellerBase,
  86. EmptyRecord
  87. },
  88. computed:{
  89. fontSize(){
  90. return getFontSize()
  91. },
  92. },
  93. data(){
  94. return {
  95. navHeight: 0,
  96. params: { 'page': 0, 'per_page': 10 },
  97. loading: false, // 是否加载更多
  98. isMore: true, // 是否有更多
  99. billList: false, // 商品列表
  100. ob_no: '',
  101. bill_state: '',
  102. orderNav: [
  103. {
  104. 'name': '全部',
  105. 'id': ''
  106. },
  107. {
  108. 'name': '已出账',
  109. 'id': '1'
  110. },
  111. {
  112. 'name': '已确认',
  113. 'id': '2'
  114. },
  115. {
  116. 'name': '已完成',
  117. 'id': '4'
  118. }
  119. ]
  120. }
  121. },
  122. created () {
  123. this.loadMore()
  124. },
  125. mounted(){
  126. // #ifdef MP-WEIXIN
  127. this.navHeight = uni.getMenuButtonBoundingClientRect().height
  128. // #endif
  129. },
  130. methods:{
  131. goBack(){uni.navigateBack({delta:1})},
  132. setOrderNavActive (index) {
  133. this.bill_state = index
  134. this.reload()
  135. },
  136. confirmBill (ob_no) {
  137. confirmBill(ob_no).then(res => {
  138. uni.showToast({icon:'none',title: res.message})
  139. this.reload()
  140. }).catch(function (error) {
  141. uni.showToast({icon:'none',title: error.message})
  142. })
  143. },
  144. getBillList (ispush) {
  145. uni.showLoading({ title: '加载中' })
  146. let params = this.params
  147. getBillList(params, this.ob_no, this.bill_state).then(res => {
  148. uni.hideLoading()
  149. if (ispush && this.billList) {
  150. this.billList = this.billList.concat(res.result.bill_list)
  151. } else {
  152. this.billList = res.result.bill_list
  153. }
  154. if (res.result.hasmore) {
  155. this.isMore = true
  156. } else {
  157. this.isMore = false
  158. }
  159. }).catch(error=>{
  160. uni.hideLoading()
  161. uni.showToast({icon:'none',title: error.message})
  162. })
  163. },
  164. loadMore () {
  165. this.loading = true
  166. this.params.page = ++this.params.page
  167. if (this.isMore) {
  168. this.loading = false
  169. this.getBillList(true)
  170. }
  171. },
  172. reload () {
  173. // 重新加载数据
  174. this.params.page = 0
  175. this.isMore = true
  176. this.billList = false
  177. this.loadMore()
  178. }
  179. }
  180. }
  181. </script>
  182. <style scoped lang="scss">
  183. .scroll-view-wrapper{display: flex;flex-direction: column;}
  184. .scroll-view{flex:1}
  185. .order-header {
  186. height: 2.2rem;
  187. .ul {
  188. list-style: none;
  189. width: auto;
  190. display: flex;
  191. justify-content: space-around;
  192. align-content: center;
  193. align-items: center;
  194. height: 100%;
  195. background: rgba(255, 255, 255, 1);
  196. border-bottom: 1px solid #e8eaed;
  197. .li {
  198. font-size:$subFontSize;
  199. color: #333;
  200. height: 100%;
  201. text-align: center;
  202. line-height: 2.2rem;
  203. border-bottom: 0.1rem solid transparent;
  204. &.active {
  205. color: $primaryColor;
  206. border-bottom-color: $primaryColor;
  207. }
  208. }
  209. }
  210. }
  211. .settle-item {
  212. background: #fff;
  213. margin-top: .5rem;
  214. border-top: 1px solid #eee;
  215. border-bottom: 1px solid #eee;
  216. padding:.5rem;
  217. .title {
  218. font-size:.8rem;
  219. border-bottom: 1px solid #eee;
  220. color: #333;
  221. line-height: 2;
  222. .settle-state {
  223. float: right;
  224. }
  225. .state-check {
  226. color: orangered
  227. }
  228. }
  229. .content {
  230. padding: .5rem 0;
  231. display: flex;
  232. line-height: 1.5;
  233. flex-wrap: wrap;
  234. justify-content: space-between;
  235. .item {
  236. width: 33%;
  237. text-align: center;
  238. .mt {
  239. font-size:$fontSize;
  240. color: #999
  241. }
  242. .mc {
  243. font-size:$fontSize;
  244. color: #000;
  245. .strong {
  246. font-size:$subFontSize;
  247. }
  248. }
  249. .mc.income {
  250. color: #4caf50
  251. }
  252. .mc.outlay {
  253. color: #f31c47
  254. }
  255. }
  256. }
  257. .payment-account{font-size:$subFontSize;color:#333;padding:.5rem 0;border-top:1px solid #eee;display:flex;
  258. .span{flex:1;line-height:1.65rem;padding-right:.5rem}
  259. .btn{min-width:4rem}
  260. }
  261. }
  262. </style>