123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- <template>
- <mobile-frame>
- <view class="main">
- <view class="one">
- <view class="one_1">
- <view class="text1">{{info.goods.name}}{{info.specs[0].name}}</view>
- <view class="text2">好评率 <text>{{info.rate||100}}%</text></view>
- </view>
- <view class="one_2">
- <view class="one_2_1" v-for="(item,index) in btnlist" :key="index">
- <text>{{item.name}}</text><text>({{item.num||0}})</text>
- </view>
- </view>
- </view>
- <view class="two">
- <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
- <view class="list-scroll-view">
- <view class="list" v-for="(item, index) in list" :key="index">
- <image v-if="item.file&&item.file.length>0" class="image"
- :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
- </image>
- <text v-else class="iconfont icon-top"></text>
- <view class="list_1">
- <view class="other">
- <text>{{item.phone}}</text>
- <text>{{item.time}}</text>
- </view>
- <view class="stars">
- <uni-rate size="18" :readonly="true" :value="5" />
- </view>
- <view class="other1">{{item.content}}</view>
- <view class="other2">规格:{{item.specs}}</view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </mobile-frame>
- </template>
- <script>
- export default {
- data() {
- return {
- id: '',
- user: {},
- btnlist: [{
- name: '全部好评',
- num: '10',
- code: '0'
- },
- {
- name: '好评',
- num: '10',
- code: '0'
- },
- {
- name: '中评',
- num: '0',
- code: '0'
- },
- {
- name: '差评',
- num: '0',
- code: '0'
- }
- ],
- info: {},
- list: [{
- phone: '150********',
- content: '好评!',
- specs: '标准',
- time: '2022-10-04 06:35:10'
- },
- {
- phone: '132********',
- content: '好评!',
- specs: '标准',
- time: '2022-10-06 16:09:20'
- },
- {
- phone: '188********',
- content: '好评!',
- specs: '标准',
- time: '2022-10-07 16:15:08'
- },
- {
- phone: '137********',
- content: '好评!',
- specs: '标准',
- time: '2022-10-07 14:26:10'
- }
- ],
- total: 0,
- skip: 0,
- limit: 6,
- page: 0
- };
- },
- onLoad: function(e) {
- const that = this;
- that.$set(that, `id`, e.id || '');
- that.watchLogin()
- },
- methods: {
- // 监听用户是否登录
- watchLogin() {
- const that = this;
- uni.getStorage({
- key: 'token',
- success: function(res) {
- let user = that.$jwt(res.data);
- that.$set(that, `user`, user);
- that.search()
- },
- fail: function(err) {
- uni.reLaunch({
- url: `/pages/login/index`
- })
- }
- })
- },
- // 查询列表
- async search() {
- const that = this;
- let user = that.user;
- let res = await that.$api(`/viewGoods/goodsDetail`, `POST`, {
- id: that.id
- });
- if (res.errcode == '0') {
- that.$set(that, `info`, res.data)
- }
- },
- // 分页
- toPage(e) {
- const that = this;
- let list = that.list;
- let limit = that.limit;
- if (that.total > list.length) {
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- let page = that.page + 1;
- that.$set(that, `page`, page)
- let skip = page * limit;
- that.$set(that, `skip`, skip)
- that.search();
- uni.hideLoading();
- } else uni.showToast({
- title: '没有更多数据了'
- });
- },
- // 清空列表
- clearPage() {
- const that = this;
- that.$set(that, `list`, [])
- that.$set(that, `skip`, 0)
- that.$set(that, `limit`, 6)
- that.$set(that, `page`, 0)
- }
- }
- }
- </script>
- <style lang="scss">
- .main {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 100vh;
- background-color: var(--f1Color);
- .one {
- margin: 0 0 2vw 0;
- .one_1 {
- display: flex;
- justify-content: space-around;
- background-color: var(--mainColor);
- margin: 0 0 0.5vw 0;
- padding: 2vw;
- .text1 {
- width: 65vw;
- font-size: var(--font16Szie);
- }
- .text2 {
- font-size: var(--font16Szie);
- color: var(--f85Color);
- text {
- margin: 0 0 0 1vw;
- color: var(--ff0Color);
- }
- }
- }
- .one_2 {
- display: flex;
- justify-content: space-around;
- padding: 2vw;
- background-color: var(--mainColor);
- }
- }
- .two {
- position: relative;
- flex-grow: 1;
- .list {
- display: flex;
- justify-content: space-around;
- align-items: flex-start;
- background-color: var(--mainColor);
- margin: 0 0 2vw 0;
- padding: 4vw;
- .iconfont {
- font-size: 30px;
- }
- .list_1 {
- flex-grow: 1;
- margin: 0 0 0 2vw;
- font-size: var(--font14Size);
- .other {
- display: flex;
- justify-content: space-between;
- text:last-child {
- font-size: var(--font12Size);
- color: var(--f85Color);
- }
- }
- .other1 {
- margin: 1vw 0 0 0;
- }
- .other2 {
- font-size: var(--font12Size);
- color: var(--f85Color);
- margin: 2vw 0 0 0;
- }
- }
- }
- }
- }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-direction: column;
- }
- }
- </style>
|