billHistoryDetail.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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"></billList></view>
  54. <view class="footer flex align_center" v-if="billInfo.billStatus == 'UNSETTLE'">
  55. <view style="flex:1;color:#00aaff;" @click="handleEdit">{{isShowEdit?'取消':'编辑'}}</view>
  56. <view class="flex" style="width: 78%;">
  57. <u-button type="warning" shape="circle" @click="openPaymentModal">确认收款</u-button>
  58. <u-button type="primary" shape="circle" :loading="btnLoading" @click="submitOrder" :custom-style="customStyle">再次发送对账单</u-button>
  59. </view>
  60. </view>
  61. <!-- 确认收款弹窗 -->
  62. <u-popup v-model="showPayment" mode="center" :border-radius="20" width="82%">
  63. <view class="slot-content">
  64. <view style="padding:50rpx 40rpx;">
  65. <u-form :model="form" ref="uForm" :label-width="190" :rules="rules" :label-style="{color:'#999'}">
  66. <u-form-item :border-bottom ="false" label="总单数:" prop="num">23</u-form-item>
  67. <u-form-item :border-bottom ="false" label="实际收款金额:" prop="money"><u-input type="number" placeholder="请输入实际收款金额(最多2位小数)" :border="true" :height="60" v-model="form.money"/></u-form-item>
  68. </u-form>
  69. </view>
  70. <view class="paymentFooter flex algin-center">
  71. <view @click="showPayment = false">取消</view>
  72. <view >确定</view>
  73. </view>
  74. </view>
  75. </u-popup>
  76. <!-- 分享询问弹窗 -->
  77. <u-modal v-model="shareShow" :show-cancel-button="true" :content="shareContent" @confirm="handleShare" @cancel="shareShow = false;btnLoading = false;"></u-modal>
  78. </view>
  79. </template>
  80. <script>
  81. import billList from './billListComponent.vue';
  82. import { findBySn, insert } from '@/api/verify.js';
  83. import getDate from '@/libs/getDate.js';
  84. import { toThousands } from '@/libs/tools.js'
  85. export default {
  86. components: { billList },
  87. data() {
  88. return {
  89. customStyle: {
  90. backgroundColor: this.$config('primaryColor'),
  91. color: '#fff'
  92. },
  93. verifySn: '',
  94. billInfo: null,
  95. billArr: [],
  96. timeInfo: '',
  97. btnLoading: false,
  98. shareShow: false,
  99. isShowEdit:false,//编辑
  100. shareContent: `是否同意发送对账单给微信好友?`,
  101. toThousands,
  102. showPayment:false,
  103. form:{
  104. money:''
  105. },
  106. rules: {
  107. money: [
  108. {
  109. required: true,
  110. message: '请输入实际收款金额',
  111. trigger: ['change','blur'],
  112. }
  113. ]
  114. }
  115. };
  116. },
  117. onReady() {
  118. uni.setNavigationBarColor({
  119. frontColor: '#ffffff',
  120. backgroundColor: this.$config('primaryColor')
  121. });
  122. },
  123. onLoad(options) {
  124. if (options && options.billId) {
  125. this.verifySn = options.billId;
  126. this.loadData({ verifySn: options.billId });
  127. }
  128. },
  129. computed: {
  130. //经销商信息
  131. userData() {
  132. return this.$store.state.vuex_userData;
  133. }
  134. },
  135. methods: {
  136. loadData(ajaxData) {
  137. let that = this;
  138. findBySn(ajaxData).then(res => {
  139. if (res.status == 200) {
  140. that.billInfo = res.data;
  141. that.billArr = res.data.detailList;
  142. let timeobj = getDate.editDay(res.data.bizBeginDate, res.data.bizEndDate);
  143. that.timeInfo = timeobj.starttime + '~' + timeobj.endtime;
  144. that.$nextTick(() => {
  145. that.$refs.billBox.setData(res.data.detailList);
  146. });
  147. }
  148. });
  149. },
  150. // 打开确认收款弹窗
  151. openPaymentModal(){
  152. this.showPayment = true
  153. this.$nextTick(()=>{
  154. this.$refs.uForm.setRules(this.rules);
  155. })
  156. },
  157. submitOrder() {
  158. //发送对账单
  159. this.shareShow = true;
  160. },
  161. //确认收款
  162. handlePay(){
  163. this.$refs.uForm.validate(valid => {
  164. if (valid) {
  165. console.log('验证通过');
  166. } else {
  167. console.log('验证失败');
  168. }
  169. });
  170. },
  171. handleEdit(){
  172. this.isShowEdit=!this.isShowEdit
  173. this.$refs.billBox.allSelect(true)
  174. },
  175. // 分享图文
  176. handleShare() {
  177. let jumpUrl = getApp().globalData.baseUrl.replace('qpls-md/','')
  178. let url = jumpUrl+'dzd/index.html?' + this.userData.orgSn + '&' + this.verifySn;
  179. if (uni.getSystemInfoSync().platform == 'ios') {
  180. uni.share({
  181. provider: 'weixin',
  182. scene: 'WXSceneSession',
  183. type: 0,
  184. href: url,
  185. title: this.billInfo.customer.customerName + '的对账单',
  186. summary: '共' + this.billInfo.settleAmount + '元,请您查阅',
  187. imageUrl: '../../static/logo.png',
  188. success: function(res) {
  189. console.log('success:' + JSON.stringify(res));
  190. },
  191. fail: function(err) {
  192. console.log('fail:' + JSON.stringify(err));
  193. }
  194. });
  195. } else {
  196. uni.shareWithSystem({
  197. summary: this.billInfo.customer.customerName + '您好,您有一个对账单共' + this.billInfo.settleAmount + '元,请您查阅',
  198. href: url,
  199. success() {
  200. console.log('调取微信列表成功,分享不一定成功');
  201. },
  202. fail() {
  203. console.log('分享失败');
  204. }
  205. });
  206. }
  207. }
  208. }
  209. };
  210. </script>
  211. <style lang="scss" scoped>
  212. .content {
  213. height: 100vh;
  214. width: 100%;
  215. box-sizing: border-box;
  216. .b_head {
  217. background-color: #fff;
  218. .head_list {
  219. padding: 14rpx 20rpx;
  220. border-bottom: 1rpx solid #f8f8f8;
  221. text {
  222. &:first-child {
  223. color: $uni-text-color-grey;
  224. display: inline-block;
  225. width: 160rpx;
  226. }
  227. }
  228. }
  229. }
  230. .b_detail {
  231. margin: 6rpx 0;
  232. background-color: #fff;
  233. padding: 20rpx;
  234. box-sizing: border-box;
  235. .detail_list {
  236. margin-bottom: 10rpx;
  237. &:last-child {
  238. margin-bottom: 0rpx;
  239. }
  240. .detail_box::after {
  241. content: ';';
  242. color: $uni-text-color-grey;
  243. }
  244. .detail_box {
  245. text {
  246. &:first-child {
  247. color: $uni-text-color-grey;
  248. }
  249. &:last-child {
  250. color: $uni-color-warning;
  251. font-weight: 600;
  252. }
  253. }
  254. }
  255. }
  256. }
  257. .detail_con {
  258. flex-grow: 1;
  259. overflow: auto;
  260. background-color: #fff;
  261. }
  262. .footer {
  263. width: 100%;
  264. box-sizing: border-box;
  265. padding: 10rpx 20rpx;
  266. background: #fff;
  267. }
  268. }
  269. // 确认收款弹窗
  270. .slot-content{
  271. .u-form-item{
  272. line-height:0 !important;
  273. }
  274. .paymentFooter{
  275. border-top:1rpx solid #eee;
  276. view{
  277. width: 50%;
  278. text-align:center;
  279. padding:26rpx 0;
  280. }
  281. }
  282. .paymentFooter view:last-child{
  283. color:#007aff;
  284. border-left:1rpx solid #eee;
  285. }
  286. }
  287. </style>