123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- <template>
- <view v-if="ifShow" class="qaBox">
- <view class="qaTopInfo">
- <view class="qaTopInfoBox" @click="goGoodsDetails">
- <image :src="detailList.image"></image>
- <view class="qaInfoText">
- <h3>{{ detailList.productName }}</h3>
- <span>共{{ detailList.count }}个问题</span>
- </view>
- </view>
- <view class="qaTitBox">
- <view class="qaTit">
- <i>问</i>
- <h3>{{ detailList.problem }}</h3>
- </view>
- <view class="qaTitTime">
- <img :src="detailList.headImage" />
- <span class="qaName">{{ detailList.name }}</span>
- <span class="qaTimeInfo">{{ detailList.createTime }}</span>
- </view>
- </view>
- </view>
- <view class="answerListBox">
- <view class="answerNum">共{{ answerslength }}条回答</view>
- <view v-for="item in detailList.answers" :key="item.answerId" class="answerList">
- <view class="answerItem">
- <view class="itemTit">
- <view class="itemAvatarBox">
- <img :src="item.headImage" alt="">
- <span class="answerName">{{ item.name }}</span>
- </view>
- <view class="answerTime">{{ item.createTime }}</view>
- </view>
- <view class="answerInfo">{{ item.answer }}</view>
- </view>
- </view>
- </view>
- <view v-if="detailList.ifExhibition == 1" class="pad-bot-100"></view>
- <view
- v-if="detailList.ifExhibition == 1" class="answerBtn"
- :style="{ 'padding-bottom': (isIphone == true ? 50 : 0) + 'rpx' }"
- >
- <view class="uni-form-item uni-column answerBtnBox">
- <input v-model="answerText" class="uni-input" maxlength="200" focus placeholder="被邀请的用户才能回答" />
- <view class="answerButton" @click="answer">
- 回答
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- const NET = require('../../utils/request')
- const API = require('../../config/api')
- import QuestionsAndAnswersList from './components/QuestionsAndAnswersList'
- export default {
- name: 'QADetail',
- components: { QuestionsAndAnswersList },
- data() {
- return {
- detailList: {}, // 商品问答详情
- productId: '',
- images: '',
- productName: '',
- problemsData: {},
- answerText: '',
- answerslength: 0,
- num: 0,
- isIphone: false,
- ifShow: false
- }
- },
- onLoad(options) {
- this.isIphone = getApp().globalData.isIphone
- this.problemsData = this.$getJumpParam(options)
- this.getProblems()
- },
- methods: {
- goGoodsDetails() {
- const shopId = this.detailList.shopId
- const productId = this.detailList.productId
- const skuId = this.detailList.skuId
- uni.navigateTo({
- url: 'goodsDetails?shopId=' + shopId + '&productId=' + productId + '&skuId=' + skuId
- })
- },
- // 商品问答数据
- getProblems() {
- NET.request(API.getProblemDetail, {
- problemId: this.problemsData.problemId,
- productId: this.problemsData.productId
- }, 'GET').then((res) => {
- this.detailList = res.data
- this.ifShow = true
- this.answerslength = this.detailList.answers.length
- uni.removeStorageSync('seeAllFnData')
- })
- .catch((res) => {
- uni.showToast({
- title: '失败',
- icon: 'none'
- })
- })
- },
- // 回答
- answer() {
- NET.request(API.addAnswer, {
- productId: this.problemsData.productId,
- answer: this.answerText,
- problemId: this.problemsData.problemId
- }, 'POST').then((res) => {
- this.getProblems()
- this.answerText = ''
- uni.showToast({
- title: '回答成功',
- icon: 'success'
- })
- })
- .catch((res) => {
- uni.showToast({
- title: '失败',
- icon: 'none'
- })
- })
- }
- }
- }
- </script>
- <style
- lang="scss"
- scoped
- >
- .qaBox {
- padding: 0 30upx;
- .qaTopInfo {
- margin-top: 20upx;
- .qaTopInfoBox {
- border-radius: 10upx;
- display: flex;
- align-items: center;
- padding: 15upx 20upx;
- margin-bottom: 55upx;
- image {
- border: 2px solid #E4E5E6;
- width: 120upx;
- height: 120upx;
- margin-right: 20upx;
- }
- .qaInfoText {
- h3 {
- font-size: 30upx;
- font-weight: 500;
- color: #333333;
- margin-bottom: 20rpx;
- }
- span {
- font-size: 24upx;
- color: #999999;
- }
- }
- }
- .qaTitBox {
- padding-bottom: 30upx;
- border-bottom: 1upx solid #EEEEEE;
- .qaTit {
- display: flex;
- align-items: center;
- margin-bottom: 35upx;
- i {
- width: 38upx;
- height: 38upx;
- background: #C83732;
- font-style: normal;
- text-align: center;
- color: #FFFFFF;
- font-size: 20upx;
- margin-right: 30upx;
- }
- h3 {
- font-size: 28upx;
- font-weight: 500;
- color: #333333;
- }
- }
- .qaTitTime {
- display: flex;
- align-items: center;
- img {
- width: 44upx;
- height: 44upx;
- margin-right: 20upx;
- }
- .qaName {
- font-size: 28upx;
- color: #666666;
- margin-right: 35upx;
- }
- .qaTimeInfo {
- color: #CCCCCC;
- font-size: 22upx;
- }
- }
- }
- }
- .answerListBox {
- .answerNum {
- font-size: 24upx;
- color: #CCCCCC;
- margin-bottom: 40upx;
- margin-top: 30upx;
- }
- .answerList {
- padding-bottom: 50upx;
- .answerItem {
- margin-bottom: 10upx;
- .itemTit {
- display: flex;
- align-items: center;
- justify-content: space-between;
- .itemAvatarBox {
- display: flex;
- img {
- width: 46upx;
- height: 46upx;
- margin-right: 20upx;
- }
- .answerName {
- font-size: 26upx;
- color: #333333;
- font-weight: bold;
- }
- }
- .answerTime {
- color: #CCCCCC;
- font-size: 20upx;
- }
- }
- .answerInfo {
- color: #333333;
- font-size: 28upx;
- margin-top: 20upx;
- font-weight: 400;
- }
- }
- }
- }
- .answerBtn {
- position: fixed;
- width: 100%;
- bottom: 0;
- left: 0;
- .answerBtnBox {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 100%;
- padding: 30upx;
- background: #FFFFFF;
- input {
- margin-right: 30upx;
- width: 530upx;
- background: #F1F1F1;
- min-height: 84upx;
- padding-left: 30upx;
- font-size: 28upx;
- color: #999999;
- }
- .input-placeholder {
- font-size: 24upx;
- color: #999999;
- }
- .answerButton {
- width: 152upx;
- height: 84upx;
- background: #333333;
- text-align: center;
- line-height: 84upx;
- font-size: 30upx;
- color: #FFEBC4;
- }
- }
- }
- }
- </style>
|