123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- <template>
- <div style="min-height: 100vh">
- <van-sticky>
- <m-header :backUrl="backUrl" :isFixed="false">
- <template slot="right">
- <div
- @click="
- () => {
- $router.push('/goodsOrder');
- }
- "
- >
- 商品订单
- </div>
- </template>
- </m-header>
- <search @onSearch="onSearch" placeholder="请输入姓名或手机号" />
- </van-sticky>
- <van-list
- v-model="loading"
- v-if="dataShow"
- :finished="finished"
- :immediate-check="false"
- finished-text="- 没有更多内容 -"
- @load="getStudent"
- >
- <van-radio-group v-model="radioSelect">
- <van-cell-group>
- <van-cell
- v-for="(item, index) in dataList"
- :key="index"
- @click="onSelect(item)"
- title-class="title-class"
- class="input-cell"
- :center="true"
- is-link
- >
- <template slot="icon">
- <img
- class="logo"
- v-if="item.headUrl"
- :src="item.headUrl"
- alt=""
- />
- <img
- class="logo"
- v-else
- src="@/assets/images/icon_students.png"
- alt=""
- />
- </template>
- <template slot="title">
- <div class="label">
- {{ item.name }}
- <span class="phone_section">
- {{ item.phone ? desensitPhone(item.phone) : null }}
- <a
- @click.stop="() => {}"
- v-if="type != 'sale'"
- style="height: 0.17rem"
- :href="'tel:' + item.phone"
- ><i class="icon_phone"></i
- ></a>
- </span>
- </div>
- </template>
-
- </van-cell>
- </van-cell-group>
- </van-radio-group>
- </van-list>
- <m-empty class="empty" v-else />
-
- </div>
- </template>
- <script>
- import MHeader from "@/components/header";
- import search from "@/components/Search";
- import MEmpty from "@/components/MEmpty";
- import { getStudentsByTeacherOrgan } from "./api";
- export default {
- name: "teacherList",
- components: {
- MHeader,
- search,
- MEmpty,
- },
- data() {
- let query = this.$route.query;
-
- localStorage.removeItem("repaireForm");
- return {
- type: query.type,
- radioSelect: null,
- radioSelectOrganId: null,
- loading: false,
- finished: false,
- params: {
- search: null,
- page: 1,
- rows: 20,
- },
- dataShow: true,
- dataList: [],
- backUrl: {
- status: true,
- path: "/home",
- },
- };
- },
- async mounted() {
- await this.getStudent();
- },
- methods: {
- onSelect(item) {
-
- this.$router.push({
- path: "/goodsSale",
- query: {
- studentId: item.userId,
- studentName: item.name,
- organId: item.organId,
- },
- });
-
-
- },
- onSubmit() {
- if (!this.radioSelect) {
- this.$toast("请选择学生");
- return;
- }
- localStorage.setItem("studentId", this.radioSelect);
- let studentName = null;
- this.dataList.forEach((item) => {
- if (item.userId == this.radioSelect) {
- studentName = item.name;
- }
- });
-
- this.$router.push({
- path: "/goodsSale",
- query: {
- studentId: this.radioSelect,
- studentName: studentName,
- organId: this.radioSelectOrganId,
- },
- });
- },
-
- onSearch(val) {
- this.params.search = val;
- this.params.page = 1;
- this.dataList = [];
- this.dataShow = true;
- this.loading = true;
- this.finished = false;
- this.getStudent();
- },
- async getStudent() {
- let params = this.params;
- params.search = params.search ? params.search : null;
- let studentList = null;
- try {
- studentList = await getStudentsByTeacherOrgan(params);
-
- let result = studentList.data;
- this.loading = false;
- if (studentList.code == 200) {
-
- if (this.dataList.length > 0 && result.pageNo == 1) {
- return;
- }
- params.page = result.pageNo;
- this.dataList = this.dataList.concat(result.rows);
- if (params.page >= result.totalPage) {
- this.finished = true;
- }
- this.params.page++;
- } else {
- this.finished = true;
- }
-
- if (this.dataList.length <= 0) {
- this.dataShow = false;
- }
- } catch {
-
- }
- },
- desensitPhone(phone) {
-
- let first = phone.substr(0, 3);
- let last = phone.substr(-4);
- return first + "****" + last;
- },
- },
- };
- </script>
- <style lang="less" scoped>
- @import url("../../assets/commonLess/variable.less");
- /deep/.van-cell__title {
- font-size: 0.14rem;
- color: @mFontColor;
- flex: 1 auto;
- }
- .logo {
- width: 0.42rem;
- height: 0.42rem;
- margin-right: 0.12rem;
- border-radius: 100%;
- }
- .input-cell {
- padding: 0.12rem 0.16rem 0.2rem;
- .van-radio {
- justify-content: flex-end;
- }
- }
- /deep/.van-cell__value {
- height: 0.24rem;
- }
- /deep/.van-radio__icon .van-icon {
- border-color: @sFontColor;
- }
- /deep/.van-radio__icon--checked {
- .van-icon {
- border-color: @orangeColor;
- background: @orangeColor;
- }
- }
- .van-tag {
- margin-left: 0.08rem;
- }
- .button-group {
- margin: 0.3rem 0.26rem 0.2rem;
- .van-button--primary {
- background: @mColor;
- border: 1px solid @mColor;
- font-size: 0.18rem;
- }
- }
- .phone_section {
- display: flex;
- align-items: center;
- font-size: 0.14rem;
- color: #999;
- }
- .icon_phone {
- margin-left: 0.1rem;
- width: 0.14rem;
- height: 0.17rem;
- display: inline-block;
- background: url("../../assets/images/icon_phone.png") no-repeat center center;
- background-size: contain;
- }
- .title-class {
- display: flex;
- align-items: center;
- .label {
- display: flex;
- flex-direction: column;
- font-size: 0.16rem;
- color: #1a1a1a;
- }
- }
- </style>
|