payAdd.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view class="page" :style="{'height':(h-th)+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="添加收款" :showIcon="true"></c-nav-bar>
  4. <view class="content">
  5. <view class="box">
  6. <view class="item">
  7. <text>订单金额</text>
  8. <text style="color: #245BED;">{{money}}</text>
  9. </view>
  10. <view class="item">
  11. <text>已付金额</text>
  12. <text style="color: #FF9B17;">{{haspay}}</text>
  13. </view>
  14. <view class="item">
  15. <text>还需付款</text>
  16. <text style="color: #F14D4D;">{{money-haspay}}</text>
  17. </view>
  18. </view>
  19. <view style="background-color:#fff;padding:0 30rpx 20rpx;">
  20. <u-cell-group :border="false" customStyle="margin:0 -30rpx">
  21. <u-cell class="pd15">
  22. <text slot="icon" class="label">类型</text>
  23. <view slot="title" class="title">
  24. <u-radio-group v-model="dataForm.flowTypeName" iconPlacement="left" style="white">
  25. <u-radio :customStyle="{padding: '8rpx 0',margin:'0 0 0 30px'}"
  26. v-for="(item, index) in checkboxList" :key="index" :label="item.name" :name="item.name" shape="circle"
  27. size="30" labelSize="30" icon-size="22">
  28. </u-radio>
  29. </u-radio-group>
  30. </view>
  31. </u-cell>
  32. <u-cell class="pd15" :isLink="true" @click="showPay=true">
  33. <text slot="icon" class="label">支付方式</text>
  34. <view slot="title" class="title">
  35. {{dataForm.payTypeName}}
  36. </view>
  37. </u-cell>
  38. <u-cell class="pd15">
  39. <text slot="icon" class="label">金额</text>
  40. <view slot="title" class="title">
  41. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  42. type="number" placeholder="请输入金额" v-model="dataForm.amount"></u--input>
  43. </view>
  44. </u-cell>
  45. <u-cell class="pd15" :border="false">
  46. <text slot="icon" class="label">备注</text>
  47. <view slot="title" class="title">
  48. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  49. placeholder="请输入" v-model="dataForm.remark"></u--input>
  50. </view>
  51. </u-cell>
  52. </u-cell-group>
  53. </view>
  54. </view>
  55. <view class="btn">
  56. <text @click="conform()">确定</text>
  57. </view>
  58. <u-picker :itemHeight="88" :immediateChange="true" :show="showPay" :columns="payStyle" title="支付方式选择"
  59. keyName="label" :defaultIndex="passengerDefault" @cancel="showPay=false;"
  60. @confirm="passengerConfirm"></u-picker>
  61. </view>
  62. </template>
  63. <script>
  64. import list from '../../uni_modules/uview-ui/libs/config/props/list';
  65. export default {
  66. data() {
  67. return {
  68. money: '',
  69. showPay: false,
  70. passengerDefault: [0],
  71. checkboxList:[{
  72. name:'收款'
  73. }],
  74. dataForm: {
  75. flowType: '1',
  76. flowTypeName:'收款',
  77. amount: '',
  78. remark: '',
  79. payType: '',
  80. payTypeName: ''
  81. },
  82. haspay:0,
  83. payStyle: [
  84. [{
  85. label: '微信',
  86. val: 1
  87. }, {
  88. label: '支付宝',
  89. val: 2
  90. },
  91. {
  92. label: '云闪付',
  93. val: 3
  94. }
  95. ]
  96. ],
  97. }
  98. },
  99. onLoad(opt) {
  100. //this.haspay=0;
  101. this.money = opt.money;
  102. this.list = JSON.parse(opt.list);
  103. for(let i=0;i<this.list.length;i++){
  104. if(this.list[i].flowType==1){ //收款
  105. this.haspay+=parseFloat(this.list[i].amount);
  106. }else{
  107. this.haspay-=parseFloat(this.list[i].amount);
  108. }
  109. }
  110. },
  111. methods: {
  112. // 支付方式
  113. passengerConfirm(e) {
  114. this.dataForm.payType = e.value[0].val;
  115. this.dataForm.payTypeName = e.value[0].label;
  116. this.showPay = false;
  117. },
  118. conform() {
  119. if(this.dataForm.payType==''){
  120. return this.$showToast('请选择支付方式');
  121. }
  122. if(this.dataForm.amount>(this.money-this.haspay)) return this.$showToast('支付金额不能大于剩余付款金额')
  123. if(this.dataForm.flowTypeName=='收款'){
  124. this.dataForm.flowType=1;
  125. }else{
  126. this.dataForm.flowType=2;
  127. }
  128. this.getOpenerEventChannel().emit('addSuccess', {
  129. 'data': this.dataForm,
  130. });
  131. uni.navigateBack();
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .pd15{padding: 10rpx 0!important;}
  138. .btn {
  139. position: fixed;
  140. background-color: #fff;
  141. padding: 30rpx 0;
  142. z-index: 9;
  143. bottom: 0;
  144. width: 100%;
  145. left: 0;
  146. text-align: center;
  147. text {
  148. display: inline-block;
  149. width: 90%;
  150. height: 96rpx;
  151. line-height: 96rpx;
  152. background-color: #1372FF;
  153. color: #fff;
  154. font-size: 34rpx;
  155. border-radius: 48rpx;
  156. }
  157. }
  158. .page {
  159. background: #F3F4F4;
  160. box-sizing: border-box;
  161. overflow-y: auto;
  162. overflow-x: auto;
  163. }
  164. .content {
  165. width: 94%;
  166. margin: 20rpx auto 0;
  167. box-sizing: border-box;
  168. .title{
  169. text-align: right;
  170. }
  171. .box {
  172. padding: 28rpx 30rpx 0;
  173. border-radius: 10rpx;
  174. margin: 30rpx 0;
  175. background-color: #fff;
  176. .item {
  177. padding-bottom: 32rpx;
  178. display: flex;
  179. align-items: center;
  180. justify-content: space-between;
  181. &:last-child {
  182. border: 0;
  183. }
  184. text {
  185. font-size: 30rpx;
  186. }
  187. }
  188. }
  189. }
  190. </style>