调整购物车样式

This commit is contained in:
唐明明
2023-10-10 10:59:56 +08:00
parent 51a04d53ce
commit 4faf065c96
16 changed files with 269 additions and 75 deletions

View File

@@ -19,8 +19,15 @@ const payState = trade_id => req({
data: { trade_id } data: { trade_id }
}) })
// 宝付支付
const bfPay = data => req({
url: "payments/cashier_desk/baofu",
data
})
export default ({ export default ({
info, info,
wechatPay, wechatPay,
payState payState,
bfPay
}) })

View File

@@ -7,9 +7,9 @@ import { errInfo } from './err'
import { updToken } from './updateToken' import { updToken } from './updateToken'
// 正式地址 // 正式地址
const api = "https://api.xuanhuojk.com/api/" // const api = "https://api.xuanhuojk.com/api/"
// 测试地址 // 测试地址
// const api = "https://api.xhtest.douhuofalv.com/api/" const api = "https://api.xhtest.douhuofalv.com/api/"
const header = { const header = {
"Accept" : "application/json" "Accept" : "application/json"
} }

View File

@@ -40,7 +40,8 @@
"pages/refund/logs/logs", "pages/refund/logs/logs",
"pages/richText/richText", "pages/richText/richText",
"pages/bag/bag", "pages/bag/bag",
"pages/bag/bagConfirm/bagConfirm" "pages/bag/bagConfirm/bagConfirm",
"pages/store/store"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
@@ -80,8 +81,14 @@
"borderStyle": "white" "borderStyle": "white"
}, },
"requiredPrivateInfos": [ "requiredPrivateInfos": [
"chooseAddress" "chooseAddress",
"getFuzzyLocation"
], ],
"permission": {
"scope.getFuzzyLocation": {
"desc": "位置信息仅用于商品配送"
}
},
"style": "v2", "style": "v2",
"sitemapLocation": "sitemap.json" "sitemapLocation": "sitemap.json"
} }

View File

