index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view>
  3. <z-navbar title="确认补账" back></z-navbar>
  4. <w-picker mode="date" startYear="2000" endYear="2100" v-model="info.operateDate" :current="true" fields="day" @confirm="onConfirmWantDate($event)"
  5. @cancel="onCancel" :disabled-after="false" ref="operateDate"></w-picker>
  6. <z-card class="mt-30 ptb-10">
  7. <z-form :model="info" :rules="rules" ref="info">
  8. <z-form-item label="补账时间" prop="operateDate" showline>
  9. <date-select v-model="info.operateDate" placeholder="选择补账时间"></date-select>
  10. </z-form-item>
  11. </z-form-item>
  12. <z-form-item height="100rpx" label="支付方式" prop="payment" showline>
  13. <z-text :value="paymentText" arrow placeholder="请选择" @click="showPayWay=true"></z-text>
  14. <z-select-popup class="payway_area" :visible.sync="showPayWay" doText="确定" @cancel="toPayment">
  15. <view v-for="(item,index) in paywayList" :key="index">
  16. <view class="flex-n fac fjb plr-40">
  17. <view class="payway_area_text">{{item.dicName}}</view>
  18. <z-input class="payway_area_input" v-model="item.price" type="number" placeholder="¥"></z-input>
  19. </view>
  20. <view class="line" v-if="index<paywayList.length-1"></view>
  21. </view>
  22. </z-select-popup>
  23. </z-form-item>
  24. <z-form-item label="备注信息" prop="remark" labelPos="top">
  25. <textarea class="textarea" v-model="info.remark" placeholder="请输入备注信息" maxlength="512" auto-height></textarea>
  26. </z-form-item>
  27. </z-form>
  28. </z-card>
  29. <view class="common_btn" @click="submit">
  30. 确认补账
  31. </view>
  32. <u-toast ref="uToast"></u-toast>
  33. </view>
  34. </template>
  35. <script>
  36. import dateSelect from './date-select.vue';
  37. export default {
  38. components:{
  39. dateSelect
  40. },
  41. data() {
  42. var validateConfirmMoney = (rule, value, callback) => {
  43. if (this.info.confirmMoney <= 0) {
  44. return {
  45. state: false,
  46. message: '确认补账金额必须大于0'
  47. };
  48. } else
  49. return true;
  50. };
  51. return {
  52. id: '',
  53. type: 0,
  54. info: {
  55. payment: [],
  56. operateDate: '',
  57. remark: ''
  58. },
  59. rules: {
  60. operateDate: [{
  61. required: true,
  62. message: ''
  63. }],
  64. },
  65. switchAlert: false,
  66. showPayWay: false,
  67. paywayList: [],
  68. paymentText: ''
  69. };
  70. },
  71. onLoad(option) {
  72. this.id = option.id;
  73. this.type = option.type;
  74. this.getPayMent();
  75. },
  76. methods: {
  77. getPayMent() {
  78. this.$axios.post('app/dic/paymentCode', {
  79. "parentId": "1001",
  80. "dicType": " paymentCode"
  81. }).then(res => {
  82. console.log(res.data);
  83. for (var i in res.data.list) {
  84. if (res.data.list[i].dicCode != '06') {
  85. this.paywayList.push(res.data.list[i]);
  86. }
  87. }
  88. }).catch(err => {})
  89. },
  90. toPayment() {
  91. var paymentText = '';
  92. for (var i in this.paywayList) {
  93. if (this.paywayList[i].price) {
  94. paymentText += this.paywayList[i].dicName + '、';
  95. }
  96. }
  97. this.paymentText = paymentText.substring(0, paymentText.length - 1);
  98. },
  99. submit() {
  100. this.$refs.info.validate(val => {
  101. console.log(val)
  102. if (val) {
  103. var info = this.info;
  104. for (var i in this.paywayList) {
  105. // if (this.paywayList[i].dicCode == '06') {
  106. // info.consumeMoney = this.paywayList[i].price || 0;
  107. // }
  108. if (this.paywayList[i].price)
  109. info.payment.push({
  110. "payMoney": this.paywayList[i].price,
  111. "paymentCode": this.paywayList[i].dicCode,
  112. "paymentName": this.paywayList[i].dicName,
  113. })
  114. }
  115. this.info = info;
  116. if (this.type == 0) {
  117. this.submitData();
  118. } else {
  119. this.submitWedData();
  120. }
  121. } else {
  122. if (this.info.confirmMoney <= 0) {
  123. this.$refs.uToast.error('确认补账金额必须大于0');
  124. } else
  125. this.$refs.uToast.error('表单填写有误');
  126. }
  127. })
  128. },
  129. submitData() {
  130. this.$axios.post('app/orderFinanceConfirm/saveReceivable', {
  131. // "confirmMoney": this.info.confirmMoney,
  132. "operateDate": this.info.operateDate, //操作时间
  133. "orderId": this.id,
  134. "isSupplement":1,
  135. "payment": this.info.payment,
  136. "remark": this.info.remark
  137. }).then(res => {
  138. this.$refs.uToast.success('订单确认补账成功!');
  139. uni.navigateBack({
  140. delta: 1
  141. });
  142. }).catch(err => {
  143. this.$refs.uToast.error(err.msg);
  144. })
  145. },
  146. submitWedData() {
  147. this.$axios.post('app/weddingFinanceConfirm/saveWeddingReceivable', {
  148. "operateDate": this.info.operateDate, //操作时间
  149. "payment": this.info.payment,
  150. "weddingOrderId": this.id,
  151. "isSupplement":1,
  152. "remark": this.info.remark
  153. }).then(res => {
  154. this.$refs.uToast.success('婚庆订单确认补账成功!');
  155. uni.navigateBack({
  156. delta: 1
  157. });
  158. }).catch(err => {
  159. this.$refs.uToast.error(err.msg);
  160. })
  161. },
  162. choosewantDate() {
  163. this.$refs.operateDate.show();
  164. },
  165. onConfirmWantDate(e) {
  166. this.$set(this.info, 'operateDate', e.value)
  167. },
  168. onCancel() {
  169. console.log(this.$refs.date.value, this.$refs.date.pickVal)
  170. },
  171. },
  172. }
  173. </script>
  174. <style scoped lang="scss">
  175. .textarea {
  176. font-size: 28rpx;
  177. min-height: 180rpx;
  178. padding-bottom: 20rpx;
  179. width: 100%;
  180. }
  181. .common_btn {
  182. margin: 0 auto;
  183. width: 690rpx;
  184. line-height: 88rpx;
  185. background: #2481EE;
  186. border-radius: 6rpx;
  187. margin-top: 50rpx;
  188. color: white;
  189. font-size: 32rpx;
  190. text-align: center;
  191. }
  192. </style>