detial.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view class="body" >
  3. <view class="content">
  4. <view>
  5. <uniSwiperDot :info="info" :current="current" field="content" mode="default" :dots-styles=dotsStyles>
  6. <swiper autoplay="true" circular="true" interval="4000" duration="500" class="swiper-box">
  7. <swiper-item v-for="(item ,index) in productDetial.Product_images" :key="index" @click="clickItem(item)">
  8. <image class="imagestyle" :src="item.url" mode=""></image>
  9. </swiper-item>
  10. </swiper>
  11. </uniSwiperDot>
  12. </view>
  13. <view class="title">
  14. <view class="titleCon">
  15. <p> <span style="font-size: 1.5rem; color: red; font-weight: 550; margin-left: 2vw; " >¥{{productDetial.price_f}}</span><!-- <span style="color: grey; margin-left: 2vw; text-decoration: line-through; ">¥85</span> --></p>
  16. <p style=" width: 44vw; background-color: #f7f7f7; font-size: 0.75rem; margin-top: 2vw;">{{productDetial.notes}} <!-- <span style="color: red; margin-left: 1vw;" >5%</span> --></p>
  17. <p style="font-size: 1.2rem; font-weight: 550; margin-top: 2vw;">{{productDetial.name}}</p>
  18. <!-- <p style="font-size: 0.75rem; color: grey; text-align: right; margin-top: 2vw;">已售: 59</p> -->
  19. </view>
  20. </view>
  21. <!-- 选项 -->
  22. <view class="option">
  23. <view class="optionCon">
  24. <view style="display: flex; font-size: 1rem; justify-content: space-around; margin-top: 2vw; ">
  25. <!-- <p style=" color: grey;">已选</p> <p > 五香味45g*7 </p> <p>x3</p> <p> <image style="width: 6vw; height: 6vw; " src="../../static/youjian.png" mode=""></image> </p> -->
  26. <u-popup v-model="show" mode="bottom" border-radius="30">
  27. <view class="contentName">
  28. <p style="position: absolute; right: 3vw; top: 3vw;"> <image style="width: 6vw; height: 6vw;" src="../../static/chahao.png"></image> </p>
  29. <view class="PicTile">
  30. <p> <image style="width: 25vw; height: 25vw;" src="../../static/latiao.png"></image> </p>
  31. <view style="margin-left: 3vw;">
  32. <p> <span style="color: red; font-size: 1.4rem; font-weight: 550;">¥78</span> <span style=" text-decoration: line-through; color: lightgrey; font-size: 0.75rem; ">¥78</span> </p>
  33. <p style="margin-top: 2vw;">库存50件</p>
  34. <p style="margin-top: 2vw;"> <span style="color: lightgray;">已选:</span> <span style="color: lightgray; margin-left: 2vw;">五香味45g*7</span> </p>
  35. </view>
  36. </view>
  37. <view class="guige">
  38. <view style="font-size: 1.2rem; font-weight: 550; margin-bottom: 3vw;" >规格</view>
  39. <view style="width: 100vw; display: flex; flex-wrap: wrap;">
  40. <p style="background-color: #fff5f5; padding: 2vw; color: red; border-radius: 20px; font-size: 0.9rem; ">五香味45g*7</p>
  41. </view>
  42. <view style="display: flex; justify-content: space-between;">
  43. <view style="font-size: 1.2rem; font-weight: 550; margin-top: 3vw;">数量</view>
  44. <view style=" width: 40vw; display: flex; margin-left: 8vw;">
  45. <p class="minus_quantity" @click="decrease">-</p>
  46. <input class="input_quantity" type="number" v-model="quantity" @input="handleInput" />
  47. <p class="add_quantity" @click="increase">+</p>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="button" style="margin-left: 5vw;"> 确定 </view>
  52. </view>
  53. </u-popup>
  54. </view>
  55. <view style="display: flex; font-size: 1rem; margin-top: 2vw; ">
  56. <p style=" color: grey; margin-left: 6vw;"> 发货 </p>
  57. <p style="margin-left: 10vw;">快递</p>
  58. </view>
  59. <view style="font-size: 0.9rem; color: grey; margin-left: 24vw;">
  60. 付款后2个工作日内发货
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="foot">
  66. <view style="width: 20vw; height: 10vw; border-radius: 5px; text-align: center; line-height: 10vw; border: 1px solid lightgray;" @click="WeCom"> 咨询</view>
  67. <view class="button" @click="purchase">立即购买</view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. export default{
  73. data(){
  74. return{
  75. quantity: 1,
  76. show:false,
  77. storeID:'',
  78. dotsStyles: {
  79. backgroundColor: 'rgba(83, 200, 249,0.3)',
  80. border: '1px rgba(83, 200, 249,0.3) solid',
  81. color: '#fff',
  82. bottom: 2,
  83. selectedBackgroundColor: 'white',
  84. selectedBorder: '1px rgba(83, 200, 249,0.9) solid'
  85. },
  86. info: [{
  87. imgLink: '../../static/latiao.png'
  88. } ],
  89. productDetial:{}
  90. }
  91. },
  92. onLoad(option) {
  93. if(option.id){
  94. this.storeID=option.id
  95. this.ProductDetial(option.id)
  96. }
  97. },
  98. methods:{
  99. WeCom(){
  100. console.log('1211')
  101. uni.openCustomerServiceChat({
  102. extInfo: {url: 'https://work.weixin.qq.com/kfid/kfc3e7dfd18c794def3'},
  103. corpId: 'wwb8fbacb965f0006c',
  104. success(res) {
  105. console.log(res)
  106. },
  107. fail(res){
  108. console.log('错误',res)
  109. }
  110. })
  111. },
  112. // 商品详情
  113. ProductDetial(id){
  114. this.$api.getProductDetial(id,res=>{
  115. if(res.code==0){
  116. this.productDetial=res.data
  117. }
  118. })
  119. },
  120. handleInput(event) {
  121. const value = parseInt(event.target.value);
  122. if (!isNaN(value) && value >= 1) {
  123. this.quantity = value;
  124. } else {
  125. this.quantity = 1;
  126. }
  127. },
  128. increase() {
  129. this.quantity++;
  130. },
  131. decrease() {
  132. if (this.quantity > 1) {
  133. this.quantity--;
  134. }
  135. },
  136. purchase(){
  137. uni.navigateTo({
  138. url:'/pages/shopStore/determineOrder?storeId='+this.storeID
  139. })
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .body{
  146. width: 100vw;
  147. height: 100vh;
  148. background-color: #f8f8f8;
  149. overflow: hidden;
  150. .content{
  151. width: 100vw;
  152. height: 100vh;
  153. overflow-y: auto;
  154. background-color:#f8f8f8;
  155. .swiper-box {
  156. height: 80vw;
  157. }
  158. .imagestyle {
  159. width: 100%;
  160. height: 100%
  161. }
  162. .title{
  163. width: 100vw;
  164. height: 19vh;
  165. border-radius: 10px;
  166. background-color: #f8f8f8;
  167. display: flex;
  168. justify-content: center;
  169. margin-top: 2vw;
  170. .titleCon{
  171. box-sizing: border-box;
  172. width: 90vw;
  173. height: 19vh;
  174. padding: 4vw;
  175. border-radius: 10px;
  176. background-color: white;
  177. }
  178. }
  179. .option{
  180. width: 100vw;
  181. height: 14vh;
  182. margin-top: 2vw;
  183. display: flex;
  184. justify-content: center;
  185. .optionCon{
  186. box-sizing: border-box;
  187. width: 90vw;
  188. height: 11vh;
  189. border-radius: 10px;
  190. background-color: white;
  191. .contentName{
  192. width: 100vw;
  193. height: 70vh;
  194. border-radius: 10px 0 10px 0;
  195. background-color: #f8f8f8;
  196. overflow: hidden;
  197. .PicTile{
  198. width: 100vw;
  199. height: 16vh;
  200. background-color: white;
  201. display: flex;
  202. box-sizing: border-box;
  203. padding: 3vw;
  204. }
  205. .guige{
  206. width: 100vw;
  207. height: 43vh;
  208. margin-top: 2vw;
  209. background-color: white;
  210. box-sizing: border-box;
  211. padding: 2vw;
  212. .minus_quantity {
  213. border: 1px solid #f8f8f8;
  214. text-align: center;
  215. width: 20%;
  216. background-color: #f8f8f8;
  217. margin-right: 2vw;
  218. }
  219. .input_quantity {
  220. // border-bottom: 1px solid #74bfe7;
  221. text-align: center;
  222. width: 20%;
  223. height: 8vw;
  224. background-color: #f8f8f8;
  225. }
  226. .add_quantity {
  227. border: 1px solid #f8f8f8;
  228. background-color: #f8f8f8;
  229. text-align: center;
  230. width: 20%;
  231. margin-left: 2vw;
  232. }
  233. }
  234. }
  235. }
  236. }
  237. }
  238. .foot{
  239. width: 100vw;
  240. height: 20vw;
  241. border-top: 1px solid lightgray;
  242. position: fixed;
  243. bottom: 0;
  244. display: flex;
  245. justify-content: space-around;
  246. align-items: center;
  247. }
  248. .button{
  249. width: 60vw;
  250. height: 12vw;
  251. text-align: center;
  252. line-height: 12vw;
  253. background-color: #f83036;
  254. color: white;
  255. border-radius: 10px;
  256. }
  257. }
  258. </style>