@@ -1,63 +1,68 @@
<view class="content"> <view class="content">
<!-- 工具栏 --> <block wx:if="{{isUser}}">
<view class="bag-header"> <!-- 工具栏 -->
<view class="bag-header-add-select"> <view class="bag-header">
<view class="checkbox allCheckbox"> <view class="bag-header-add-select">
<checkbox checked="{{allCheckbox}}" bindtap="allCheckbox"></checkbox> <view class="checkbox allCheckbox">
<checkbox checked="{{allCheckbox}}" bindtap="allCheckbox"></checkbox>
</view>
全选
</view> </view>
全选
</view> </view>
</view>
<!-- 购物袋 --> <!-- 购物袋 -->
<view class="bag-content" wx:if="{{bags.length > 0}}"> <view class="bag-content" wx:if="{{bags.length > 0}}">
<view class="bag-content-mall" wx:for="{{bags}}" wx:key="bagList" wx:for-item="bagList" wx:for-index="sellerIndex"> <view class="bag-content-mall" wx:for="{{bags}}" wx:key="bagList" wx:for-item="bagList" wx:for-index="sellerIndex">
<view class="bag-content-mall-name nowrap"> <view class="bag-content-mall-name nowrap">
<view class="checkbox sellerCheckbox"> <view class="checkbox sellerCheckbox">
<checkbox checked="{{bagList.shop.mallState}}" data-seller="{{sellerIndex}}" bindtap="sellerCheckbox"></checkbox> <checkbox checked="{{bagList.shop.mallState}}" data-seller="{{sellerIndex}}" bindtap="sellerCheckbox"></checkbox>
</view>
{{ bagList.shop.name }}
</view> </view>
{{ bagList.shop.name }} <view class="bag-content-mall-goods" wx:for="{{bagList.items}}" wx:key="mallGood" wx:for-index="goodsIndex">
</view> <view class="checkbox">
<view class="bag-content-mall-goods" wx:for="{{bagList.items}}" wx:key="mallGood" wx:for-index="goodsIndex"> <checkbox checked="{{item.state}}" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" bindtap="checkbox"></checkbox>
<view class="checkbox"> </view>
<checkbox checked="{{item.state}}" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" bindtap="checkbox"></checkbox> <image class="mall-good-cover" src="{{item.cover}}" mode="aspectFill"></image>
</view> <view class="mall-good-content">
<image class="mall-good-cover" src="{{item.cover}}" mode="aspectFill"></image> <view class="mall-good-title nowrap">{{item.name}}</view>
<view class="mall-good-content"> <view class="mall-good-value nowrap">{{item.sku_name}}</view>
<view class="mall-good-title nowrap">{{item.name}}</view> <view class="mall-good-price nowrap">
<view class="mall-good-value nowrap">{{item.sku_name}}</view> ¥{{item.price}}
<view class="mall-good-price nowrap"> <view class="mall-good-number">
¥{{item.price}} <view class="mall-good-number-btn" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" bindtap="goodsNumber" data-type="remove">-</view>
<view class="mall-good-number"> <input class="mall-good-number-input" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" value="{{item.qty}}" type="number" bindblur="goodsNumberInput"></input>
<view class="mall-good-number-btn" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" bindtap="goodsNumber" data-type="remove">-</view> <view class="mall-good-number-btn" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" bindtap="goodsNumber" data-type="plus">+</view>
<input class="mall-good-number-input" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" value="{{item.qty}}" type="number" bindblur="goodsNumberInput"></input> </view>
<view class="mall-good-number-btn" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" bindtap="goodsNumber" data-type="plus">+</view>
</view> </view>
</view> </view>
</view> <view class="mall-good-more" bindtap="actionSheet" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}">
<view class="mall-good-more" bindtap="actionSheet" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}"> <image src="/static/icons/bag_more_icon.png" mode="widthFix"></image>
<image src="/static/icons/bag_more_icon.png" mode="widthFix"></image> </view>
</view> </view>
</view> </view>
</view> </view>
</view>
<!-- 购物袋为空 --> <!-- 购物袋为空 -->
<view class="pack-center pages-hint" wx:else> <view class="pack-center pages-hint" wx:else>
<image src="/static/icons/carnull_icon.png"></image> <image src="/static/icons/carnull_icon.png"></image>
<view>购物袋中暂无任何商品</view> <view>购物袋中暂无任何商品</view>
</view> </view>
<!-- 用户未登录 --> <!-- 结算 -->
<view class="pack-center pages-loding" wx:if="{{!isUser}}"> <view class="bag-footer">
<view>未登录,无法获取您的购物车信息</view> <view class="bag-footer-price">合计<text>¥{{allPrice}}</text></view>
</view> <view class="bag-footer-rests">共计{{bagNumber}}件</view>
<button class="bag-footer-btn" size="mini" bindtap="bagOrder" disabled="{{bagOrderLoading}}" loading="{{bagOrderLoading}}">结算</button>
</view>
</block>
<!-- 结算 --> <block wx:else>
<view class="bag-footer"> <!-- 用户未登录 -->
<view class="bag-footer-price">合计<text>¥{{allPrice}}</text></view> <view class="pack-center pages-loding auth-login">
<view class="bag-footer-rests">共计{{bagNumber}}件</view> <view>您还未登录,无法查看您的购物车信息</view>
<button class="bag-footer-btn" size="mini" bindtap="bagOrder" disabled="{{bagOrderLoading}}" loading="{{bagOrderLoading}}">结算</button> <navigator class="auth-btn" url="/pages/login/index">登录</navigator>
</view> </view>
</block>
</view> </view>

View File

