123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
- <seller-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
- <view class="div common-header-wrap">
- <view class="status-holder"></view>
- <view :style="'height:'+navHeight+'px'"></view>
- <view class="common-header-holder"></view>
- <view class="common-header-fixed">
- <title-header />
- <uni-nav-bar title="商品咨询" class="common-header" left-icon="back" @clickLeft="goBack()">
- </uni-nav-bar>
- </view>
- </view>
- <view class="scroll-view div" style="position:relative">
- <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div" @scrolltolower="loadMore" scroll-y="true">
- <view class="div" v-if="consult_list && consult_list.length">
- <view class="div consult-item" v-for="(item, index) in consult_list" :key="index">
- <view class="head">
- <view class="type">{{consult_type[item.consulttype_id].consulttype_name}}</view>
- <view class="time">{{ $moment.unix(item.consult_addtime).format('YYYY年MM月DD日') }}</view>
- </view>
- <view class="goods_info" @click="goGoods(item.goods_id)">
- <view class="image-wrapper" :style="'width:'+windowWidth+'px;height:'+windowWidth+'px;flex:0 0 ' + windowWidth + 'px'">
- <image mode="aspectFit" class="img" :src="item.goods_image"/>
- </view>
- <view class="p-info">
- <view class="goods_name">{{item.goods_name}}</view>
- <view class="goods_price">¥{{item.goods_price}}</view>
- </view>
- </view>
- <view class="div consult-info">
- <view class="consult_content"><text>咨询内容:</text>{{item.consult_content}}</view>
- <view class="consult_reply" v-if="item.consult_reply"><text>商家回复:</text>{{item.consult_reply}}</view>
- </view>
- <view class="ds-button-large div common-btn mb-10" @click="replay(item.consult_id)" v-if="!item.consult_reply">立即回复</view>
- </view>
- </view>
- <empty-record v-else-if="consult_list && !consult_list.length"></empty-record>
- </scroll-view>
- </view>
- </view>
- <uni-popup background-color="#fff" ref="confirm" type="dialog">
- <uni-popup-dialog :mode="dialog.mode" :title="dialog.title" :content="dialog.content" :placeholder="dialog.content" @confirm="confirmDialog" @close="closeDialog"></uni-popup-dialog>
- </uni-popup>
- </seller-base>
- </template>
- <script>
- import {getFontSize} from '@/util/common'
- import TitleHeader from '../../TitleHeader'
- import SellerBase from '../SellerBase'
- import EmptyRecord from '../../EmptyRecord'
- import { getConsultList, replyConsult } from '../../../api/sellerConsult'
- export default {
- data(){
- return {
- navHeight: 0,
- dialog:{},
- consult_type: {},
- params: { 'page': 0, 'per_page': 10 },
- consult_list: false,
- loading: false, // 是否加载更多
- isMore: true // 是否有更多
- }
- },
- components:{
- TitleHeader,
- SellerBase,
- EmptyRecord
- },
- computed:{
- fontSize(){
- return getFontSize()
- },
- windowWidth: function () {
- const res = uni.getSystemInfoSync()
- var width=res.windowWidth
- var size=getFontSize()
- return (width-3*.6*size)/4
- }
- },
- mounted(){
- // #ifdef MP-WEIXIN
- this.navHeight = uni.getMenuButtonBoundingClientRect().height
- // #endif
- },
- created () {
- this.loadMore()
- },
- watch: {
- },
- methods:{
- closeDialog(){
- },
- confirmDialog(value){
- replyConsult(this.dialog.data, value).then(res => {
- uni.showToast({icon:'none',title: res.message})
- this.params = { 'page': 0, 'per_page': 10 }
- this.consult_list = false
- this.loading = false
- this.isMore = true
- this.loadMore()
- }).catch(function (error) {
- uni.showToast({icon:'none',title: error.message})
- })
- },
- goBack(){uni.navigateBack({delta:1})},
- replay (id) {
- this.dialog={mode:'input',content:'请输入回复',data:id}
- this.$refs.confirm.open()
- },
- loadMore () {
- this.loading = true
- this.params.page = ++this.params.page
- if (this.isMore) {
- this.loading = false
- this.getConsultList(true)
- }
- },
- getConsultList () {
- uni.showLoading({ title: '加载中' })
- getConsultList(this.params).then(res => {
- uni.hideLoading()
- if (res.result.hasmore) {
- this.isMore = true
- } else {
- this.isMore = false
- }
- let temp = res.result.consult_list
- if (temp) {
- if (!this.consult_list) {
- this.consult_list = temp
- this.consult_type = res.result.consult_type
- } else {
- this.consult_list = this.consult_list.concat(temp)
- }
- }
- }).catch(function (error) {
- uni.hideLoading()
- uni.showToast({icon:'none',title: error.message})
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .scroll-view-wrapper{display: flex;flex-direction: column;}
- .scroll-view{flex:1}
- .consult-item{
- background:#fff;
- border-bottom:1px solid #e1e1e1;
- margin-top: $modelSpace;
- border-radius: .5rem;
- padding: 0 $pageSpace;
- box-sizing: border-box;
- .head{
- padding: .3rem 0;
- display: flex;
- align-items: center;
- .type{
- font-size: .8rem;
- color: #333;
- }
- .time{
- font-size: .6rem;
- color: #999;
- margin-left: auto;
- }
- }
- .goods_info{
- display: flex;
- box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.06);
- .image-wrapper{
- border-radius: .5rem;
- overflow: hidden;
- }
- .p-info{
- margin-left: .5rem;
- .goods_name{
- color: #333;
- font-size: .7rem;
- line-height: .8rem;
- height: 1.6rem;
- margin-top: .4rem;
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- padding: 0 .3rem;
- box-sizing: border-box;
- }
- .goods_price{
- color: $primaryColor;
- font-size: .8rem;
- margin-top: 1rem;
- }
- }
- }
- .consult-info{
- padding: $modelSpace 0;
- .consult_content{
- font-size: .7rem;
- color: #666;
- text{
- color: #333;
- }
- }
- .consult_reply{
- font-size: .7rem;
- color: #666;
- text{
- color: #333;
- }
- }
- }
- .ds-button-large{
- width: 25%;
- margin: 0 auto;
- }
- }
- </style>
|