goods.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <template>
  2. <view>
  3. <!--标题栏-->
  4. <bar-title bgColor='bg-white'>
  5. <block slot="content">商品详情</block>
  6. <block slot="right">
  7. <text :class="isFavor ? 'cuIcon-favorfill' : 'cuIcon-favor'" @click="favTap"/>
  8. <text class="cuIcon-forward"/>
  9. </block>
  10. </bar-title>
  11. <!--提示-->
  12. <!-- <view class="bg-grey text-sm text-center padding-tb-xs text-white">真机实拍部分为真机样张,您购买的机型大致符合图中成色效果</view> -->
  13. <!--轮播图-->
  14. <view class="zaiui-banner-swiper-box">
  15. <swiper class="screen-swiper" circular autoplay @change="bannerSwiper">
  16. <swiper-item v-for="(item,index) in info.pic" :key="index">
  17. <image :src="item" mode="aspectFill"/>
  18. </swiper-item>
  19. </swiper>
  20. <!--页码-->
  21. <text v-if="info.pic" class="cu-tag bg-grey round sm zaiui-page">{{bannerCur + 1}} / {{info.pic.length}}</text>
  22. </view>
  23. <!--限时秒杀-->
  24. <view class="zaiui-limited-seckill-box">
  25. <view class="zaiui-time-left" style="align-items: baseline;">
  26. <text class="text-price text-xxl">{{info.price ? info.price.value : '0'}}</text>
  27. <view class="text-xs zaiui-cost-price-num price-4">
  28. <view class="text-through">原价{{info.price ? info.price.original : 0}}</view>
  29. <!-- <view>剩余{{info.price.num}}件</view> -->
  30. </view>
  31. </view>
  32. <view class="text-right zaiui-time-right">
  33. <!-- <view>自营限时秒杀</view>
  34. <view class="text-xs">距结束剩余10时07分50秒</view> -->
  35. </view>
  36. </view>
  37. <!--标题-->
  38. <view class="bg-white zaiui-view-box zaiui-title-view-box">
  39. <view class="title-view">
  40. <!-- <text class="cu-tag bg-red radius sm">自营</text> -->
  41. <text class="text-black text-lg text-bold">{{info.name}}</text>
  42. </view>
  43. <!-- <view class="light bg-red radius margin-top-sm zaiui-title-tip-box">
  44. <view class="text-cut">
  45. <text class="margin-right-sm">官方自营</text>
  46. <text class="text-sm">官方自营正品保障新品体验售后无忧</text>
  47. </view>
  48. <text class="cuIcon-right icon"/>
  49. </view> -->
  50. </view>
  51. <!--服务-->
  52. <!-- <view class="margin-top bg-white zaiui-view-box zaiui-service-view-box" @tap="serviceTap">
  53. <view class="flex flex-wrap text-sm">
  54. <view class="basis-1">
  55. <text class="text-gray">服务</text>
  56. </view>
  57. <view class="basis-7">
  58. <view>
  59. <text class="tag-view">
  60. <text class="cuIcon-title text-red"/>
  61. <text>已验机</text>
  62. </text>
  63. <text class="tag-view">
  64. <text class="cuIcon-title text-red"/>
  65. <text>7天无理由</text>
  66. </text>
  67. <text class="tag-view">
  68. <text class="cuIcon-title text-red"/>
  69. <text>180天质保</text>
  70. </text>
  71. </view>
  72. <view class="margin-top-xs">
  73. <text class="tag-view">
  74. <text class="cuIcon-title text-red"/>
  75. <text>顺丰包邮</text>
  76. </text>
  77. <text class="tag-view">
  78. <text class="cuIcon-title text-red"/>
  79. <text>半年电池免费换新</text>
  80. </text>
  81. </view>
  82. </view>
  83. <view class="basis-2">
  84. <view class="text-gray text-right icon-view">
  85. <text class="cuIcon-right icon"/>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. -->
  91. <!--促销-->
  92. <!-- <view class="margin-top bg-white zaiui-view-box zaiui-promotion-view-box">
  93. <view class="flex flex-wrap text-sm" @tap="promotionTap">
  94. <view class="basis-1">
  95. <text class="text-gray">促销</text>
  96. </view>
  97. <view class="basis-7">
  98. <view>
  99. <text class="cu-tag line-orange sm radius">赠品</text>
  100. <text class="text-view">品胜充电器套装</text>
  101. </view>
  102. <view class="margin-top-xs">
  103. <text class="cu-tag line-orange sm radius">分期</text>
  104. <text class="text-view">¥318元/月花呗/京东/微信组合支付</text>
  105. </view>
  106. </view>
  107. <view class="basis-2">
  108. <view class="text-gray text-right icon-view">
  109. <text class="cuIcon-right icon"/>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. -->
  115. <!--选择-->
  116. <view class="margin-top bg-white zaiui-view-box zaiui-select-view-box">
  117. <!-- <view class="flex flex-wrap text-sm">
  118. <view class="basis-1">
  119. <text class="text-gray">发货</text>
  120. </view>
  121. <view class="basis-9">
  122. <text class="text-sm">16:00前下单,当日发货,顺丰包邮(部分地区除外)</text>
  123. </view>
  124. </view>
  125. -->
  126. <!-- <view class="zaiui-border-view"/> -->
  127. <view class="flex flex-wrap text-sm" @tap="selectTap">
  128. <view class="basis-1">
  129. <text class="text-gray">已选</text>
  130. </view>
  131. <view class="basis-8">
  132. <text class="text-sm">{{selectedSkuName}}</text>
  133. </view>
  134. <view class="basis-1">
  135. <view class="text-gray text-right">
  136. <text class="cuIcon-right icon"/>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. <!--评论-->
  142. <view class="margin-top bg-white zaiui-comment-view-box" v-if="reviewInfo.total">
  143. <view class="cu-bar bg-white">
  144. <view class="action">
  145. <text class="text-black text-lg">评价({{reviewInfo.total}})</text>
  146. </view>
  147. <view class="action">
  148. <navigator :url="`/pages/goods/reviews?id=${goodsId}`" class="text-sm" >
  149. <text class="margin-right-xs">查看全部</text>
  150. <!-- <text class="text-black text-lg">97%</text> -->
  151. <text class="cuIcon-right icon margin-left-xs"/>
  152. </navigator>
  153. </view>
  154. </view>
  155. <view class="zaiui-border-view"/>
  156. <block v-for="(item, index) in reviewInfo.list">
  157. <view class="zaiui-view-box" :key="item.id">
  158. <view class="flex flex-wrap text-sm">
  159. <view class="basis-1">
  160. <view class="cu-avatar sm round" :style="`background-image:url(${item.user.avatar || '/static/images/avatar/1.jpg'})`"/>
  161. </view>
  162. <view class="basis-9 text-sm">
  163. <view>{{item.user.name}}</view>
  164. <view class="margin-top-xs">{{item.content}}</view>
  165. <view class="text-gray margin-top-sm">{{item.cdate_str}}</view>
  166. </view>
  167. </view>
  168. </view>
  169. <view class="zaiui-border-view" v-if="index != 1"/>
  170. </block>
  171. </view>
  172. <!--杂项信息-->
  173. <!-- <view class="margin-top bg-white zaiui-view-box zaiui-goods-info-view-box"> -->
  174. <!-- <view class="zaiui-shop-view">
  175. <view class="cu-avatar lg round" style="background-image:url(/static/images/avatar/1.jpg)"/>
  176. <view class="text-view">
  177. <view class="margin-bottom-xs">仔仔店铺</view>
  178. <view class="text-sm text-cut">仔仔店铺,正品保障,售后无忧</view>
  179. </view>
  180. <button class="cu-btn radius sm line-red">全部商品</button>
  181. </view>
  182. <view class="zaiui-border-view"/>
  183. <view class="live-tag-view">
  184. <view class="text-view">
  185. <text class="cu-tag bg-red radius sm">
  186. <text class="cuIcon-title"/>
  187. <text>直播中</text>
  188. </text>
  189. <text class="margin-left-xs text-cut">官方直播自营商品在线答疑</text>
  190. </view>
  191. <view class="text-sm text-red text-right-view">
  192. <text class="margin-right-xs">看直播</text>
  193. <text class="cuIcon-right"/>
  194. </view>
  195. </view>
  196. <view class="zaiui-border-view"/> -->
  197. <!-- <view class="zaiui-recommend-list-box">
  198. <view class="text-sm">官方推荐</view>
  199. <view class="recommend-scroll-box">
  200. <scroll-view class="recommend-scroll" scroll-x>
  201. <block v-for="(items,indexs) in goodsList" :key="indexs">
  202. <view :id="['scroll' + (indexs + 1 )]" class="recommend-scroll-item">
  203. <view class="cu-avatar xl radius" :style="[{backgroundImage:'url('+ items.img +')'}]"/>
  204. <view class="text-cut-2 text-sm text-black margin-tb-sm">{{items.title}}</view>
  205. <view class="text-red text-price margin-tb-sm text-lg">{{items.price}}</view>
  206. </view>
  207. </block>
  208. </scroll-view>
  209. </view>
  210. </view> -->
  211. <!-- </view> -->
  212. <!--图片详情-->
  213. <view class="margin-top zaiui-goods-details-box" v-html="info.content" style="padding:0 26upx">
  214. <!-- <image src="/static/images/home/goods/goods-1.png" mode="widthFix"/>
  215. <image src="/static/images/home/goods/goods-2.png" mode="widthFix"/> -->
  216. </view>
  217. <!--常见问题-->
  218. <!-- <view class="margin-top bg-white margin-bottom zaiui-view-box zaiui-goods-help-view-box">
  219. <view class="text-black text-lg margin-bottom-sm">常见问题</view>
  220. <view class="flex flex-wrap margin-bottom">
  221. <view class="basis-1">
  222. <text class="cu-tag bg-grey radius sm">问</text>
  223. </view>
  224. <view class="basis-9">
  225. <view class="margin-bottom-xs text-black">手机是正品吗?有保障吗?</view>
  226. <view class="text-sm">转转自营的每部二手手机皆经过质检工程师51项专业质检并出具了详细的配套验机评估报告,且提供7天试用和180天售后质保服务;成色为[全新]的手机,为官方全新原装手机,与官方门店购买的没有任何差别,享受官方质保与转转提供的180天售后质保服务,可以放心选购哦</view>
  227. </view>
  228. </view>
  229. <view class="flex flex-wrap margin-bottom">
  230. <view class="basis-1">
  231. <text class="cu-tag bg-grey radius sm">问</text>
  232. </view>
  233. <view class="basis-9">
  234. <view class="margin-bottom-xs text-black">都有哪些渠道版本的手机?</view>
  235. <view class="text-sm">版本包括:国行、港澳、国际版(包括美欧日韩等版本)。其中除了零售机还包括:演示机,官换机,官翻机。</view>
  236. </view>
  237. </view>
  238. <view class="zaiui-border-view"/>
  239. <view class="text-center text-blue">查看更多问题</view>
  240. </view> -->
  241. <!--相似推荐-->
  242. <!-- <view class="margin-top zaiui-view-box zaiui-recommend-list-view-box">
  243. <view class="flex flex-wrap">
  244. <view class="basis-sm text-right">
  245. <image class="img-aau" src="/static/zaiui/img/aau.png" lazy-load mode="widthFix"/>
  246. </view>
  247. <view class="basis-xs text-center">
  248. <text class="text-black text-lg">相似推荐</text>
  249. </view>
  250. <view class="basis-sm text-left">
  251. <image class="img-aau" src="/static/zaiui/img/aau.png" lazy-load mode="widthFix"/>
  252. </view>
  253. </view>
  254. <view class="margin-bottom zaiui-goods-list-box">
  255. <view class="grid col-2">
  256. <block v-for="(items,indexs) in goodsList" :key="indexs">
  257. <view class="list-itme">
  258. <view class="bg-white list-radius">
  259. <view class="goods-img">
  260. <view class="cu-avatar" :style="[{backgroundImage:'url('+ items.img +')'}]"/>
  261. <view class="mold-view" v-if="items.mold">
  262. <text class="cu-tag radius sm bg-red">自营</text>
  263. </view>
  264. </view>
  265. <view class="view-goods-info">
  266. <view class="text-cut-2 text-black text-sm margin-bottom-sm">{{items.title}}</view>
  267. <view class="text-price text-red text-lg">{{items.price}}</view>
  268. </view>
  269. </view>
  270. </view>
  271. </block>
  272. </view>
  273. </view>
  274. </view> -->
  275. <!--占位底部距离-->
  276. <view class="cu-tabbar-height"/>
  277. <!--底部操作-->
  278. <view class="zaiui-footer-fixed">
  279. <view class="cu-bar bg-white tabbar border shop">
  280. <view class="action" @tap="myCartTap">
  281. <view class="cuIcon-cart">
  282. <view class="cu-tag badge">{{totalCount}}</view>
  283. </view>
  284. <text>购物车</text>
  285. </view>
  286. <button class="action">
  287. <!-- <view class="cuIcon-service"/>
  288. <view>客服</view> -->
  289. </button>
  290. <view class="btn-group">
  291. <button class="cu-btn bg-orange radius shadow-blur" @tap="selectTap('add')">加入购物车</button>
  292. <button class="cu-btn bg-red radius shadow-blur" @tap="selectTap('sell')">立即购买</button>
  293. </view>
  294. </view>
  295. </view>
  296. <!--弹出框-->
  297. <view class="cu-modal bottom-modal zaiui-bottom-modal-box" :class="bottomModal?'show':''">
  298. <view class="cu-dialog bg-white">
  299. <!--标题-->
  300. <view class="text-black text-center margin-tb text-lg zaiui-title-bar">
  301. <text>{{modalTitle}}</text>
  302. <text class="cuIcon-close close-icon" @tap="hideModal"></text>
  303. </view>
  304. <!--内容区域-->
  305. <view class="zaiui-modal-content">
  306. <!--服务区域-->
  307. <!-- <view class="zaiui-view-box service" v-if="modalType=='service'">
  308. <view class="text-view">
  309. <text class="cuIcon-title text-red"/>
  310. <text class="text-cut text-black">已验机</text>
  311. </view>
  312. <view class="text-sm text-list-view">
  313. <view class="margin-left text-cut text-gray">转转&富士康联合制定验机标准,对设备进行专业质检</view>
  314. </view>
  315. <view class="text-view">
  316. <text class="cuIcon-title text-red"/>
  317. <text class="text-cut text-black">7天无理由</text>
  318. </view>
  319. <view class="text-sm text-list-view">
  320. <view class="margin-left text-cut text-gray">自收到商品7天内,不喜欢可以申请退货,并自付邮费寄回</view>
  321. </view>
  322. <view class="text-view">
  323. <text class="cuIcon-title text-red"/>
  324. <text class="text-cut text-black">180天质保</text>
  325. </view>
  326. <view class="text-sm text-list-view">
  327. <view class="margin-left text-cut text-gray">自订单确认收货起180天,提供免费质保</view>
  328. </view>
  329. <view class="text-view">
  330. <text class="cuIcon-title text-red"/>
  331. <text class="text-cut text-black">顺丰包邮</text>
  332. </view>
  333. <view class="text-sm text-list-view">
  334. <view class="margin-left text-cut text-gray">16:00前下单,今日发货,顺丰包邮(偏远地区邮政包邮)</view>
  335. </view>
  336. <view class="text-view">
  337. <text class="cuIcon-title text-red"/>
  338. <text class="text-cut text-black">半年电池免费换新</text>
  339. </view>
  340. <view class="text-sm text-list-view">
  341. <view class="margin-left text-cut text-gray">自订单确认收货起半年,如果电池电量低于60%,可申请免费更换原厂品质电池</view>
  342. </view>
  343. </view>
  344. -->
  345. <!--促销区域-->
  346. <!-- <view class="zaiui-view-box promotion" v-if="modalType=='promotion'">
  347. <view class="text-view">
  348. <text class="cu-tag line-orange radius sm">赠品</text>
  349. <text class="margin-left-xs text-cut text-black">品胜充电器套装</text>
  350. </view>
  351. <view class="text-sm text-list-view">
  352. <view class="text-cut">充电头+数据线</view>
  353. <text class="text-right-view">价值¥99</text>
  354. </view>
  355. <view class="text-view">
  356. <text class="cu-tag line-orange radius sm">分期</text>
  357. <text class="margin-left-xs text-cut text-black">¥318元/月花呗/京东/微信组合支付</text>
  358. </view>
  359. </view>
  360. -->
  361. <!--选择规格-->
  362. <view class="zaiui-view-box select" v-if="modalType=='select'">
  363. <!--商品信息-->
  364. <view class="cu-list menu-avatar">
  365. <view class="cu-item">
  366. <view class="cu-avatar radius lg" style="background-image:url(/static/images/home/goods/1.png);"/>
  367. <view class="content">
  368. <view class="text-price-view">
  369. <text class="text-price text-red margin-right-xs">{{skuInfo.value}}</text>
  370. <text class="text-sm text-gray text-through">{{skuInfo.original}}</text>
  371. <!-- <text class="cu-tag bg-gradual-red radius sm">
  372. <text class="cuIcon-hotfill"/>
  373. <text>秒杀中</text>
  374. </text> -->
  375. </view>
  376. <view class="text-black text-sm flex">
  377. <view class="text-cut">已选: {{selectedSkuName}}</view>
  378. </view>
  379. </view>
  380. </view>
  381. </view>
  382. <!--规格数据-->
  383. <view class="zaiui-select-btn-list-boox" v-if="skuInfo.sku">
  384. <view class="select-item" v-for="(item, index) in skuInfo.sku.spec" :key="index">
  385. <view class="text-black">{{item.name}}</view>
  386. <view class="select-btn">
  387. <button class="cu-btn" @click="handleSelectSku(index, tag.id)" :class="curSkuArr[index] == tag.id ? 'light bg-red': ''" v-for="tag in item.value" :key="tag.id">{{tag.value}}</button>
  388. <!-- <button class="cu-btn">9成新</button> -->
  389. <!-- <button class="cu-btn light bg-red">99新</button> -->
  390. </view>
  391. </view>
  392. <!-- <view class="select-item">
  393. <view class="text-black">颜色</view>
  394. <view class="select-btn">
  395. <button class="cu-btn light bg-red">深空灰色</button>
  396. <button class="cu-btn" disabled>银色</button>
  397. </view>
  398. </view>
  399. <view class="select-item">
  400. <view class="text-black">容量</view>
  401. <view class="select-btn">
  402. <button class="cu-btn" disabled>256G</button>
  403. <button class="cu-btn light bg-red">64G</button>
  404. </view>
  405. </view>
  406. <view class="select-item">
  407. <view class="text-black">版本</view>
  408. <view class="select-btn">
  409. <button class="cu-btn">港澳版移动4G/联通4G</button>
  410. <button class="cu-btn">其他版本移动4G/联通4G</button>
  411. <button class="cu-btn">其他版本三网通</button>
  412. <button class="cu-btn light bg-red">国行三网通</button>
  413. </view>
  414. </view> -->
  415. </view>
  416. </view>
  417. <!--公共按钮-->
  418. <view class="zaiui-footer-fixed">
  419. <view class="flex flex-direction">
  420. <button class="cu-btn bg-red lg" @click="addToCart">确定</button>
  421. </view>
  422. </view>
  423. </view>
  424. </view>
  425. </view>
  426. </view>
  427. </template>
  428. <script>
  429. import barTitle from '@/components/zaiui-common/basics/bar-title';
  430. import _goods_data from '@/static/zaiui/data/goods.js'; //虚拟数据
  431. import _tool from '@/static/zaiui/util/tools.js'; //工具函数
  432. export default {
  433. components: {
  434. barTitle,
  435. },
  436. data() {
  437. return {
  438. bannerCur: 0, bannerList: [], bottomModal: false, modalTitle: '', modalType: 'promotion', selectType: '',
  439. goodsList: [],
  440. goodsId: '',
  441. info: {},
  442. skuInfo: {},
  443. selectedSku: '',
  444. cartInfo: {},
  445. isFavor: false,
  446. reviewInfo: {}
  447. }
  448. },
  449. onLoad(options) {
  450. this.goodsId = options.id;
  451. // this.bannerList = _goods_data.bannerListData();
  452. // this.goodsList = _goods_data.goodsList();
  453. this.loadInfo()
  454. this.loadSku()
  455. this.loadReviewList()
  456. if(this.userInfo.t) {
  457. this.loadCartList()
  458. }
  459. },
  460. onReady() {
  461. _tool.setBarColor(true);
  462. uni.pageScrollTo({
  463. scrollTop: 0,
  464. duration: 0
  465. });
  466. },
  467. computed: {
  468. curSkuArr() {
  469. return this.selectedSku.split('_')
  470. },
  471. selectedSkuName() {
  472. let arr = []
  473. if(!this.skuInfo.sku || !this.curSkuArr.length) {
  474. return ''
  475. }
  476. this.curSkuArr.forEach((item, index) => {
  477. let o = this.skuInfo.sku.spec[index] || {};
  478. arr.push(o.name + ':' + (o ? o.value : []).find(v => v.id == item).value)
  479. })
  480. return arr.join(',');
  481. },
  482. totalCount() {
  483. if(!this.cartInfo.length) {
  484. return 0
  485. }
  486. return this.cartInfo.reduce((prev, curr) => {
  487. return prev + curr.num
  488. }, 0)
  489. }
  490. },
  491. methods: {
  492. favTap() {
  493. this.reqByuser({
  494. url: '?l=collect.up',
  495. data: {type: 3, type_id: this.goodsId},
  496. success: res => {
  497. if(res.data.status == 1) {
  498. this.isFavor = true;
  499. }else {
  500. this.error = res.data.msg
  501. }
  502. }
  503. })
  504. },
  505. handleSelectSku(index, id) {
  506. let arr = this.curSkuArr;
  507. arr[index] = id;
  508. this.selectedSku = arr.join('_')
  509. // console.log(this.selectedSku)
  510. },
  511. loadInfo() {
  512. this.req({
  513. url: '?l=resource.view',
  514. data: {type: 3, type_id: this.goodsId},
  515. success: res => {
  516. if(res.data.status == 1) {
  517. console.log(res.data.data)
  518. this.info = res.data.data.info;
  519. this.selectedSku = this.info.sku_key
  520. }else {
  521. this.error = res.data.msg
  522. }
  523. }
  524. })
  525. },
  526. loadSku() {
  527. this.reqByuser({
  528. url: '?l=resource.submit',
  529. data: {type: 3, type_id: this.goodsId},
  530. success: res => {
  531. if(res.data.status == 1) {
  532. // console.log(res.data.data)
  533. this.skuInfo = res.data.data.info;
  534. }else {
  535. this.error = res.data.msg
  536. }
  537. }
  538. })
  539. },
  540. bannerSwiper(e) {
  541. this.bannerCur = e.detail.current;
  542. },
  543. serviceTap() {
  544. this.modalTitle = "服务";
  545. this.modalType = 'service';
  546. this.showModal();
  547. },
  548. promotionTap() {
  549. this.modalTitle = "促销优惠";
  550. this.modalType = 'promotion';
  551. this.showModal();
  552. },
  553. selectTap(type) {
  554. this.selectType = type;
  555. this.modalTitle = "选择规格";
  556. this.modalType = 'select';
  557. this.showModal();
  558. },
  559. showModal() {
  560. this.bottomModal = true;
  561. },
  562. hideModal(e) {
  563. this.bottomModal = false;
  564. this.modalTitle = "";
  565. this.modalType = '';
  566. },
  567. myCartTap(){
  568. uni.navigateTo({
  569. url: '/pages/goods/my_cart'
  570. });
  571. },
  572. loadCartList() {
  573. this.reqByuser({
  574. url: '?l=cart.list',
  575. data: {},
  576. success: res => {
  577. if(res.data.status == 1) {
  578. // console.log(res.data.data)
  579. // this.cartInfo = res.data.data.info;
  580. this.cartInfo = res.data.data.list
  581. }else {
  582. this.error = res.data.msg
  583. }
  584. }
  585. })
  586. },
  587. addToCart() {
  588. this.reqByuser({
  589. url: '?l=cart.up',
  590. // method: 'POST',
  591. data: {
  592. type_id: this.goodsId,
  593. sku_id: this.skuInfo.sku.price[this.selectedSku].id,
  594. num: 1
  595. },
  596. success: res => {
  597. if(res.data.status == 1) {
  598. uni.showToast({
  599. icon: 'success',
  600. title: '添加成功'
  601. })
  602. this.cartInfo = res.data.data
  603. this.bottomModal = false;
  604. if(this.selectType === 'sell') {
  605. this.myCartTap()
  606. }
  607. }else {
  608. uni.showToast({
  609. icon: 'error',
  610. title: '添加失败'
  611. })
  612. }
  613. }
  614. })
  615. },
  616. loadReviewList() {
  617. this.reqByuser({
  618. url: '?l=resource.getReviewList',
  619. data: {
  620. type: 3,
  621. type_id: this.goodsId,
  622. num: 2
  623. },
  624. success: res => {
  625. if(res.data.status == 1) {
  626. this.reviewInfo = res.data.data
  627. }else {
  628. this.error = res.data.msg
  629. }
  630. }
  631. })
  632. },
  633. }
  634. }
  635. </script>
  636. <style lang="scss">
  637. /* #ifdef APP-PLUS */
  638. @import "../../static/colorui/main.css";
  639. @import "../../static/colorui/icon.css";
  640. @import "../../static/zaiui/style/app.scss";
  641. /* #endif */
  642. @import "../../static/zaiui/style/goods.scss";
  643. </style>