@@ -108,3 +108,7 @@
.checkbox checkbox .wx-checkbox-input{ background: white; border-radius: 50%; border:solid 3rpx #464854; height: 34rpx; width: 34rpx; } .checkbox checkbox .wx-checkbox-input{ background: white; border-radius: 50%; border:solid 3rpx #464854; height: 34rpx; width: 34rpx; }
.checkbox checkbox .wx-checkbox-input.wx-checkbox-input-checked{ background: #da2b54; border-color: #da2b54; } .checkbox checkbox .wx-checkbox-input.wx-checkbox-input-checked{ background: #da2b54; border-color: #da2b54; }
.checkbox checkbox .wx-checkbox-input.wx-checkbox-input-checked:before{ top: 18rpx; right: 5rpx; color: white; line-height: 34rpx; text-align: center; width: 36rpx; height: 36rpx; font-size:36rpx; } .checkbox checkbox .wx-checkbox-input.wx-checkbox-input-checked:before{ top: 18rpx; right: 5rpx; color: white; line-height: 34rpx; text-align: center; width: 36rpx; height: 36rpx; font-size:36rpx; }
/* 未登录 */
.auth-login{ text-align: center; font-size: 28rpx; color: gray; }
.auth-btn{ background: #da2b54; display: inline-block; width: 240rpx; height: 80rpx; line-height: 80rpx; border-radius: 40rpx; font-size: 32rpx; color: white; margin-top: 100rpx; }

View File

@@ -18,8 +18,9 @@ Page({
freight : '', // 运费 freight : '', // 运费
weight : '', // 重量 weight : '', // 重量
distribution : [ distribution : [
{ type: 0, title: "快递" }, { type: 0, title: "选择配送方式" },
{ type: 1, title: "自提" }, { type: 1, title: "快递" },
{ type: 2, title: "自提" },
], ],
distributionIndex: 0 distributionIndex: 0
}, },
@@ -28,11 +29,9 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
console.log(options.skuId)
this.setData({ this.setData({
skuId : options.skuId skuId : options.skuId
}) })
// 获取商品下单信息 // 获取商品下单信息
this.placeInfo(options.skuId); this.placeInfo(options.skuId);
}, },
@@ -80,6 +79,13 @@ Page({
* 商品确认下单 * 商品确认下单
*/ */
buyTap() { buyTap() {
if(this.data.distributionIndex == 0){
wx.showToast({
title: '请选择配送方式',
icon : 'none'
})
return
}
wx.showLoading({ wx.showLoading({
title: '下单中...', title: '下单中...',
mask : true mask : true
@@ -90,7 +96,6 @@ Page({
remark : '', remark : '',
delivery_type : this.data.distributionIndex delivery_type : this.data.distributionIndex
}).then(res => { }).then(res => {
wx.redirectTo({ wx.redirectTo({
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data)) url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data))
}) })

View File

@@ -1,6 +1,6 @@
<view class="borderBottom"> <view class="borderBottom">
<!-- 地址 --> <!-- 地址 -->
<view class="address" wx:if="{{distributionIndex == 0}}"> <view class="address" wx:if="{{distributionIndex == 1}}">
<navigator hover-class="none" url="/pages/site/index?type=goodsAddress&skuid={{skuId}}&qty={{goodsQty}}" class="address-cont" wx:if="{{address}}"> <navigator hover-class="none" url="/pages/site/index?type=goodsAddress&skuid={{skuId}}&qty={{goodsQty}}" class="address-cont" wx:if="{{address}}">
<view class="address-top"> <view class="address-top">
<view class="address-area"> <view class="address-area">
@@ -20,19 +20,21 @@
</view> </view>
<!-- 商品 --> <!-- 商品 -->
<view class="more-goods" wx:for="{{goodskData}}" wx:key="stockData"> <view class="more-goods-block">
<view class="more-name"> <view class="more-goods" wx:for="{{goodskData}}" wx:key="stockData">
<image src="/static/icons/shopIcon.png"></image>{{item.shop.name}} <view class="more-name">
</view> <image src="/static/icons/shopIcon.png"></image>{{item.shop.name}}
<view class="list-goods" wx:for="{{item.items}}" wx:key="items" wx:for-item="items"> </view>
<image class="list-goods-img" mode="aspectFill" src="{{items.cover ? items.cover : '/static/ls/1.jpg'}}"></image> <view class="list-goods" wx:for="{{item.items}}" wx:key="items" wx:for-item="items">
<view class="list-goods-cont"> <image class="list-goods-img" mode="aspectFill" src="{{items.cover ? items.cover : '/static/ls/1.jpg'}}"></image>
<view class="nowrap list-goods-name">{{items.title}}</view> <view class="list-goods-cont">
<view class="list-goods-text"> <view class="nowrap list-goods-name">{{items.title}}</view>
<text>购买数量</text> x{{items.qty}} <view class="list-goods-text">
</view> <text>购买数量</text> x{{items.qty}}
<view class="list-goods-parice"> </view>
¥<text>{{items.price}}</text> <view class="list-goods-parice">
¥<text>{{items.price}}</text>
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -47,6 +49,10 @@
</view> </view>
</picker> </picker>
</view> </view>
<!-- <navigator class="label-item" wx:if="{{distributionIndex == 1}}" url="/pages/store/store">
<view class="label-name">自提门店</view>
<view class="label-text">华鸿国际自提点<image class="label-picker-icon" src="/static/icons/arrow_more.png"></image></view>
</navigator> -->
</view> </view>
<!-- 规格 --> <!-- 规格 -->

View File

@@ -79,11 +79,16 @@ page {
} }
/* 商品 */ /* 商品 */
.more-goods { .more-goods-block{
background-color: #FFFFFF; background-color: #FFFFFF;
border-radius: 15rpx; border-radius: 15rpx;
} }
.more-goods {
border-bottom: solid 1rpx #f7f8f9;
}
.more-goods:last-child{
border-bottom: none;
}
.more-name { .more-name {
padding: 30rpx 30rpx 0; padding: 30rpx 30rpx 0;
box-sizing: border-box; box-sizing: border-box;

View File

@@ -75,8 +75,40 @@ Page({
loding: false loding: false
}) })
break; break;
case 'baofu':
this.baofuPay()
break;
} }
}, },
/**
* 宝付微信
*/
baofuPay(){
wx.login({
success: wxCode => {
// wx.getFuzzyLocation({
// success: locationRes => {
// let { latitude, longitude } = locationRes
let { code } = wxCode;
let data = {
order_type : this.data.modelType,
order_id : this.data.modelId,
code : code,
longitude : '171.21',
latitude : '22.33',
}
wx.$api.pay.bfPay(data).then(res => {
console.log(res)
}).finally(() => {
this.setData({
loding: false
})
})
// }
// })
}
})
},
/** /**
* 微信支付 * 微信支付
*/ */

View File

@@ -31,6 +31,13 @@
</view> </view>
<radio class="radio-radio" value="coin" color="#da2b54" checked="{{payType == 'coin'}}"/> <radio class="radio-radio" value="coin" color="#da2b54" checked="{{payType == 'coin'}}"/>
</label> </label>
<label class="radio-flex" wx:if="{{can.baofu == 1}}">
<view class="radio-text">
<image class="radio-icon" src="/static/pay/wechat.png"></image>
<text>微信支付(宝付)</text>
</view>
<radio class="radio-radio" value="baofu" color="#da2b54" checked="{{payType == 'baofu'}}"/>
</label>
</radio-group> </radio-group>
<view class="radio-lay" wx:if="{{loding}}"></view> <view class="radio-lay" wx:if="{{loding}}"></view>
</view> </view>

66
pages/store/store.js Normal file
View File

@@ -0,0 +1,66 @@
// pages/store/store.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

4
pages/store/store.json Normal file
View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "自提门店"
}

22
pages/store/store.wxml Normal file
View File

@@ -0,0 +1,22 @@
<view class="content">
<view class="store-city">当前所在城市:哈尔滨市</view>
<view class="store-title">请选择自提门店</view>
<view class="store-list">
<view class="store-item">
<view class="store-item-title">华鸿国际自提点</view>
<view class="store-item-address">黑龙江省哈尔滨市南岗区闽江路73号</view>
<view class="store-item-km">距离1.0KM</view>
</view>
<view class="store-item">
<view class="store-item-title">闽江路自提点</view>
<view class="store-item-address">黑龙江省哈尔滨市南岗区闽江路10号</view>
<view class="store-item-km">距离1.0KM</view>
</view>
<view class="store-item">
<view class="store-item-title">金马国际自提点</view>
<view class="store-item-address">黑龙江省哈尔滨市南岗区嵩山路1号嵩山路珠江路交口</view>
<view class="store-item-km">距离1.0KM</view>
</view>
</view>
</view>

17
pages/store/store.wxss Normal file
View File

@@ -0,0 +1,17 @@
/* 内容 */
.content{ background: #f7f8f9; min-height: 100vh; }
/* 所在城市 */
.store-city{ background: white; padding: 0 30rpx; line-height: 90rpx; font-size: 30rpx; }
/* 选择自提门店 */
.store-title{ background: #f7f8f9; padding: 20rpx 30rpx; font-size: 28rpx; color: gray; }
/* 自提点 */
.store-list{ padding: 20rpx 0; background-color: white; }
.store-item{ padding: 20rpx 30rpx; position: relative; padding-right: 200rpx; }
.store-item::after{ position: absolute; right: 0; bottom: 0; left: 30rpx; height: 1rpx; background: #ddd; content: " "; }
.store-item:last-child::after{ display: none; }
.store-item-title{ font-weight: bold; line-height: 50rpx; font-size: 32rpx; }
.store-item-address{ font-size: 28rpx; color: gray; line-height: 40rpx; }
.store-item-km{ position: absolute; right: 30rpx; font-size: 26rpx; color: gray; top: 50%; line-height: 40rpx; margin-top: -20rpx; }

View File

@@ -36,7 +36,7 @@
"checkInvalidKey": true, "checkInvalidKey": true,
"disableUseStrict": false, "disableUseStrict": false,
"useCompilerPlugins": false, "useCompilerPlugins": false,
"ignoreUploadUnusedFiles": true "ignoreUploadUnusedFiles": false
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"condition": {}, "condition": {},

View File

@@ -8,6 +8,13 @@
"condition": { "condition": {
"miniprogram": { "miniprogram": {
"list": [ "list": [
{
"name": "自提点",
"pathName": "pages/store/store",
"query": "",
"launchMode": "default",
"scene": null
},
{ {
"name": "购物车", "name": "购物车",
"pathName": "pages/bag/bag", "pathName": "pages/bag/bag",