index.vue 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div class="subPage">
  3. <div class="list flex-h">
  4. <div class="flex-item">
  5. <div class="flex-h" style="margin: 20px 0 0;border:none;">
  6. <div class="flex-item">
  7. <div class="userInfo">
  8. <span>用户名:</span>
  9. <b>{{customerName}}</b>
  10. <span>手机号:</span>
  11. <b>{{phone}}</b>
  12. </div>
  13. </div>
  14. <el-button
  15. size="mini"
  16. type="warning"
  17. @click="reback">返回</el-button>
  18. </div>
  19. <div v-if="(courses.list||[]).length>0">
  20. <el-table
  21. :data="courses.list"
  22. stripe
  23. style="width: 100%">
  24. <el-table-column
  25. prop="CaseName"
  26. label="所在案场">
  27. </el-table-column>
  28. <el-table-column
  29. prop="LocationName"
  30. label="课程分类">
  31. </el-table-column>
  32. <el-table-column
  33. prop="CourseName"
  34. label="课程名称">
  35. </el-table-column>
  36. <el-table-column
  37. prop="DetailName"
  38. label="课时名称">
  39. </el-table-column>
  40. <el-table-column
  41. prop="StartDate"
  42. label="课程开始时间">
  43. <template slot-scope="scope">
  44. <span>{{toolClass.dateFormat(scope.row.StartDate)}}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column
  48. prop="EndDate"
  49. label="课程结束时间">
  50. <template slot-scope="scope">
  51. <span>{{toolClass.dateFormat(scope.row.EndDate)}}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column
  55. label="操作">
  56. <template slot-scope="scope">
  57. <el-button
  58. size="mini"
  59. type="success"
  60. v-if="scope.row.VerifyStatus!=='used'"
  61. @click="check(scope.row)">核销</el-button>
  62. <span v-else>已完成</span>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <el-pagination
  67. @current-change="handleCurrentChange"
  68. :current-page.sync="courses.page"
  69. :page-size="courses.pagesize"
  70. layout="prev, pager, next, jumper"
  71. :total="courses.pagenum">
  72. </el-pagination>
  73. </div>
  74. <span class="noData" v-else>今日暂无可核销的课程</span>
  75. </div>
  76. </div>
  77. </div>
  78. </template>
  79. <script>
  80. import { createNamespacedHelpers } from 'vuex'
  81. const { mapState: mapVerifState, mapActions: mapVerifActions } = createNamespacedHelpers('verification')
  82. export default {
  83. name: '',
  84. data () {
  85. return {
  86. customerName: '',
  87. phone: this.$route.query.tel,
  88. code: '',
  89. tel: '',
  90. page: 1,
  91. pagesize: 10,
  92. }
  93. },
  94. mounted () {
  95. this.$nextTick(function () {
  96. this.getCustomerName({
  97. id: this.phone
  98. }).then((res) => {
  99. console.log(res)
  100. const { code, tel } = this.$route.query
  101. this.code = code
  102. this.tel = tel
  103. this.getList()
  104. })
  105. })
  106. },
  107. computed: {
  108. ...mapVerifState({
  109. courses: x => x.courseVerifs
  110. })
  111. },
  112. methods: {
  113. ...mapVerifActions([
  114. 'GetCourseVerList',
  115. 'CourseVerifs',
  116. 'GetCourseVerListByTel',
  117. 'getCustomerName'
  118. ]),
  119. check (item) { // 核销
  120. this.$confirm('确认核销此课程?', '提示', {
  121. confirmButtonText: '确定',
  122. cancelButtonText: '取消',
  123. type: 'warning'
  124. })
  125. .then(() => {
  126. this.CourseVerifs({id: item.CustomerDetailId, callback: this.afterCheck})
  127. })
  128. },
  129. getList () {
  130. if (this.code && this.code !== '') {
  131. this.GetCourseVerList({id: this.code, page: this.page, pagesize: this.pagesize})
  132. } else {
  133. if (this.tel && this.tel !== '') {
  134. this.GetCourseVerListByTel({tel: this.tel, page: this.page, pagesize: this.pagesize})
  135. }
  136. }
  137. },
  138. handleCurrentChange (val) { // 跳转到分页
  139. this.page = val
  140. this.getList()
  141. },
  142. afterCheck () {
  143. this.$message({
  144. type: 'success',
  145. message: '操作成功!'
  146. })
  147. this.getList()
  148. },
  149. reback () { // 返回
  150. this.$router.push({name: 'phoneVerification'})
  151. },
  152. }
  153. }
  154. </script>
  155. <!-- Add "scoped" attribute to limit CSS to this component only -->
  156. <style lang="scss" scoped>
  157. .subPage {
  158. .userInfo{
  159. white-space: nowrap;
  160. font-size: 0;
  161. >*{
  162. display: inline-block;
  163. margin-right: 10px;
  164. }
  165. >b{
  166. font-weight: bolder;
  167. font-size: 15px;
  168. margin-right: 30px;
  169. }
  170. }
  171. .list {
  172. > div {
  173. margin: 0 20px;
  174. > div {
  175. width: 100%;
  176. position: relative;
  177. overflow: hidden;
  178. box-sizing: border-box;
  179. border: 1px solid #eee;
  180. border-bottom: none;
  181. margin-top: 20px;
  182. }
  183. }
  184. }
  185. .noData{
  186. width: 100%;
  187. display: block;
  188. line-height: 40px;
  189. font-size: 30px;
  190. color: #ccc;
  191. text-align: center;
  192. margin: 40px auto 0;
  193. }
  194. }
  195. </style>