home.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <div class="page">
  3. <el-page-header
  4. @back="$router.go(-1)"
  5. :content="curTeamTel"
  6. style="margin-bottom: 20px"
  7. v-if="!isOuter"
  8. ></el-page-header>
  9. <el-header height="40px" style="display: flex; align-items: center">
  10. <el-button
  11. type="primary"
  12. size="normal"
  13. @click="createQr"
  14. plain
  15. v-if="isOuter"
  16. >经销商邀请二维码</el-button
  17. >
  18. <div class="search">
  19. <el-input
  20. placeholder="请输入内容"
  21. v-model.trim="teamValue"
  22. @keyup.enter.native="teamSearch"
  23. >
  24. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  25. </el-input>
  26. </div>
  27. </el-header>
  28. <el-container class="course_data">
  29. <el-table :data="dealerInfo" border stripe highlight-current-row>
  30. <el-table-column prop="name" label="用户名" align="center">
  31. </el-table-column>
  32. <el-table-column label="微信ID" align="center" min-width="100px">
  33. <template slot-scope="scope"> {{ scope.row.unionid }} </template>
  34. </el-table-column>
  35. <el-table-column label="手机号" align="center">
  36. <template slot-scope="scope"> {{ scope.row.mobile }} </template>
  37. </el-table-column>
  38. <el-table-column
  39. label="TA的团队"
  40. align="center"
  41. style="color: #409eff"
  42. class="outTeam"
  43. v-if="isOuter"
  44. >
  45. <template slot-scope="scope">
  46. <span
  47. @click="toDealerTeam(scope.row)"
  48. style="color: #409eff; cursor: pointer"
  49. >{{ scope.row.statistics.teamAmount }}</span
  50. >
  51. </template>
  52. </el-table-column>
  53. <el-table-column fixed="right" label="操作" width="250" align="center">
  54. <template slot-scope="scope">
  55. <el-button
  56. type="text"
  57. size="mini"
  58. @click="infoEdit(scope.row, scope.$index)"
  59. >修改信息</el-button
  60. >
  61. <el-button
  62. size="mini"
  63. type="text"
  64. @click="dealerPay(scope.row, scope.$index)"
  65. >课程名额修改</el-button
  66. >
  67. </template>
  68. </el-table-column>
  69. </el-table>
  70. <div class="proness">
  71. <el-pagination
  72. background
  73. layout="prev, pager, next"
  74. @current-change="curPageChange()"
  75. :current-page.sync="page.cur"
  76. :page-size="page.size"
  77. :total="page.total"
  78. :hide-on-single-page="false"
  79. >
  80. </el-pagination>
  81. </div>
  82. </el-container>
  83. <el-dialog
  84. title="用户信息修改"
  85. :visible.sync="eldiForm"
  86. width="40%"
  87. :close-on-click-modal="false"
  88. :close-on-press-escape="false"
  89. center
  90. @close="cancleDi"
  91. >
  92. <el-form
  93. :model="dealerForm"
  94. ref="form"
  95. label-width="100px"
  96. :inline="false"
  97. size="normal"
  98. >
  99. <el-form-item label="用户名">
  100. <el-input v-model="dealerForm.name"></el-input>
  101. </el-form-item>
  102. <el-form-item label="绑定微信ID">
  103. <el-input v-model="dealerForm.unionid"></el-input>
  104. </el-form-item>
  105. <el-form-item label="手机号">
  106. <el-input v-model="dealerForm.mobile"></el-input>
  107. </el-form-item>
  108. </el-form>
  109. <span slot="footer">
  110. <el-button @click="cancleDi">取消</el-button>
  111. <el-button type="primary" @click="confirmSave">保存</el-button>
  112. </span>
  113. </el-dialog>
  114. </div>
  115. </template>
  116. <script>
  117. import { getDealerList } from "../api";
  118. export default {
  119. name: "dealerManage",
  120. components: {},
  121. props: [],
  122. data() {
  123. return {
  124. eldiForm: false,
  125. dealerForm: {
  126. id: 0,
  127. name: "",
  128. unionid: "",
  129. mobile: "",
  130. },
  131. curTeamTel: "",
  132. isOuter: false,
  133. page: {
  134. total: 0,
  135. size: 10,
  136. cur: 1,
  137. },
  138. teamValue: "",
  139. dealerInfo: [
  140. {
  141. id: 123455,
  142. name: "燕小六",
  143. unionid: "wx1525155255",
  144. mobile: "15699847711",
  145. statistics: {
  146. saleAmount: 15000,
  147. teamAmount: 11,
  148. },
  149. },
  150. ],
  151. };
  152. },
  153. watch: {
  154. // $route: function (to, from) {
  155. // if(to.path == '/course/dealerManage'){
  156. // this.init();
  157. // }
  158. // },
  159. },
  160. created() {
  161. this.init();
  162. },
  163. methods: {
  164. //获取经销商列表
  165. getDealerMap(type, pid) {
  166. console.log(123)
  167. let data = {
  168. page: this.page.cur,
  169. pageSize: this.page.size,
  170. marketable: type,
  171. };
  172. if (pid != undefined) {
  173. data.pid = pid;
  174. }
  175. console.log(data);
  176. getDealerList(data).then((res) => {
  177. // console.log(res);
  178. this.dealerInfo = res.list;
  179. this.page.cur = res.page;
  180. this.page.size = res.size;
  181. this.page.total = res.total;
  182. });
  183. },
  184. // 修改经销商信息
  185. confirmSave() {
  186. this.$confirm("确定要修改经销商信息吗?", "提示", {
  187. confirmButtonText: "确认",
  188. cancelButtonText: "取消",
  189. type: "info",
  190. })
  191. .then((action) => {
  192. this.$message({
  193. message: "交易成功!",
  194. type: "success",
  195. showClose: true,
  196. duration: 1500,
  197. });
  198. this.cancleDi();
  199. })
  200. .catch(() => {
  201. this.cancleDi();
  202. });
  203. },
  204. // 取消修改并重置表单
  205. cancleDi() {
  206. let form = {
  207. id: 0,
  208. name: "",
  209. unionid: "",
  210. mobile: "",
  211. };
  212. this.dealerForm = form;
  213. this.eldiForm = false;
  214. },
  215. // 初始化
  216. init() {
  217. console.log(this.$route.params.id)
  218. // if (this.$route.params.id) {
  219. // console.log(1111)
  220. // this.isOuter = false;
  221. // this.curTeamTel = `${this.$route.query.tel}的团队`;
  222. // this.getDealerMap(1, this.$route.params.id);
  223. // } else {
  224. // console.log(2222)
  225. // this.isOuter = true;
  226. // this.getDealerMap(1);
  227. // }
  228. console.log(2222)
  229. this.isOuter = true;
  230. this.getDealerMap(1);
  231. },
  232. // 跳转到我的团队
  233. toDealerTeam(row) {
  234. console.log(row);
  235. if (row.statistics.teamAmount != 0) {
  236. this.$router.push({
  237. path: `/course/dealerTeam/${row.id}?tel=${row.tel}`,
  238. params: {
  239. tel: row.tel,
  240. },
  241. });
  242. }else{
  243. this.$message({
  244. message: '您还没有团队',
  245. type: 'warning',
  246. showClose: true,
  247. duration: 3000,
  248. });
  249. }
  250. },
  251. // 搜索
  252. teamSearch() {
  253. if (this.teamValue) {
  254. console.log(this.teamValue);
  255. }
  256. },
  257. // 创建二维码
  258. createQr() {},
  259. // 切换当前页
  260. curPageChange() {
  261. console.log(this.page);
  262. },
  263. // 打开弹窗修改个人信息
  264. infoEdit(row) {
  265. this.dealerForm = JSON.parse(JSON.stringify(row));
  266. this.eldiForm = true;
  267. console.log(row);
  268. },
  269. // 跳转查看交易详情
  270. dealerPay(row) {
  271. console.log(row);
  272. this.$router.push(`/course/dealerEdit/${row.id}?name=${row.name}`);
  273. },
  274. },
  275. computed: {},
  276. };
  277. </script>
  278. <style scoped lang="scss">
  279. .page {
  280. padding: 15px;
  281. background-color: #fff;
  282. border-radius: 5px;
  283. .search {
  284. margin-left: 15px;
  285. }
  286. .course_data {
  287. margin-top: 25px;
  288. display: block;
  289. .proness {
  290. margin-top: 20px;
  291. display: flex;
  292. justify-content: center;
  293. }
  294. }
  295. }
  296. </style>