mirror of
https://gitee.com/zongzhige/shopxo-uniapp.git
synced 2026-07-07 06:15:24 +08:00
立即购买支持多商品
This commit is contained in:
@ -244,7 +244,8 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
const app = getApp();
|
||||
import base64 from '../../common/js/lib/base64.js';
|
||||
import componentPopup from "../../components/popup/popup";
|
||||
import componentNoData from "../../components/no-data/no-data";
|
||||
import componentTimeSelect from "../../components/time-select/time-select";
|
||||
@ -306,11 +307,16 @@
|
||||
},
|
||||
props: {},
|
||||
|
||||
onLoad(params) {
|
||||
//params['data'] = '{"buy_type":"goods","goods_id":"1","stock":"1","spec":"[]"}';
|
||||
if ((params.data || null) != null && app.globalData.get_length(JSON.parse(decodeURIComponent(params.data))) > 0) {
|
||||
onLoad(params) {
|
||||
// params.data 参数 urlencode(base64_encode(json字符串))
|
||||
// buy_type 下单类型(goods 立即购买、cart 购物车)
|
||||
// goods_data 下单商品urlencode(base64_encode(json字符串[{goods_id,stock,spec}]))
|
||||
// params['data'] = '{"buy_type":"goods","goods_data":"W3siZ29vZHNfaWQiOiI5Iiwic3RvY2siOjEsInNwZWMiOlt7InR5cGUiOiLpopzoibIiLCJ2YWx1ZSI6IueyieiJsiJ9LHsidHlwZSI6IuWwuueggSIsInZhbHVlIjoiTCJ9XX1"}';
|
||||
// ids 购物车主键ids
|
||||
if ((params.data || null) != null) {
|
||||
console.log(params.data);
|
||||
this.setData({
|
||||
params: JSON.parse(decodeURIComponent(params.data)),
|
||||
params: JSON.parse(base64.decode(decodeURIComponent(params.data))),
|
||||
plugins_points_status: app.globalData.get_config('plugins_base.points.data.is_default_use_points', null) == 1
|
||||
});
|
||||
|
||||
@ -358,7 +364,7 @@
|
||||
if (this.params == null) {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '订单信息有误'
|
||||
data_list_loding_msg: '商品信息有误'
|
||||
});
|
||||
uni.stopPullDownRefresh();
|
||||
return false;
|
||||
|
||||
@ -200,6 +200,11 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 组合搭配 -->
|
||||
<block v-if="plugins_binding_data != null">
|
||||
<component-binding-list :propData="plugins_binding_data" :propLabel="plugins_label_data"></component-binding-list>
|
||||
</block>
|
||||
|
||||
<!-- 门店 -->
|
||||
<view v-if="plugins_realstore_data != null && plugins_realstore_data.length > 0" class="plugins-realstore-container">
|
||||
<view class="spacing-nav-title">
|
||||
@ -566,6 +571,7 @@
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import base64 from '../../common/js/lib/base64.js';
|
||||
import componentQuickNav from "../../components/quick-nav/quick-nav";
|
||||
import componentPopup from "../../components/popup/popup";
|
||||
import componentBadge from "../../components/badge/badge";
|
||||
@ -576,6 +582,7 @@
|
||||
import componentOnlineService from "../../components/online-service/online-service";
|
||||
import componentRealstoreList from "../../components/realstore-list/realstore-list";
|
||||
import componentShopList from "../../components/shop-list/shop-list";
|
||||
import componentBindingList from "../../components/binding-list/binding-list";
|
||||
|
||||
var common_static_url = app.globalData.get_static_url('common');
|
||||
var system_info = app.globalData.get_system_info() || {};
|
||||
@ -695,7 +702,9 @@
|
||||
plugins_chat_data: null,
|
||||
// 门店插件
|
||||
plugins_realstore_data: null,
|
||||
popup_realstore_status: false
|
||||
popup_realstore_status: false,
|
||||
// 组合搭配插件
|
||||
plugins_binding_data: null
|
||||
};
|
||||
},
|
||||
|
||||
@ -709,7 +718,8 @@
|
||||
componentBottomLine,
|
||||
componentOnlineService,
|
||||
componentRealstoreList,
|
||||
componentShopList
|
||||
componentShopList,
|
||||
componentBindingList
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
@ -866,6 +876,7 @@
|
||||
plugins_intellectstools_data: data.plugins_intellectstools_data || null,
|
||||
plugins_chat_data: data.plugins_chat_data || null,
|
||||
plugins_realstore_data: data.plugins_realstore_data || null,
|
||||
plugins_binding_data: data.plugins_binding_data || null
|
||||
};
|
||||
// 如果已默认开启弹窗,库存为0则不开启
|
||||
if(this.popup_status == 1 && goods.inventory <= 0) {
|
||||
@ -1579,13 +1590,15 @@
|
||||
case 'buy':
|
||||
// 进入订单确认页面
|
||||
var data = {
|
||||
"buy_type": "goods",
|
||||
"goods_id": this.goods.id,
|
||||
"stock": this.buy_number,
|
||||
"spec": JSON.stringify(spec)
|
||||
buy_type: "goods",
|
||||
goods_data: encodeURIComponent(base64.encode(JSON.stringify([{
|
||||
goods_id: this.goods.id,
|
||||
stock: this.buy_number,
|
||||
spec: spec
|
||||
}])))
|
||||
};
|
||||
uni.navigateTo({
|
||||
url: '/pages/buy/buy?data=' + encodeURIComponent(JSON.stringify(data))
|
||||
url: '/pages/buy/buy?data=' + encodeURIComponent(base64.encode(JSON.stringify(data)))
|
||||
});
|
||||
this.popup_close_event();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user