123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- <template>
- <div class="detail">
- <mt-header class="detail_head" fixed title="我的资产">
- <router-link to="" slot="left">
- <mt-button icon="back" v-on:click="jumpBack()"></mt-button>
- </router-link>
- </mt-header>
- <div class="detail_body">
- <div class="noList" v-if="list.length==0">
- <img src="../../assets/image/noList.png">
- </div>
- <ul v-else class="recordBox">
- <li v-for="(item,num) in list" class="one_recordBox detailBox">
- <div class="record_head">
- <img v-if="item.pic != null" v-lazy="item.pic">
- <img v-else src="../../assets/image/noPic.png">
- </div>
- <div class="record_body">
- <div>{{item.name}}</div>
- <div>{{item.modelNumber}}</div>
- <div :id="'tab' + item.id">
- <div :class="item.isShow">
- {{item.tag}}
- <!-- <span v-for="(tag,index) in item.goodsNos">{{tag.modelNo}}<span v-if="index < (item.goodsNos.length -1)">、</span></span> -->
- </div>
- <div v-if="item.goodsNos.length > 2" class="click-show" v-on:click="changeType('tab' + item.id, num)">{{item.isShow == 'text-hide'?'展开':'收缩'}}</div>
- </div>
- </div>
- </li>
- <div class="order" v-if="haveMore">
- <span class="line"></span>
- <span class="txt">没有更多了</span>
- <span class="line"></span>
- </div>
- </ul>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- user: JSON.parse(sessionStorage.getItem("user")),
- list: [],
- pageNum: 1,
- pages: 1,
- haveMore: false,
- }
- },
- methods: {
- // 消息列表
- getList() {
- this.$indicator.open();
- this.http.post(this.port.my.list, {
- 'uid': this.user.id,
- 'pageNum': 1
- } ,
- res => {
- this.$indicator.close();
- if (res.code == "ok") {
- var list = res.data.list;
- for(var i in list) {
- var tag = list[i].goodsNos , str = "";
- for(var j in tag) {
- str += tag[j].modelNo + "、";
- }
- str = str.substring(0,str.length-1);
- list[i].tag = str;
- list[i].isShow = 'text-hide';
- }
- this.list = list;
- this.pages = res.data.pages==0?1:res.data.pages;
- } else {
- this.$toast({
- message: res.msg,
- duration: 2000
- });
- }
- }, error => {
- this.$indicator.close();
- this.$toast({
- message: error,
- duration: 2000
- });
- })
- },
- loadMore() {
- if(this.pageNum == this.pages) {
- this.haveMore = true;
- } else if(this.pageNum < this.pages) {
- this.$indicator.open();
- this.http.post(this.port.my.list, {
- 'uid': this.user.id,
- 'pageNum': ++this.pageNum
- } ,
- res => {
- this.$indicator.close();
- if (res.code == "ok") {
- this.pages = res.data.pages==0?1:res.data.pages;
- if(res.data.list.length != 0) {
- for(var i in res.data.list) {
- this.list.push(res.data.list[i]);
- }
- }
- } else {
- this.$toast({
- message: res.msg,
- duration: 2000
- });
- }
- }, error => {
- this.$indicator.close();
- this.$toast({
- message: error,
- duration: 2000
- });
- })
- }
- },
- changeType(id,num) {
- if(this.list[num].isShow == "text-hide") {
- this.list[num].isShow = "text-show";
- } else {
- this.list[num].isShow = "text-hide";
- }
- },
- jumpBack() {
- this.$router.go(-1);
- }
- },
- created() {
- this.getList();
- },
- mounted() {
-
- }
- }
- </script>
- <style scoped>
- body {
- background: #EFEFEF;
- }
- .detail {
- background: #EFEFEF;
- }
- .detail_head {
- background: #fff;
- color: #333;
- height: 0.4rem;
- }
- .detail_body {
- margin-top: 0.4rem;
- padding-bottom: 0.15rem;
- }
- .tab_head {
- position: fixed;
- width: 100%;
- top: 0.4rem;
- z-index: 110;
- }
- .detailBox {
- background: #fff;
- margin-bottom: 0.11rem;
- }
- .recordBox {
- margin: 0.12rem 0 0 0;
- }
- .one_recordBox {
- padding: 0.12rem 0.2rem;
- }
- .record_head {
- float: left;
- color: #5FA1F0;
- margin-right: 0.12rem;
- }
- .record_head img {
- width: 0.6rem;
- height: 0.6rem;
- }
- .record_head > div {
- width: 100%;
- display: inline-block;
- vertical-align: middle;
- }
- .record_head span {
- color: #939393;
- float: right;
- vertical-align: middle;
- }
- .record_body {
- color: #777;
- font-size: 0.12rem;
- line-height: 0.23rem;
- }
- .record_body > div:nth-child(1) {
- font-size: 0.15rem;
- font-weight: 600;
- color: #333;
- }
- .record_body > div:nth-child(3) .text-hide {
- padding: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .record_body > div:nth-child(3) .text-show {
- overflow: auto;
- text-overflow: unset;
- white-space: unset;
- word-break: break-all;
- }
- .record_body > div:nth-child(3) .click-show{
- margin-left: 5px;
- font-size: 14px;
- color: #26a2ff;
- text-align: right;
- }
- .noList {
- text-align: center;
- padding: 1.5rem 0;
- }
- .noList img {
- width: 1.2rem;
- height: 1.2rem;
- }
- .order {
- height: 0.6rem;
- line-height: 0.6rem;
- text-align: center;
- }
- .order .line {
- display: inline-block;
- width: 1.2rem;
- border-top: 1px solid #ccc ;
- vertical-align: middle;
- }
- .order .txt {
- color: #ccc;
- font-size: 0.13rem;
- vertical-align: middle;
- }
- </style>
|