main
fanfan 8 months ago
parent db53880497
commit 130c633330
  1. 25
      pages/goods/components/SkuPopup.vue
  2. 38
      pages/goods/seckillDetail.vue

@ -4,7 +4,8 @@
:addCartColor="appTheme.viceText" :addCartBackgroundColor="appTheme.viceBg" :addCartColor="appTheme.viceText" :addCartBackgroundColor="appTheme.viceBg"
:activedStyle="{ color: appTheme.mainBg, borderColor: appTheme.mainBg, backgroundColor: activedBtnBackgroundColor }" :activedStyle="{ color: appTheme.mainBg, borderColor: appTheme.mainBg, backgroundColor: activedBtnBackgroundColor }"
@open="openSkuPopup" @close="closeSkuPopup" @add-cart="addCart" @buy-now="buyNow" @num-change='numChange' @open="openSkuPopup" @close="closeSkuPopup" @add-cart="addCart" @buy-now="buyNow" @num-change='numChange'
@selected-old='selectedOld' buyNowText="立即购买" :maxBuyNum="maxBuyNum" :addressResult='addressResult' :stockValue='stockValue'/> @selected-old='selectedOld' buyNowText="立即购买" :maxBuyNum="maxBuyNum" :addressResult='addressResult'
:stockValue='stockValue' />
</template> </template>
<script> <script>
@ -24,6 +25,18 @@
}, },
emits: ['update:modelValue'], emits: ['update:modelValue'],
props: { props: {
goodSource: {
Type: String || Number,
default: 0
},
activeTimeId: {
Type: String || Number,
default: null
},
sharpGoodsId: {
Type: String || Number,
default: null
},
// //
modelValue: { modelValue: {
Type: Boolean, Type: Boolean,
@ -213,7 +226,7 @@
let that = this; let that = this;
let params = { let params = {
list: [{ list: [{
goods_id:selectShop.goods_id, goods_id: selectShop.goods_id,
num: selectShop.buy_num num: selectShop.buy_num
}], }],
province: that.addressResult ? that.addressResult.province : '江苏省', province: that.addressResult ? that.addressResult.province : '江苏省',
@ -281,14 +294,16 @@
this.onChangeValue(false); this.onChangeValue(false);
uni.$emit("onenPrice", selectShop) uni.$emit("onenPrice", selectShop)
return; return;
console.log(selectShop)
} }
// //
this.$navTo('pages/sureOrder/index', { this.$navTo('pages/sureOrder/index', {
mode: 'buyNow', mode: app.goodSource == 0 ? 'buyNow' : 'sharp',
goodsId: selectShop.goods_id, goodsId: selectShop.goods_id,
goodsSkuId: selectShop.goods_sku_id, goodsSkuId: selectShop.goods_sku_id,
goodsNum: selectShop.buy_num goodsNum: selectShop.buy_num,
goodSource: app.goodSource,
activeTimeId: app.activeTimeId,
sharpGoodsId: app.sharpGoodsId,
}) })
// //
this.onChangeValue(false) this.onChangeValue(false)

@ -371,7 +371,8 @@
<image :src="$picUrl+'/static/toTop.png?=1'"></image> <image :src="$picUrl+'/static/toTop.png?=1'"></image>
</view> </view>
<view v-if="isTodo"> <view v-if="isTodo">
<SkuPopup v-model="showSkuPopup" :skuMode="skuMode" :goods="goods" :addressResult='addressResult' <SkuPopup v-model="showSkuPopup" :skuMode="skuMode" :activeTimeId='activeTimeId'
:sharpGoodsId='sharpGoodsId' :goodSource='1' :goods="goods" :addressResult='addressResult'
@getSku='onGetSku' @addCart="onAddCart" /> @getSku='onGetSku' @addCart="onAddCart" />
</view> </view>
<setPrice ref="setRange" @getprice="getprice" /> <setPrice ref="setRange" @getprice="getprice" />
@ -428,13 +429,13 @@
openDialog: false, openDialog: false,
goodsId: '', goodsId: '',
activeTimeId: '', activeTimeId: '',
sharpGoodsId:'', sharpGoodsId: '',
goods: { goods: {
skuList: [] skuList: []
}, },
suggestGoodsList: [], suggestGoodsList: [],
userInfo: {}, userInfo: {},
activeInfo:{}, activeInfo: {},
addressList: [], addressList: [],
addressInfo: {}, addressInfo: {},
serveList: [], serveList: [],
@ -467,14 +468,11 @@
} }
}, },
onLoad(options) { onLoad(options) {
console.log(options)
const that = this; const that = this;
that.options = options; that.options = options;
let result = uni.getStorageSync("addressResult") let result = uni.getStorageSync("addressResult")
this.addressResult = result ? result.address_component : this.addressResult this.addressResult = result ? result.address_component : this.addressResult
this.isPre = options.isPre ? options.isPre : null this.isPre = options.isPre ? options.isPre : null
// query
// this.onRecordQuery(options)
const scene = getSceneData(options) const scene = getSceneData(options)
this.sharpGoodsId = options.sharpGoodsId ? parseInt(options.sharpGoodsId) : parseInt(scene.sharpGoodsId) this.sharpGoodsId = options.sharpGoodsId ? parseInt(options.sharpGoodsId) : parseInt(scene.sharpGoodsId)
this.activeTimeId = options.activeTimeId ? options.activeTimeId : null this.activeTimeId = options.activeTimeId ? options.activeTimeId : null
@ -490,17 +488,7 @@
that.selectShop.price = that.selectShop.price / 100 that.selectShop.price = that.selectShop.price / 100
}) })
}, },
onShow() { onShow() {},
if (uni.getStorageSync('AccessToken')) {
this.getAddressList()
this.isLogin = true;
this.userInfo = uni.getStorageSync('userInfo');
} else {
this.isLogin = false;
this.userInfo = {}
}
console.log(this.userInfo)
},
onPageScroll(e) { onPageScroll(e) {
if (e.scrollTop <= 200) { // true if (e.scrollTop <= 200) { // true
this.isTop = false this.isTop = false
@ -774,6 +762,7 @@
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
address.defaultId().then(res => { address.defaultId().then(res => {
if (res.status == 200) { if (res.status == 200) {
that.getGoodsStockInfor();
for (var i = 0; i < that.addressList.length; i++) { for (var i = 0; i < that.addressList.length; i++) {
if (res.data.defaultId == that.addressList[i].address_id) { if (res.data.defaultId == that.addressList[i].address_id) {
that.addressInfo = that.addressList[i]; that.addressInfo = that.addressList[i];
@ -788,8 +777,6 @@
this.addressResult.district = this.addressInfo.region ? this.addressInfo this.addressResult.district = this.addressInfo.region ? this.addressInfo
.region.region : (this.addressResult ? this.addressResult.district : .region.region : (this.addressResult ? this.addressResult.district :
'江苏省'); '江苏省');
that.getGoodsStockInfor();
} }
} }
}) })
@ -837,7 +824,6 @@
} }
this.skuMode = skuMode this.skuMode = skuMode
this.showSkuPopup = true this.showSkuPopup = true
console.log("choseSku", this.goods)
}, },
copyNum(msg) { copyNum(msg) {
uni.setClipboardData({ uni.setClipboardData({
@ -882,8 +868,8 @@
SharpGoodsApi.detail(that.activeTimeId, that.sharpGoodsId) SharpGoodsApi.detail(that.activeTimeId, that.sharpGoodsId)
.then(result => { .then(result => {
let info = result.data.goods; let info = result.data.goods;
that.activeInfo=result.data.active that.activeInfo = result.data.active
that.goodsId=info.goods_id that.goodsId = info.goods_id
that.goods.skuList = []; that.goods.skuList = [];
that.godds = {} that.godds = {}
info.goods_images1 = [] info.goods_images1 = []
@ -927,6 +913,14 @@
} }
} }
// id // id
if (uni.getStorageSync('AccessToken')) {
this.getAddressList()
this.isLogin = true;
this.userInfo = uni.getStorageSync('userInfo');
} else {
this.isLogin = false;
this.userInfo = {}
}
this.getSuggestGoods() this.getSuggestGoods()
this.getServeList() this.getServeList()
this.cityInfo = uni.getStorageSync("cityInfo"); this.cityInfo = uni.getStorageSync("cityInfo");

Loading…
Cancel
Save