studentOrder.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div class='studentOrder'>
  3. <div class="headWrap">
  4. <div class="left">
  5. <div class="headItem">
  6. <p>账户余额:<span>{{ dataInfo.balance }}</span></p>
  7. </div>
  8. <div class="headItem">
  9. <p v-if="amountStatus">课程余额:<span>{{ dataInfo.courseBalance }}</span></p>
  10. <p v-else>账户余额:<span>
  11. <el-input style="width: 130px;"
  12. v-model="dataInfo.courseBalance"
  13. placeholder="账户余额"></el-input>
  14. </span></p>
  15. <el-button v-if="amountStatus"
  16. @click="amountStatus = false"
  17. type="text">修改</el-button>
  18. <el-button style="top:0;"
  19. @click="onUpdateCourse"
  20. v-else
  21. type="text">保存</el-button>
  22. </div>
  23. <div class="headItem">
  24. <p>银行卡:<span>{{ dataInfo.cardNo }}</span></p>
  25. </div>
  26. <!-- <div class="headItem">
  27. <p>支付宝:<span>{{ dataInfo.zfb }}</span></p>
  28. </div>
  29. <div class="headItem">
  30. <p>微信:<span>{{ dataInfo.wxBalance }}</span></p>
  31. </div> -->
  32. </div>
  33. </div>
  34. <!-- 搜索类型 -->
  35. <el-form :inline="true"
  36. class="searchForm"
  37. v-model="searchForm">
  38. <el-form-item>
  39. <el-date-picker style="width: 400px;"
  40. v-model="orderDate"
  41. type="daterange"
  42. value-format="yyyy-MM-dd"
  43. @change="searchCourseDate"
  44. range-separator="至"
  45. start-placeholder="订单开始日期"
  46. end-placeholder="订单结束日期">
  47. </el-date-picker>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-select v-model="searchForm.paymentType"
  51. placeholder="交易类型">
  52. <el-option v-for="(item, index) in orderStatus"
  53. :key="index"
  54. :label="item.label"
  55. :value="item.value"></el-option>
  56. </el-select>
  57. </el-form-item>
  58. <el-form-item>
  59. <el-input type="text"
  60. v-model="searchForm.remark"
  61. placeholder="订单说明"></el-input>
  62. </el-form-item>
  63. <el-form-item>
  64. <el-button @click="search"
  65. type="danger">搜索</el-button>
  66. <el-button @click="onReSet"
  67. type="primary">重置</el-button>
  68. </el-form-item>
  69. </el-form>
  70. <div class="tableWrap">
  71. <el-table :data="tableList"
  72. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  73. <el-table-column label="订单日期"
  74. prop="createTime"
  75. width="180px">
  76. </el-table-column>
  77. <el-table-column label="交易类型"
  78. width="180px">
  79. <template slot-scope="scope">
  80. {{ scope.row.type | orderType }}
  81. </template>
  82. </el-table-column>
  83. <el-table-column width="180px"
  84. label="应付金额"
  85. prop="expectAmount">
  86. </el-table-column>
  87. <el-table-column width="180px"
  88. label="余额支付"
  89. prop="balancePaymentAmount">
  90. </el-table-column>
  91. <el-table-column width="180px"
  92. label="实际金额"
  93. prop="actualAmount">
  94. </el-table-column>
  95. <el-table-column label="订单说明"
  96. prop="memo">
  97. </el-table-column>
  98. </el-table>
  99. <pagination :total="pageInfo.total"
  100. :page.sync="pageInfo.page"
  101. :limit.sync="pageInfo.limit"
  102. :page-sizes="pageInfo.page_size"
  103. @pagination="getList" />
  104. </div>
  105. </div>
  106. </template>
  107. <script>
  108. import pagination from '@/components/Pagination/index'
  109. import { studentPaymentOrderList, getUserCashAccountBaseInfo, updateCourseBalance } from '@/api/studentManager'
  110. import { orderStatus } from '@/utils/searchArray'
  111. import store from '@/store'
  112. export default {
  113. components: { pagination },
  114. data () {
  115. return {
  116. organId: null,
  117. orderDate: null,
  118. searchForm: {
  119. studentId: this.$route.query.userId,
  120. orderStartDate: null,
  121. orderEndDate: null,
  122. paymentType: null,
  123. remark: null
  124. },
  125. orderStatus: orderStatus,
  126. pageInfo: {
  127. // 分页规则
  128. limit: 10, // 限制显示条数
  129. page: 1, // 当前页
  130. total: 0, // 总条数
  131. page_size: [10, 20, 40, 50] // 选择限制显示条数
  132. },
  133. tableList: [],
  134. dataInfo: {},
  135. amountStatus: true, // 账户余额状态
  136. }
  137. },
  138. mounted () {
  139. this.getList()
  140. this.__init()
  141. },
  142. methods: {
  143. __init () {
  144. getUserCashAccountBaseInfo({ userId: this.$route.query.userId }).then(res => {
  145. if (res.code == 200) {
  146. this.dataInfo = {
  147. balance: res.data.balance,
  148. courseBalance: res.data.courseBalance,
  149. wxBalance: 0,
  150. cardNo: res.data.cardNo,
  151. zfb: null
  152. }
  153. }
  154. })
  155. },
  156. onUpdateCourse () {
  157. if (!this.dataInfo.courseBalance) {
  158. this.$message.error('请输入课程余额')
  159. return
  160. }
  161. updateCourseBalance({
  162. userId: this.searchForm.studentId,
  163. decimal: this.dataInfo.courseBalance
  164. }).then(res => {
  165. let result = res.data
  166. if (res.code == 200) {
  167. this.$message.success('保存成功')
  168. this.amountStatus = true
  169. this.__init()
  170. } else {
  171. this.$message.error(res.msg)
  172. }
  173. })
  174. },
  175. search () {
  176. this.pageInfo.page = 1;
  177. this.getList();
  178. },
  179. getList () {
  180. let params = this.searchForm
  181. params.rows = this.pageInfo.limit
  182. params.page = this.pageInfo.page
  183. if (params.remark == '' || !params.remark) {
  184. params.remark = null
  185. }
  186. studentPaymentOrderList(params).then(res => {
  187. if (res.code == 200) {
  188. this.tableList = res.data.rows
  189. this.pageInfo.total = res.data.total
  190. }
  191. })
  192. },
  193. searchCourseDate (value) {
  194. if (value) {
  195. this.searchForm.orderStartDate = value[0]
  196. this.searchForm.orderEndDate = value[1]
  197. } else {
  198. this.searchForm.orderStartDate = null
  199. this.searchForm.orderEndDate = null
  200. }
  201. },
  202. onReSet () { // 重置搜索
  203. this.orderDate = null
  204. this.searchForm = {
  205. studentId: this.$route.query.userId,
  206. orderStartDate: null,
  207. orderEndDate: null,
  208. paymentType: null,
  209. remark: null
  210. }
  211. },
  212. }
  213. }
  214. </script>
  215. <style lang="scss" scoped>
  216. .headWrap .left .headItem {
  217. position: relative;
  218. /deep/.el-button {
  219. position: absolute;
  220. top: -3px;
  221. right: 20px;
  222. }
  223. }
  224. // .studentOrder {
  225. // }
  226. </style>