billHistoryEdit.vue 8.2 KB

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