ConsultList.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <seller-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
  3. <view class="div common-header-wrap">
  4. <view class="status-holder"></view>
  5. <view :style="'height:'+navHeight+'px'"></view>
  6. <view class="common-header-holder"></view>
  7. <view class="common-header-fixed">
  8. <title-header />
  9. <uni-nav-bar title="商品咨询" class="common-header" left-icon="back" @clickLeft="goBack()">
  10. </uni-nav-bar>
  11. </view>
  12. </view>
  13. <view class="scroll-view div" style="position:relative">
  14. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div" @scrolltolower="loadMore" scroll-y="true">
  15. <view class="div" v-if="consult_list && consult_list.length">
  16. <view class="div consult-item" v-for="(item, index) in consult_list" :key="index">
  17. <view class="head">
  18. <view class="type">{{consult_type[item.consulttype_id].consulttype_name}}</view>
  19. <view class="time">{{ $moment.unix(item.consult_addtime).format('YYYY年MM月DD日') }}</view>
  20. </view>
  21. <view class="goods_info" @click="goGoods(item.goods_id)">
  22. <view class="image-wrapper" :style="'width:'+windowWidth+'px;height:'+windowWidth+'px;flex:0 0 ' + windowWidth + 'px'">
  23. <image mode="aspectFit" class="img" :src="item.goods_image"/>
  24. </view>
  25. <view class="p-info">
  26. <view class="goods_name">{{item.goods_name}}</view>
  27. <view class="goods_price">¥{{item.goods_price}}</view>
  28. </view>
  29. </view>
  30. <view class="div consult-info">
  31. <view class="consult_content"><text>咨询内容:</text>{{item.consult_content}}</view>
  32. <view class="consult_reply" v-if="item.consult_reply"><text>商家回复:</text>{{item.consult_reply}}</view>
  33. </view>
  34. <view class="ds-button-large div common-btn mb-10" @click="replay(item.consult_id)" v-if="!item.consult_reply">立即回复</view>
  35. </view>
  36. </view>
  37. <empty-record v-else-if="consult_list && !consult_list.length"></empty-record>
  38. </scroll-view>
  39. </view>
  40. </view>
  41. <uni-popup background-color="#fff" ref="confirm" type="dialog">
  42. <uni-popup-dialog :mode="dialog.mode" :title="dialog.title" :content="dialog.content" :placeholder="dialog.content" @confirm="confirmDialog" @close="closeDialog"></uni-popup-dialog>
  43. </uni-popup>
  44. </seller-base>
  45. </template>
  46. <script>
  47. import {getFontSize} from '@/util/common'
  48. import TitleHeader from '../../TitleHeader'
  49. import SellerBase from '../SellerBase'
  50. import EmptyRecord from '../../EmptyRecord'
  51. import { getConsultList, replyConsult } from '../../../api/sellerConsult'
  52. export default {
  53. data(){
  54. return {
  55. navHeight: 0,
  56. dialog:{},
  57. consult_type: {},
  58. params: { 'page': 0, 'per_page': 10 },
  59. consult_list: false,
  60. loading: false, // 是否加载更多
  61. isMore: true // 是否有更多
  62. }
  63. },
  64. components:{
  65. TitleHeader,
  66. SellerBase,
  67. EmptyRecord
  68. },
  69. computed:{
  70. fontSize(){
  71. return getFontSize()
  72. },
  73. windowWidth: function () {
  74. const res = uni.getSystemInfoSync()
  75. var width=res.windowWidth
  76. var size=getFontSize()
  77. return (width-3*.6*size)/4
  78. }
  79. },
  80. mounted(){
  81. // #ifdef MP-WEIXIN
  82. this.navHeight = uni.getMenuButtonBoundingClientRect().height
  83. // #endif
  84. },
  85. created () {
  86. this.loadMore()
  87. },
  88. watch: {
  89. },
  90. methods:{
  91. closeDialog(){
  92. },
  93. confirmDialog(value){
  94. replyConsult(this.dialog.data, value).then(res => {
  95. uni.showToast({icon:'none',title: res.message})
  96. this.params = { 'page': 0, 'per_page': 10 }
  97. this.consult_list = false
  98. this.loading = false
  99. this.isMore = true
  100. this.loadMore()
  101. }).catch(function (error) {
  102. uni.showToast({icon:'none',title: error.message})
  103. })
  104. },
  105. goBack(){uni.navigateBack({delta:1})},
  106. replay (id) {
  107. this.dialog={mode:'input',content:'请输入回复',data:id}
  108. this.$refs.confirm.open()
  109. },
  110. loadMore () {
  111. this.loading = true
  112. this.params.page = ++this.params.page
  113. if (this.isMore) {
  114. this.loading = false
  115. this.getConsultList(true)
  116. }
  117. },
  118. getConsultList () {
  119. uni.showLoading({ title: '加载中' })
  120. getConsultList(this.params).then(res => {
  121. uni.hideLoading()
  122. if (res.result.hasmore) {
  123. this.isMore = true
  124. } else {
  125. this.isMore = false
  126. }
  127. let temp = res.result.consult_list
  128. if (temp) {
  129. if (!this.consult_list) {
  130. this.consult_list = temp
  131. this.consult_type = res.result.consult_type
  132. } else {
  133. this.consult_list = this.consult_list.concat(temp)
  134. }
  135. }
  136. }).catch(function (error) {
  137. uni.hideLoading()
  138. uni.showToast({icon:'none',title: error.message})
  139. })
  140. }
  141. }
  142. }
  143. </script>
  144. <style scoped lang="scss">
  145. .scroll-view-wrapper{display: flex;flex-direction: column;}
  146. .scroll-view{flex:1}
  147. .consult-item{
  148. background:#fff;
  149. border-bottom:1px solid #e1e1e1;
  150. margin-top: $modelSpace;
  151. border-radius: .5rem;
  152. padding: 0 $pageSpace;
  153. box-sizing: border-box;
  154. .head{
  155. padding: .3rem 0;
  156. display: flex;
  157. align-items: center;
  158. .type{
  159. font-size: .8rem;
  160. color: #333;
  161. }
  162. .time{
  163. font-size: .6rem;
  164. color: #999;
  165. margin-left: auto;
  166. }
  167. }
  168. .goods_info{
  169. display: flex;
  170. box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.06);
  171. .image-wrapper{
  172. border-radius: .5rem;
  173. overflow: hidden;
  174. }
  175. .p-info{
  176. margin-left: .5rem;
  177. .goods_name{
  178. color: #333;
  179. font-size: .7rem;
  180. line-height: .8rem;
  181. height: 1.6rem;
  182. margin-top: .4rem;
  183. overflow: hidden;
  184. display: -webkit-box;
  185. -webkit-box-orient: vertical;
  186. -webkit-line-clamp: 2;
  187. padding: 0 .3rem;
  188. box-sizing: border-box;
  189. }
  190. .goods_price{
  191. color: $primaryColor;
  192. font-size: .8rem;
  193. margin-top: 1rem;
  194. }
  195. }
  196. }
  197. .consult-info{
  198. padding: $modelSpace 0;
  199. .consult_content{
  200. font-size: .7rem;
  201. color: #666;
  202. text{
  203. color: #333;
  204. }
  205. }
  206. .consult_reply{
  207. font-size: .7rem;
  208. color: #666;
  209. text{
  210. color: #333;
  211. }
  212. }
  213. }
  214. .ds-button-large{
  215. width: 25%;
  216. margin: 0 auto;
  217. }
  218. }
  219. </style>