123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706 |
- <style>
- .m-app{width:100vw}
- /* 头部 */
- .app-header{width:100%;position:fixed;top:0px;left:0px;z-index: 10;background: transparent;}
- .app-header-bg{background: #ffffff;}
- .mp-padding{width:100%;height:50px;}
- button.item-back-btn{width:30px;height:30px;}
- button.item-back-btn image{width:30px;height:30px;}
- .mp-title{color:transparent;font-size: 16px;font-weight: 700;text-align: center;width:100%;height:50px;line-height: 50px;position: relative;}
- .mp-title text{ width: 80%; white-space: nowrap;text-overflow: ellipsis;overflow: hidden;word-break: break-all;display: inline-block;}
- .mp-title button.item-back-btn{position: absolute;left:12px;top:10px}
- .app-header-bg .mp-title{color:#333333;}
-
- /* 滚动内容区域 */
- scroll-view.mid-body{width:100vw;height:calc(100vh - 50px);}
- /* 轮播 */
- .item-swiper{width:100vw;height:100vw;background:#ffffff;position: relative;}
- .swiper-count{height:24px;line-height: 24px; position: absolute;right:15px;bottom:15px;padding: 0px 10px;border-radius: 12px;background: rgba(0,0,0,0.5);}
- .swiper-count text{color:#f7f7f7;font-size: 14px;height:14px;line-height: 14px;}
- .swiper-count text:first-child{font-weight: 700;}
- swiper{width:100vw;height:100vw;}
- swiper-item{width:100vw;height:100vw;}
- image.swiper-item-img{width:100vw;height:100vw;}
- .item-transparent{background: transparent;}
-
- /** 商品新详情**/
- .goods-info{background: #fff;margin: 10px;padding: 8px;border-radius: 10px;}
- .goods-info .price-info{}
- .goods-info .price-info .price{color: #fd3b39;font-size: 28px;font-weight: 600;}
- .goods-info .price-info .price text{color: #fd3b39;font-size: 16px;font-weight: 400;}
- .goods-info .price-info .old-price{margin-left: 10px;color: #98999A;font-size: 14px;font-weight: 400;text-decoration: line-through;}
- .goods-info .title{color: #333;font-size: 16px;font-weight: 600;}
- .goods-info .foot{margin-top: 10px;}
- .goods-info .address{color: #ACACAC;font-size: 14px;font-weight: 400;}
- .goods-info .add-icon{width: 14px;height: 14px;margin-right: 3px;}
- .goods-info .sales{color: #ACACAC;font-size: 14px;font-weight: 400;}
- .green-info{border:1px solid #fd3b39;border-radius: 10px; padding: 5px;background: rgba(1, 149, 96, 0.2);margin-top: 10px;}
- .green-info image{width: 20px;height: 20px;margin-right: 4px;}
- .green-info .tinfo{font-size: 12px;color: #fd3b39;}
- .green-info .tinfo text{font-weight: bold;}
-
- /* 属性规格 */
- .item-prop{padding: 0px 15px;background: #ffffff;margin: 10px;border-radius: 10px;}
- .item-prop-list{width:100%;height:45px;}
- .item-prop-title{width:48px;text-align: left;font-size: 14px;color:#BFBFBF;}
- button.item-prop-btn{width:calc(100% - 48px);height:45px;}
- button.item-prop-btn text{text-align: left;font-size: 14px;color:#333333;width:calc(100% - 14px);height:14px;line-height: 14px;}
- button.item-prop-btn image{width:14px;height:14px}
-
-
-
- .item-service{padding: 15px 12px;width:calc(100% - 24px);margin-top: 10px;background: #ffffff;}
- .item-service-list{width:100%;margin-top: 15px;}
- .item-service-list:first-child{margin-top: 0px;}
- .item-service-title{width:42px;text-align: left;font-size: 13px;color:#666666;}
- .item-service-val{width:calc(100% - 42px);text-align: left;font-size: 13px;color:#333333;}
- .item-service-val text.red-text{color:#ff383e}
- /* 商品评价 */
- .item-evaluate{background: #ffffff;padding: 0px 15px;width:calc(100% - 30px);margin-top: 8px;}
- button.evaluate-btn{padding: 10px 0;}
- button.evaluate-btn text{text-align: center;color:#A8A8A8;font-size: 14px;height:14px;line-height: 14px;}
- button.evaluate-btn text.evaluate-title{color:#333333;font-size: 15px;line-height: 15px;height:15px;text-align: left;font-weight: 700;}
- button.evaluate-btn image{width:14px;height:14px;margin-left: 4px;}
- .evaluate-show{width:100%;}
- .evaluate-list{padding-top:8px;padding-bottom: 8px;border-bottom:1px solid #EEEEEE;}
- .evaluate-list:last-child{border-bottom:none;}
- .evaluate-user{width:100%;}
- .evaluate-avatar{height:32px;width:32px;border-radius: 16px;overflow: hidden;}
- .evaluate-avatar image{height:32px;width:32x;}
- .evaluate-info{height:40px;width:calc(100% - 40px - 6px);margin-left: 6px;}
- .evaluate-nickname{width:100%;color:#333333;font-size: 14px;text-align: left;height:14px;line-height: 14px;}
- .evaluate-star{height:12px;margin-top: 4px;}
- image.evaluate-star-img{width:12px;height:12px;margin-right: 2px;}
- .evaluate-msg{margin-top: 8px;text-align: left;color:#333333;font-size: 14px;line-height: 20px;font-weight: 400;}
- .evaluate-img{padding-top: 10px;}
- .evaluate-img-list{width:75px;height:75px;overflow: hidden; background: #F1F1F1;margin-right: 10px;}
- .evaluate-img-list image,.evaluate-img-list img{width:75px}
- image.doctor-star-img{width:12px;height:12px;margin-right: 2px;}
- /* 商品详情 */
- .item-desc{width:100%;}
- .item-desc-title{width:100%;height:40px;}
- .desc-title{font-size: 15px;height:15px;line-height: 15px;text-align: center;color:#333333;margin: 0px 10px;}
- .desc-title-left{width:40px;height:1px;background: #E6E6E6}
- .desc-title-right{width:40px;height:1px;background: #E6E6E6}
- .item-desc-img{width:100%}
- .item-desc-img image{width:100%}
- .item-desc-img text{ position: absolute; width: 100%; text-align: center; font-size: 1px; color: #ccc;}
- /* app底部 */
- .app-footer{width:100vw;height:50px;background: #ffffff;position: fixed;bottom:0px;left:0px;z-index: 2;}
- button.app-footer-nav{width:50px;height:50px; position: relative;}
- button.app-footer-nav image{width:25px;height:25px}
- button.app-footer-nav text{font-size: 12px;height:12px;line-height: 12px;width:100%;text-align: center;margin-top: 4px;color:#323334}
- button.app-footer-nav text.love-hit{ color: #f1851e;}
- .cart-count{position: absolute; top: -4px; right:7px; width: 15px;height: 15px;border-radius: 50%;text-align:center;line-height:15px;background: #FA4171; font-size: 12px; color: #fff;}
-
- .app-footer{
- background: hsla(0, 0%, 100%, .9);
- box-shadow: 0 0 11px 0 rgba(0, 0, 0, .5);
- }
-
- button.app-footer-btn{background: #fd3b39;height: 56px;width: 100%;text-align: center;line-height: 56px;color: #fff;font-size: 16px;}
-
-
- button.app-footer-btn-max{height:40px;line-height: 40px;width:calc(90% - 115px);text-align: center;font-size: 15px;color:#ffffff;font-weight: 700;background:linear-gradient(180deg,#f8b52b 0%,#f2861f 100%);border-radius:10px;}
- button.app-footer-btn-max.no-buy{height:40px;line-height: 40px;width:calc(90% - 115px);text-align: center;font-size: 15px;color:#ffffff;font-weight: 700;background:rgba(0,0,0,0.5);border-radius:10px;}
-
-
- /* 属性弹窗 */
- .pop-prop{position: fixed; width: 100%; height: 100%; top: 0; left: 0; z-index: 999;}
- .pop-prop-body{position:absolute; bottom: 0; width: 100%; background: #fff; border-radius: 8px 8px 0 0;}
- .pop-prop-close{height:40px;width:40px;position: absolute;top:0px;right:0px;}
- .pop-prop-close image{ width: 20px; height: 20px;}
- /* 弹窗 */
- button.app-foot-btn{height:40px;line-height: 40px;width:100%;text-align: center;font-size: 14px;color:#ffffff;font-weight: 400;
- background:#fd3b39;border-radius: 20px;}
- .pop-win{position: fixed; width: 100%; height: 100%; top: 0; left: 0; z-index: 9;}
- .pop-bg{ position: absolute; top: 0; left: 0; background: rgba(0,0,0,0.5); width: 100%; height: 100%;}
- .pop-win-inner{ position:absolute; bottom: 0; width: 100%; background: #fff; border-radius: 8px 8px 0 0;}
- .pop-win-body{ padding: 15px;}
- .pop-win-bg image{ width: 80px; height: 80px;}
- .pop-win-lg{ margin-left: 8px; width: calc(100vw - 138px );}
- .pop-win-lg-title{ font-size: 14px; color:#333333;}
- .pop-win-log-price{ font-size: 20px; color:#fd3b39;font-weight: 700;}
- .pop-win-log-price text{ font-size: 14px;font-weight:normal}
- .pop-win-close image{ width: 20px; height: 20px;}
- .pop-br{ height: 1px; background: #F1F1F1; margin: 10px 0;}
- .pop-win .sku{ margin: 8px 0;}
- .pop-win .sku-name{ font-size:14px;color:#333333}
- .pop-win .sku-value{ margin:10px 0;}
- .pop-win .sku-value button{border-radius: 10px; background: #eeeeee;color:#333333; padding: 10px; margin-right: 6px;font-size: 12px;margin-bottom: 10px;}
- .pop-win .buy{ margin-top: 32px; font-size: 14px;}
- button.buy-ad-btn{ width: 60upx; height: 60upx; color: #333; font-size: 20px; line-height: 48upx; text-align: center; background: #F6F6F6; border: 1px solid #CFCFCF; border-radius: 3px;}
- button.buy-ad-btn.jdd{ border-radius:3px 0 0 3px;}
- button.buy-ad-btn.add{ border-radius:0px 3px 3px 0px;}
- .buy-input{ border-top: 1px solid #CFCFCF; text-align: center; color: #333333; font-size: 12px;border-bottom: 1px solid #CFCFCF; height: 56upx; width: 100upx;}
- .sku-value button.active{color: #ffffff;background: #fd3b39;}
- .pop-win-kc{ font-size: 12px; color: #666666;}
- .pop-win-xz{ font-size: 12px;}
- </style>
- <template>
- <view class="m-app">
- <view class="app-header" :class="topShow ? 'app-header-bg' : ''">
- <view class="top-bar" :style="'height:' + barHeight + 'px'"></view>
- <view class="mp-padding fx-r fx-bc" >
- <view class="mp-title">
- <button class="nt item-back-btn fx-r fx-bc fx-ac" @tap="tapBack">
- <image src="/static/img/icon_item_back.png"></image>
- </button>
- <text>{{data.title}}</text>
- </view>
- </view>
- </view>
- <scroll-view class="mid-body clearfix" scroll-y="true" @scrolltolower="loadMoreData" @scroll="tapScroll">
- <view class="item-swiper">
- <swiper autoplay='true' @change="tapSwiperChange" indicator-dots="true" indicator-color='rgba(255,255,255,.3)' indicator-active-color='rgba(255,255,255,1)'>
- <swiper-item @tap="tapPhone('img',index)" v-for="(item,index) in data.imgs">
- <image class="swiper-item-img" :src="item" mode="aspectFill"></image>
- </swiper-item>
- </swiper>
- <view v-if="data.is_stepinto == 1" style="background: #333; color: #FFF; border-radius: 4px;font-size: 10px; margin-left: 4px;padding: 0px 4px;position: absolute;bottom: 10px;left: 10px;">跨境产品</view>
- <view class="swiper-count fx-r fx-bc"><text>{{swiperCurrent+1}}</text><text>/{{data.imgs.length?data.imgs.length:''}}</text></view>
- </view>
-
-
-
- <!-- 商品信息 -->
- <view class="goods-info">
- <view class="price-info fx-r fx-bc">
- <view class="price" v-if="sysData.is_audit == 0"><text>¥积分</text>{{ data.commission }}</view>
- <view class="price" v-else><text>¥参考价</text>{{ data.commission }}</view>
- </view>
- <view class="title">{{data.title}}</view>
- <view class="foot fx-r">
- <view class="address fx-r fx-bc">
- <image class="add-icon" src="/static/img/shop-address.png"></img>
- <text v-if="data.freight > 0">快递:{{data.freight}}</text>
- <text v-else>免邮费</text>
- </view>
- <view class="fx-g1"></view>
- <view class="sales">销量 {{utils.sales(data.sales)}}</view>
- </view>
-
-
- </view>
-
-
-
-
-
- <view class="item-prop">
- <view class="item-prop-list fx-r fx-bc">
- <view class="item-prop-title">选择</view>
- <button class="nt item-prop-btn fx-r fx-bc" @tap="tapCart">
- <text class="shenlueStyle" v-if="selData.skuStr == ''">选择商品规格</text>
- <text class="shenlueStyle" v-if="selData.skuStr != ''">{{selData.skuStr}}</text>
- <image src="/static/img/ic_next.png"></image>
- </button>
- </view>
-
- </view>
- <!-- 商品详情 -->
- <view class="item-desc">
- <view class="item-desc-title fx-r fx-bc fx-ac">
- <text class="desc-title-left"></text>
- <text class="desc-title">详情</text>
- <text class="desc-title-right"></text>
- </view>
- <view class="item-desc-img">
- <image @tap="tapPhone('descImg',index)" mode="widthFix" :src="item" v-for="(item,index) in data.imgDesc" />
-
- </view>
- </view>
- </scroll-view>
- <!-- app底部 -->
- <view class="app-footer fx-r fx-bc" v-if="sysData.is_audit == 0">
- <button @tap="tapBuy" v-if="data.isShow == 1" class="nt app-footer-btn bg-buy">立即兑换</button>
- <button v-if="data.isShow == 0" class="nt app-footer-btn-max no-buy">已下架</button>
- </view>
- <view class="app-footer fx-r fx-bc" v-else>
- <button @tap="tapXu" class="nt app-footer-btn bg-buy">询价</button>
- </view>
- <!-- 属性规格弹窗 -->
- <view class="pop-prop" v-if="isProp">
- <view class="pop-bg" @tap="tapPopClose"></view>
- <view class="pop-prop-body">
- <view class="pop-prop-close fx-r fx-bc fx-ac" @tap="tapPopClose">
- <image src="/static/img/m_close.png"></image>
- </view>
- <view class="item-service" v-if="data.inputPids.length > 0">
- <view class="item-service-list fx-r" v-for="(item,index) in data.inputPids">
- <view class="item-service-title">{{item.name}}:</view>
- <view class="item-service-val">{{item.value}}</view>
- </view>
- </view>
- </view>
- </view>
- <!-- 购买弹窗 -->
- <view class="pop-win" v-if="isShow">
- <view class="pop-bg" @tap="tapPopClose"></view>
- <view class="pop-win-inner">
- <view class="pop-win-body">
- <view class="fx-r">
- <view class="pop-win-bg">
- <image @tap="tapPhone2" :src="selData.img"></image>
- </view>
- <view class="pop-win-lg">
- <view class="pop-win-lg-title">{{data.title}}</view>
- <view class="pop-win-log-price"><text>¥</text>{{selData.commission}}</view>
- <view class="pop-win-kc">库存:{{selData.proCount}}件</view>
- <view class="pop-win-xz" v-if="selData.skuStr != ''">已选:{{selData.skuStr}}</view>
- </view>
- <view class="pop-win-close" @tap="tapPopClose">
- <image src="/static/img/m_close.png"></image>
- </view>
- </view>
-
- <!--选择属性-->
- <view class="pop-br"></view>
-
- <view>
- <view class="sku" v-for="(item,index) in data.sku.skuValue">
- <view class="sku-name">{{item.name}}</view>
- <scroll-view scroll-y="true" style="max-height: 150px;">
- <view class="sku-value fx-r">
- <button @tap="tapSku(index,index2)" :class="(selData.sku[index] == index2) ? 'active' : ''" class="nt" v-for="(item2,index2) in item.data">{{item2.name}}</button>
- </view>
- </scroll-view>
- </view>
- </view>
-
-
- <view class="buy fx-r fx-bc fx-ac">
- <view class="fx-g1">数量</view>
- <view class="fx-r">
- <button @tap="tapAdCount(-1)" class="nt buy-ad-btn jdd">-</button>
- <input type="number" v-model="selData.count" @input="tapInput" class="buy-input"/>
- <button @tap="tapAdCount(1)" class="nt buy-ad-btn add">+</button>
- </view>
-
- <!-- <view class="fx-r" v-else>
- x{{ selData.count }}
- </view> -->
- </view>
-
- </view>
- <view class="fx-r" style="padding: 15px;">
- <button @tap="tapSubmit" class="nt app-foot-btn ">确定</button>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {mapState,mapMutations } from 'vuex';
- var idsValue = {};
- var buyType = "";
- export default {
- computed: mapState(['user','sysData']),
- data() {
- return {
- id : 0,//产品ID
- topShow:false,
- model:false,
- cartCount:0,//购物车数量
- swiperCurrent:0,
- barHeight:0,
- data:{
- inputPids:[],
- title : '加载中..',
- isLove:0,
- commission : 0,
- auctionPoint :0,
- price : 0,
- freight : 0,
- sales : 0,
- imgDesc:[],
- imgs:[],
- msgData:[]
- },
- selData:{//选择款数据
- count:1,
- },
- isShow:false,//弹出选择项目
- isProp:false//属性弹窗
- }
- },
- onLoad(option){
- this.id = option.id || 0;
- uni.setNavigationBarTitle({title:'加载中..'});
- this.barHeight = this.$device.statusBarHeight;
- this.initView();
- },
- methods: {
- ...mapMutations(['checkUserLogin']),
- /**
- * 加载更多
- * @param {Object} e
- */
- loadMoreData: function(e) {
- console.log(e)
- },
- /**
- * 下拉下载
- * @param {Object} e
- */
- tapScroll:function(e){
- let scrollTop=e.detail.scrollTop;
- if(scrollTop < 120 && this.topShow)
- this.topShow = false
- if(scrollTop > 120 && !this.topShow)
- this.topShow = true;
- return;
- },
- tapSwiperChange:function(ev){
- this.swiperCurrent = ev.detail.current;
- },
- /**
- * 输入值
- * @param {Object} ev
- */
- tapInput:function(ev){
- var value = ev.detail.value;
- if(value != '') {
- //this.selData.count = value;
- }
- },
- /**
- * 购物车数量添加
- * @param {Object} type
- */
- tapAdCount:function(type){
- var count = this.data.count;
- //添加
- if(type > 0) {
- if(type >= count) {
- this.utils.showAlert({title: '系统提示',content: '库存不足了!'});
- }
- this.selData.count ++;
- }
-
- //想减
- if(type < 0) {
- if(this.selData.count <= 1) {
- return;
- }
- this.selData.count--;
- }
- },
- /**
- * sku属性值
- * @param {Object} pid
- * @param {Object} vid
- */
- tapSku:function(pid,vid){
- this.$forceUpdate();
- this.selData.sku[pid] = vid;
- var idsAr = [],skuStrAr = [],isOverSku = true;
- for(var i in this.selData.sku) {
- if(this.selData.sku[i] < 0) {
- isOverSku = false;
- continue;
- }
- var skuValue = this.data.sku.skuValue[i];
- idsAr.push(skuValue.data[this.selData.sku[i]].id);
- skuStrAr.push(skuValue.name + ":" + skuValue.data[this.selData.sku[i]].name);
- }
-
- //是否未点选完毕
- if(!isOverSku) {
- return;
- }
-
- var ids = idsAr.join(':');
- idsValue = null;
- //遍历所需要的数据
- for(var i in this.data.sku.skuIds) {
- var d = this.data.sku.skuIds[i];
- if(d.skuId == ids) {
- idsValue = d;
- break;
- }
- }
- this.$forceUpdate();
- this.selData.skuIds = ids;
- this.selData.skuStr = skuStrAr.join(',');
- //idsValue数据
- if(idsValue != null) {
- this.selData.commission = idsValue.commission;
- this.selData.proCount = idsValue.count;
- if(idsValue.img == '') {
- this.selData.img = this.data.imgs[0];
- } else {
- this.selData.img = idsValue.img;
- }
- }
-
- },
-
- /**
- * 打开购物车
- */
- tapCart:function(){
- this.isShow = true;
- buyType = "cart";
- },
- /**
- *
- */
- tapBuy:function(){
- if(this.user == null) {
- uni.navigateTo({ url:"/pages/login/index"});
- return;
- }
- buyType = "buy";
- this.isShow = true;
- },
- //打开属性弹窗
- tapOpenProp:function(){
- this.isProp = true;
- },
- /**
- * 关闭弹出框
- */
- tapPopClose:function(){
- this.isShow = false;
- this.isProp = false;
- },
- /**
- * 选择数据
- */
- tapSubmit:function(){
- this.checkUserLogin({page:this});
- if(!this.utils.isDefine(this.user)) {
- uni.navigateTo({ url:"../login/login"});
- return;
- }
- this.submitPost();
- },
- /**
- * 提交数据
- */
- submitPost:function(){
-
- var that = this;
- var ids = this.selData.skuIds;
- var idsAr = this.selData.skuIds.split(':');
- var count = this.selData.count;
- //是否[有规格未选择]
- if(this.data.sku.skuValue.length > 0) {
- for(var i in this.data.sku.skuValue){
- var skuValue = this.data.sku.skuValue[i];
- var bool = false;
- for(var i1 in skuValue.data) {
- for(var i2 in idsAr) {
- if(idsAr[i2] == skuValue.data[i1].id) {
- bool = true;
- }
- }
- }
- if(!bool) {
- this.utils.showAlert({title: '系统提示',content: "请选择" + skuValue.name});
- return;
- }
- }
- }
- //判断数量是否超过最大值
- if(count > this.selData.maxCount) {
- this.utils.showAlert({title: '系统提示',content: "起订数量超过库存数量!"});
- return;
- }
-
- //购买
- if(buyType == 'buy') {
- var parm = [];
- parm.push({
- id : this.id,
- count : this.selData.count,
- skuIds : ids
- });
- console.log(parm);
- uni.navigateTo({url: "/pages/user/buy/balance?data=" + JSON.stringify(parm)});
- }
- },
- /**
- * 加入收藏成功
- */
- tapLove:function(){
- if(!this.utils.isDefine(this.user)) {
- uni.navigateTo({ url:"../login/login"});
- return;
- }
- var that = this;
- uni.showLoading({title: '加入收藏中..'});
- var post = {};
- post.id = this.id;
- post.type = this.data.isLove == 1 ? 0 : 1;
- this
- .request
- .post("userGoodsLover",post)
- .then(res=>{
- uni.hideLoading();
- if(res.code == 200) {
- that.$forceUpdate();
- if(post.type == 1)
- this.utils.Tip("收藏成功");
- else
- this.utils.Tip("取消成功");
- that.data.isLove = post.type;
- } else {
- this.utils.showAlert({title: '系统提示',content: res.msg});
- }
- })
- .catch(err=>{
- uni.hideLoading();
- this.utils.showAlert({title: '系统提示',content: "加入失败,请稍后在尝试"});
- });
- },
- /**
- * 获取配置数据
- */
- initView: function() {
- var that = this;
- uni.showLoading({title: '获取数据中..'});
- var post = {};
- post.id = this.id;
- this
- .request
- .post("goodsItem",post)
- .then(res=>{
- uni.hideLoading();
- if(res.code == 200) {
- this.data = res.data;
- console.log(this.data,'this.data')
- var sku = [];
- this.selData = {
- title : res.data.title,
- img : res.data.imgs[0],//图片
- commission : res.data.commission,//当前价格
- count : 1,//购物数量
- sku : sku,//点选SKU
- skuIds : "",//选择sku值
- proCount : res.data.count,//库存量
- skuStr : "",//已选的SKU
- };
- uni.setNavigationBarTitle({title:res.data.title});
- } else {
- this.utils.showAlert({title: '系统提示',content: res.msg});
- }
- })
- .catch(err=>{
- console.log(err);
- uni.hideLoading();
- this.utils.showAlert({title: '系统提示',content: "加载失败,重新点击尝试!"});
- });
-
- },
- /**
- * 打开详情
- * @param {Object} type
- * @param {Object} index
- */
- tapPhone:function(type,index){
- var ImgAr = [];
- if(type == 'img') {
- ImgAr = this.data.imgs;
- }
-
- if(type == 'descImg') {
- ImgAr = this.data.imgDesc;
- }
-
- uni.previewImage({
- current:index,
- urls:ImgAr
- });
- },
- /**
- * 打开其他主图2
- */
- tapPhone2:function(){
- var ImgAr = [this.selData.img];
- uni.previewImage({
- current:0,
- urls:ImgAr
- });
- },
- /**
- * 打开其他页面
- * @param {Object} ev
- */
- tapOpen: function(ev) {
- let url = ev.currentTarget.dataset.url;
- this.utils.navigateTo(url);
- },
- /**
- * 返回首页
- */
- tapHome:function(){
- uni.switchTab({
- url : "../index/index"
- });
- },
-
- /**
- * 返回上一页
- */
- tapBack: function() {
- uni.navigateBack({
- delta: 1
- });
- },
-
- /**
- * 打开评价图
- * @param {Object} index
- * @param {Object} index2
- */
- tapMsgImg:function(index,index2){
- var ImgAr = this.data.msgData[index].imgs;
- // #ifdef H5
- this.$wx.previewImage({
- current:index2,
- urls:ImgAr
- });
- // #endif
-
- // #ifndef H5
- uni.previewImage({
- current:index2,
- urls:ImgAr
- });
- // #endif
- },
-
- tapXu:function(){
-
- // #ifdef APP-PLUS
- this.$store.dispatch('permission/requestPermissions', 'CALL_PHONE').then(res => {
- console.log(res);
- if(res !== 1) return;
- uni.makePhoneCall({
- phoneNumber:"18967672398",
- fail:(res)=>{
- uni.showModal({content:JSON.stringify(res)});
- },
- complete:(xx) => {
-
- }
- });
- });
- return;
- // #endif
- uni.makePhoneCall({
- phoneNumber:"18967672398",
- fail:(res)=>{
- uni.showModal({content:JSON.stringify(res)});
- },
- complete:(xx) => {
-
- }
- });
- }
- }
- }
- </script>
|