payAdd.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. name:'退款'
  75. }],
  76. dataForm: {
  77. flowType: '',
  78. flowTypeName:'',
  79. amount: '',
  80. remark: '',
  81. payType: '',
  82. payTypeName: ''
  83. },
  84. haspay:0,
  85. payStyle: [
  86. [{
  87. label: '微信',
  88. val: 1
  89. }, {
  90. label: '支付宝',
  91. val: 2
  92. },
  93. {
  94. label: '云闪付',
  95. val: 3
  96. }
  97. ]
  98. ],
  99. }
  100. },
  101. onLoad(opt) {
  102. //this.haspay=0;
  103. this.money = opt.money;
  104. this.list = JSON.parse(opt.list);
  105. for(let i=0;i<this.list.length;i++){
  106. if(this.list[i].flowType==1){ //收款
  107. this.haspay+=parseFloat(this.list[i].amount);
  108. }else{
  109. this.haspay-=parseFloat(this.list[i].amount);
  110. }
  111. }
  112. },
  113. methods: {
  114. // 支付方式
  115. passengerConfirm(e) {
  116. this.dataForm.payType = e.value[0].val;
  117. this.dataForm.payTypeName = e.value[0].label;
  118. this.showPay = false;
  119. },
  120. conform() {
  121. if(this.dataForm.flowTypeName=='收款'){
  122. this.dataForm.flowType=1;
  123. }else{
  124. this.dataForm.flowType=2;
  125. }
  126. this.getOpenerEventChannel().emit('addSuccess', {
  127. 'data': this.dataForm,
  128. });
  129. uni.navigateBack();
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. .pd15{padding: 10rpx 0!important;}
  136. .btn {
  137. position: fixed;
  138. background-color: #fff;
  139. padding: 30rpx 0;
  140. z-index: 9;
  141. bottom: 0;
  142. width: 100%;
  143. left: 0;
  144. text-align: center;
  145. text {
  146. display: inline-block;
  147. width: 90%;
  148. height: 96rpx;
  149. line-height: 96rpx;
  150. background-color: #1372FF;
  151. color: #fff;
  152. font-size: 34rpx;
  153. border-radius: 48rpx;
  154. }
  155. }
  156. .page {
  157. background: #F3F4F4;
  158. box-sizing: border-box;
  159. overflow-y: auto;
  160. overflow-x: auto;
  161. }
  162. .content {
  163. width: 94%;
  164. margin: 20rpx auto 0;
  165. box-sizing: border-box;
  166. .title{
  167. text-align: right;
  168. }
  169. .box {
  170. padding: 28rpx 30rpx 0;
  171. border-radius: 10rpx;
  172. margin: 30rpx 0;
  173. background-color: #fff;
  174. .item {
  175. padding-bottom: 32rpx;
  176. display: flex;
  177. align-items: center;
  178. justify-content: space-between;
  179. &:last-child {
  180. border: 0;
  181. }
  182. text {
  183. font-size: 30rpx;
  184. }
  185. }
  186. }
  187. }
  188. </style>