myAssets.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <div class="detail">
  3. <mt-header class="detail_head" fixed title="我的资产">
  4. <router-link to="" slot="left">
  5. <mt-button icon="back" v-on:click="jumpBack()"></mt-button>
  6. </router-link>
  7. </mt-header>
  8. <div class="detail_body">
  9. <div class="noList" v-if="list.length==0">
  10. <img src="../../assets/image/noList.png">
  11. </div>
  12. <ul v-else class="recordBox">
  13. <li v-for="(item,num) in list" class="one_recordBox detailBox">
  14. <div class="record_head">
  15. <img v-if="item.pic != null" v-lazy="item.pic">
  16. <img v-else src="../../assets/image/noPic.png">
  17. </div>
  18. <div class="record_body">
  19. <div>{{item.name}}</div>
  20. <div>{{item.modelNumber}}</div>
  21. <div :id="'tab' + item.id">
  22. <div :class="item.isShow">
  23. {{item.tag}}
  24. <!-- <span v-for="(tag,index) in item.goodsNos">{{tag.modelNo}}<span v-if="index < (item.goodsNos.length -1)">、</span></span> -->
  25. </div>
  26. <div v-if="item.goodsNos.length > 2" class="click-show" v-on:click="changeType('tab' + item.id, num)">{{item.isShow == 'text-hide'?'展开':'收缩'}}</div>
  27. </div>
  28. </div>
  29. </li>
  30. <div class="order" v-if="haveMore">
  31. <span class="line"></span>
  32. <span class="txt">没有更多了</span>
  33. <span class="line"></span>
  34. </div>
  35. </ul>
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. user: JSON.parse(sessionStorage.getItem("user")),
  44. list: [],
  45. pageNum: 1,
  46. pages: 1,
  47. haveMore: false,
  48. }
  49. },
  50. methods: {
  51. // 消息列表
  52. getList() {
  53. this.$indicator.open();
  54. this.http.post(this.port.my.list, {
  55. 'uid': this.user.id,
  56. 'pageNum': 1
  57. } ,
  58. res => {
  59. this.$indicator.close();
  60. if (res.code == "ok") {
  61. var list = res.data.list;
  62. for(var i in list) {
  63. var tag = list[i].goodsNos , str = "";
  64. for(var j in tag) {
  65. str += tag[j].modelNo + "、";
  66. }
  67. str = str.substring(0,str.length-1);
  68. list[i].tag = str;
  69. list[i].isShow = 'text-hide';
  70. }
  71. this.list = list;
  72. this.pages = res.data.pages==0?1:res.data.pages;
  73. } else {
  74. this.$toast({
  75. message: res.msg,
  76. duration: 2000
  77. });
  78. }
  79. }, error => {
  80. this.$indicator.close();
  81. this.$toast({
  82. message: error,
  83. duration: 2000
  84. });
  85. })
  86. },
  87. loadMore() {
  88. if(this.pageNum == this.pages) {
  89. this.haveMore = true;
  90. } else if(this.pageNum < this.pages) {
  91. this.$indicator.open();
  92. this.http.post(this.port.my.list, {
  93. 'uid': this.user.id,
  94. 'pageNum': ++this.pageNum
  95. } ,
  96. res => {
  97. this.$indicator.close();
  98. if (res.code == "ok") {
  99. this.pages = res.data.pages==0?1:res.data.pages;
  100. if(res.data.list.length != 0) {
  101. for(var i in res.data.list) {
  102. this.list.push(res.data.list[i]);
  103. }
  104. }
  105. } else {
  106. this.$toast({
  107. message: res.msg,
  108. duration: 2000
  109. });
  110. }
  111. }, error => {
  112. this.$indicator.close();
  113. this.$toast({
  114. message: error,
  115. duration: 2000
  116. });
  117. })
  118. }
  119. },
  120. changeType(id,num) {
  121. if(this.list[num].isShow == "text-hide") {
  122. this.list[num].isShow = "text-show";
  123. } else {
  124. this.list[num].isShow = "text-hide";
  125. }
  126. },
  127. jumpBack() {
  128. this.$router.go(-1);
  129. }
  130. },
  131. created() {
  132. this.getList();
  133. },
  134. mounted() {
  135. }
  136. }
  137. </script>
  138. <style scoped>
  139. body {
  140. background: #EFEFEF;
  141. }
  142. .detail {
  143. background: #EFEFEF;
  144. }
  145. .detail_head {
  146. background: #fff;
  147. color: #333;
  148. height: 0.4rem;
  149. }
  150. .detail_body {
  151. margin-top: 0.4rem;
  152. padding-bottom: 0.15rem;
  153. }
  154. .tab_head {
  155. position: fixed;
  156. width: 100%;
  157. top: 0.4rem;
  158. z-index: 110;
  159. }
  160. .detailBox {
  161. background: #fff;
  162. margin-bottom: 0.11rem;
  163. }
  164. .recordBox {
  165. margin: 0.12rem 0 0 0;
  166. }
  167. .one_recordBox {
  168. padding: 0.12rem 0.2rem;
  169. }
  170. .record_head {
  171. float: left;
  172. color: #5FA1F0;
  173. margin-right: 0.12rem;
  174. }
  175. .record_head img {
  176. width: 0.6rem;
  177. height: 0.6rem;
  178. }
  179. .record_head > div {
  180. width: 100%;
  181. display: inline-block;
  182. vertical-align: middle;
  183. }
  184. .record_head span {
  185. color: #939393;
  186. float: right;
  187. vertical-align: middle;
  188. }
  189. .record_body {
  190. color: #777;
  191. font-size: 0.12rem;
  192. line-height: 0.23rem;
  193. }
  194. .record_body > div:nth-child(1) {
  195. font-size: 0.15rem;
  196. font-weight: 600;
  197. color: #333;
  198. }
  199. .record_body > div:nth-child(3) .text-hide {
  200. padding: 0;
  201. overflow: hidden;
  202. text-overflow: ellipsis;
  203. white-space: nowrap;
  204. }
  205. .record_body > div:nth-child(3) .text-show {
  206. overflow: auto;
  207. text-overflow: unset;
  208. white-space: unset;
  209. word-break: break-all;
  210. }
  211. .record_body > div:nth-child(3) .click-show{
  212. margin-left: 5px;
  213. font-size: 14px;
  214. color: #26a2ff;
  215. text-align: right;
  216. }
  217. .noList {
  218. text-align: center;
  219. padding: 1.5rem 0;
  220. }
  221. .noList img {
  222. width: 1.2rem;
  223. height: 1.2rem;
  224. }
  225. .order {
  226. height: 0.6rem;
  227. line-height: 0.6rem;
  228. text-align: center;
  229. }
  230. .order .line {
  231. display: inline-block;
  232. width: 1.2rem;
  233. border-top: 1px solid #ccc ;
  234. vertical-align: middle;
  235. }
  236. .order .txt {
  237. color: #ccc;
  238. font-size: 0.13rem;
  239. vertical-align: middle;
  240. }
  241. </style>