完成订单页面

This commit is contained in:
itgaojian163 2023-02-18 21:02:06 +08:00
parent 9288ba632a
commit 7bbad266ba
26 changed files with 1224 additions and 106 deletions

View File

@ -38,23 +38,22 @@
"pages/myVolunteerTeam/myVolunteerTeam",
"pages/myVolunteerActivity/myVolunteerActivity",
"pages/serviceActivityDetail/serviceActivityDetail",
"pages/shop/shopcategory",
"subpages/goodsdetail/goodsdetail",
"subpages/goodscar/goodscar",
"subpages/goodsaddress/goodsaddress",
"subpages/goodsorder/goodsorder",
"subpages/addshopaddress/addshopaddress",
"subpages/editshopaddress/editshopaddress",
"subpages/orderconfirm/orderconfirm"
"pages/shop/shopcategory"
],
"subPackages": [
{
"root": "subpages/goodslist",
"subPackages": [{
"root": "subpages/",
"pages": [
"goodslist"
"goodslist/goodslist",
"goodsdetail/goodsdetail",
"goodscar/goodscar",
"goodsaddress/goodsaddress",
"goodsorder/goodsorder",
"addshopaddress/addshopaddress",
"editshopaddress/editshopaddress",
"orderconfirm/orderconfirm",
"addresschoose/addresschoose"
]
}
],
}],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#9F1512",
@ -65,8 +64,7 @@
"color": "#BBBBBB",
"borderStyle": "black",
"selectedColor": "#000000",
"list": [
{
"list": [{
"pagePath": "pages/index/index",
"iconPath": "images/index.png",
"text": "首页",
@ -99,7 +97,9 @@
]
},
"usingComponents": {
"page-loading": "/components/loading/pageloading"
"page-loading": "/components/loading/pageloading",
"page-empty": "/components/empty/empty",
"loading-more": "/components/loadmore/loading-more"
},
"permission": {
"scope.userLocation": {

23
components/empty/empty.js Normal file
View File

@ -0,0 +1,23 @@
// components/empty/empty.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,5 @@
<!--components/empty/empty.wxml-->
<view class="data-empty">
<image src="/images/ic_empty_data.png" mode="scaleToFill"></image>
<text class="hint">暂无数据</text>
</view>

View File

@ -0,0 +1,24 @@
/* components/empty/empty.wxss */
.data-empty {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
align-self: center;
position: fixed;
top: 50%;
left: 50%;
transform: translateX(-50%)translateY(-50%);
}
.data-empty image {
width: 180rpx;
height: 120rpx;
}
.data-empty .hint {
margin-top: 30rpx;
font-size: 32rpx;
}

View File

@ -5,11 +5,12 @@
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 1);
/* background: rgba(255, 255, 255, 1); */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 99;
}
.page-loading-box image {

View File

@ -0,0 +1,30 @@
// components/loadmore/loading-more.js
Component({
/**
* 组件的属性列表
*/
properties: {
isShowloading: true,
loadingTxt: "加载中..."
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
},
observers: {
'isShowloading,loadingTxt': function (ss, sss) {
console.log(ss)
console.log(sss)
}
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,5 @@
<!--components/loadmore/loading-more.wxml-->
<view class="loading-box">
<image src="/images/loading.gif" wx:if="{{isShowloading}}"></image>
<view class="loading-content">{{loadingTxt}}</view>
</view>

View File

@ -0,0 +1,20 @@
/* components/loadmore/loading-more.wxss */
.loading-box {
width: 100%;
height: 80rpx;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
font-size: 35rpx;
}
.loading-box image {
width: 40rpx;
height: 40rpx;
}
.loading-content {
margin-left: 20rpx;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
images/ic_shop_car_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

View File

@ -13,7 +13,7 @@
</view>
<view class="category-thrid-box" wx:if="{{item.subList.length > 0}}">
<view class="category-thrid-item" wx:for="{{item.subList}}" wx:for-index="i" wx:for-item="it" wx:key="i" bindtap="goList" data-id="{{it.id}}">
<image src="{{it.icon==''? '/subpages/images/ic_goods_type_default.png':imgUrl+it.icon}}"></image>
<image src="{{it.icon==''? '/images/ic_goods_type_default.png':imgUrl+it.icon}}"></image>
<view>{{it.name}}</view>
</view>
</view>
@ -24,7 +24,7 @@
</view>
</scroll-view>
<view class="car-box" bindtap="showCar">
<image src="/subpages/images/ic_shop_car_icon.png" mode="scaleToFill"></image>
<image src="/images/ic_shop_car_icon.png" mode="scaleToFill"></image>
<text>购物车</text>
</view>
</view>

View File

@ -0,0 +1,147 @@
// subpages/goodsaddress/goodsaddress.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
token: '',
list: [],
hidePageLoading: false,
defaultAddress: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
var _self = this;
_self.getToken().then(result => {
_self.getList();
})
},
getToken() {
var self = this;
return new Promise(resolve => {
wx.getStorage({
key: 'token',
success(res) {
self.setData({
token: res.data
})
return resolve();
}
})
})
},
//获取列表
getList() {
var _self = this
var header = {
headers: {
token: _self.data.token
}
};
app.restAjax.get(app.restAjax.path('{shopUrl}/app/shopaddress/list', [app.shopUrl]), null, header, function (code, data) {
console.log(data);
_self.setData({
list: data,
hidePageLoading: true
})
}, function (code, data) {
app.dialog.msg(data.msg);
_self.setData({
hidePageLoading: true
})
}, function () {
wx.hideLoading();
_self.setData({
hideLoading: true
})
})
},
doRefresh() {
this.setData({
list: []
})
this.getList();
},
doEdit(e) {
var id = e.currentTarget.dataset.id;
wx.navigateTo({
url: '/subpages/editshopaddress/editshopaddress?id=' + id,
})
},
doDel(e) {
var id = e.currentTarget.dataset.id;
var item = e.currentTarget.dataset.item;
var _self = this;
if (1 == item.shopAddressDefault) {
wx.showToast({
icon: 'none',
title: '请先设置默认地址',
})
return;
}
wx.showModal({
title: '警告',
content: '确定要删除该收货地址吗?',
complete: (res) => {
if (res.confirm) {
app.dialog.loading("删除中...")
app.restAjax.delete(app.restAjax.path('{shopUrl}/app/shopaddress/remove/{ids}', [app.shopUrl, id]), null, {
headers: {
token: _self.data.token
}
}, function (code, data) {
wx.hideLoading()
if (code == 200) {
app.dialog.msg("删除成功")
_self.getList()
}
}, function (code, data) {
app.dialog.msg(data.msg)
});
}
}
})
},
doSetDefault(e) {
var _self = this;
app.dialog.loading('设置中')
var id = e.currentTarget.dataset.id
var index = e.currentTarget.dataset.index
var item = e.currentTarget.dataset.item
app.restAjax.put(app.restAjax.path('{shopUrl}/app/shopaddress/updatedefault/{shopAddressId}', [app.shopUrl, id]), null, {
headers: {
token: _self.data.token
}
}, function (code, data) {
wx.hideLoading();
if (code == 200) {
app.dialog.msg('设置成功')
}
_self.setData({
list: [],
defaultAddress: item
})
_self.getList();
}, function (code, data) {
console.log(data)
wx.hideLoading();
app.dialog.msg(data.msg)
})
},
addAddress() {
var _self= this;
var pages = getCurrentPages();
var prePage = pages[pages.length - 2]
prePage.setData({
addressBean: _self.data.defaultAddress
})
wx.navigateBack()
},
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,20 @@
<!--subpages/goodsaddress/goodsaddress.wxml-->
<scroll-view wx:if="{{hidePageLoading}}" style="min-height: 600rpx;" scroll-y="true">
<view wx:if="{{list.length>0}}" class="content-box">
<view class="address-item" wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<image class="check" src="/subpages/images/ic_cb_checked.png" mode="scaleToFill" wx:if="{{item.shopAddressDefault=='1'}}"></image>
<view class="address-content" bindtap="doSetDefault" data-item="{{item}}" data-id="{{item.shopAddressId}}" data-index="{{index}}">
<view class="address-area">{{item.areaName}}</view>
<view class="address-name">{{item.shopAddressContent}}</view>
<view class="address-phone">{{item.shopAddressName}} {{item.shopAddressPhone}}</view>
</view>
<!-- <view class="address-control-box">
<image src="/subpages/images/ic_edit_icon.png" mode="scaleToFill" class="edit-icon" bindtap="doEdit" data-id="{{item.shopAddressId}}"></image>
<image src="/images/delete.png" mode="scaleToFill" class="del-icon" bindtap="doDel" data-id="{{item.shopAddressId}}" data-item="{{item}}"></image>
</view> -->
</view>
</view>
<empty-page wx:else></empty-page>
<view class="bottom-btn" bindtap="addAddress">确认</view>
</scroll-view>
<page-loading wx:else></page-loading>

View File

@ -0,0 +1,106 @@
/* subpages/goodsaddress/goodsaddress.wxss */
.empty-box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%)translateY(-50%);
}
.empty-box image {
width: 140rpx;
height: 100rpx;
}
.empty-box text {
margin-top: 20rpx;
font-size: 32rpx;
}
.content-box {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 95%;
padding: 20rpx;
border-radius: 10rpx;
box-shadow: 5rpx 5rpx 20rpx #f2f2f2;
margin: 20rpx 20rpx 100rpx 0rpx;
}
.address-item {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
padding: 10rpx;
border-bottom: 1rpx solid #f2f2f2;
width: 100%;
}
.address-item .check {
width: 48rpx;
height: 48rpx;
}
.address-content {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
width: 100%;
max-width: 100%;
margin-left: 20rpx;
}
.address-area {
font-size: 32rpx;
}
.address-name {
font-size: 40rpx;
margin: 10rpx 0rpx;
}
.address-phone {
font-size: 32rpx;
}
.address-control-box {
display: flex;
width: 80rpx;
flex-direction: column;
justify-content: space-around;
align-items: center;
}
.edit-icon {
width: 48rpx;
height: 48rpx;
}
.del-icon {
width: 48rpx;
height: 48rpx;
margin-top: 20rpx;
}
.bottom-btn {
height: 80rpx;
background: #9f1512;
border-radius: 10rpx;
text-align: center;
color: white;
position: fixed;
bottom: 0rpx;
left: 0rpx;
line-height: 80rpx;
margin: 0rpx 20rpx 10rpx 20rpx;
width: 95%;
}

View File

@ -35,6 +35,26 @@ Page({
}
},
onShow() {
var _self = this;
try {
var value = wx.getStorageSync('carlist');
console.log(value)
if (value) {
_self.setData({
carList: value,
isHidePageloading: true
})
_self.countPrice()
} else {
_self.setData({
isHidePageloading: true
})
}
} catch (e) {
}
},
delGoods(e) {
var _self = this;
wx.showModal({
@ -101,8 +121,17 @@ Page({
})
},
toConfirmOrder() {
var _self = this;
if (_self.data.totalPrice > 0) {
wx.navigateTo({
url: '/subpages/orderconfirm/orderconfirm',
})
} else {
wx.showToast({
icon: 'none',
title: '请选择要购买的商品',
})
}
}
})

View File

@ -1,6 +1,6 @@
<!--subpages/goodscar/goodscar.wxml-->
<scroll-view wx:if="{{isHidePageloading}}">
<view wx:if="{{carList.length>0}}">
<view wx:if="{{carList.length>0}}" style="margin-bottom: 120rpx;">
<block wx:for="{{carList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class="goods-item">
<image class="check" src="{{item.isCheck? '/subpages/images/ic_cb_checked.png':'/subpages/images/ic_cb_unchecked.png'}}" mode="scaleToFill"></image>
@ -28,16 +28,7 @@
</view>
</view>
</block>
</view>
<view class="category-empty" wx:else>
<image src="../../images/ic_empty_data.png" mode="scaleToFill"></image>
<text class="hint">暂无数据</text>
</view>
</scroll-view>
<page-loading wx:else></page-loading>
<view class="bottom-box">
<view class="bottom-box">
<view class="bottom-content">
<view class="bottom-price">
<view class="price-icon">¥</view>
@ -45,4 +36,9 @@
</view>
<view class="car-add" bindtap="toConfirmOrder">去结算</view>
</view>
</view>
</view>
</view>
<page-empty wx:else></page-empty>
</scroll-view>
<page-loading wx:else></page-loading>

View File

@ -41,6 +41,9 @@ Page({
'keywords': _self.data.keywords
};
app.restAjax.get(app.restAjax.path('{shopUrl}/app/shopgoods/solrrelease', [app.shopUrl]), info, null, function (code, data) {
_self.setData({
hidePageLoading: true
})
if (data.rows.length == 0) {
app.dialog.msg('暂无数据');
return;

View File

@ -1,66 +1,294 @@
// subpages/goodsorder/goodsorder.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
tabList: [{
name: "全部",
type: "all"
}, {
name: "代付款",
type: "0"
}, {
name: "待收货",
type: "2"
}, {
name: "已完成",
type: "4"
}, {
name: "已取消",
type: ""
}, ],
dataList: [],
currentIndex: 0,
pages: {
page: 1,
rows: 3,
isCancel: '',
orderStatus: ''
},
token: '',
isHideLoading: false,
imgUrl: app.shopImgUrl,
cancelList: [],
currentCancel: {},
isShowCancel: false,
cancelRemark: "",
totalSize: 0,
isShowLoading: true,
loading: "加载中"
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
var _self = this;
_self.getToken().then(res => {
_self.getGoodsList();
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
changeTab(e) {
var _self = this;
var type = e.currentTarget.dataset.type
var isCancel = type == '' ? '1' : '0';
if (isCancel == '1') {
type = '';
}
if ('all' == type) {
type = '';
isCancel = '';
}
var tempPage = {
page: 1,
isCancel: isCancel,
orderStatus: type
}
_self.setData({
currentIndex: e.currentTarget.dataset.index,
pages: tempPage,
dataList: []
})
_self.getGoodsList();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
getGoodsList() {
var _self = this;
_self.setData({
isHideLoading: !(1 == _self.data.pages.page)
})
app.restAjax.get(app.restAjax.path(app.shopUrl + '/app/order/listpage', []),
_self.data.pages, {
headers: {
token: _self.data.token
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
function (code, data) {
_self.setData({
isHideLoading: true
})
if ('200' == code) {
if (1 === _self.data.pages.page) {
_self.setData({
dataList: data.rows,
totalSize: data.total
})
} else {
_self.setData({
dataList: _self.data.dataList.concat(data.rows)
})
console.log(_self.data.dataList.length)
if (_self.data.dataList.length >= _self.data.totalSize) {
_self.setData({
isShowLoading: false,
loading: "没有更多数据了"
})
}
}
}
},
function () {
_self.setData({
isHideLoading: true
})
},
function () {
_self.setData({
isHideLoading: true
})
wx.hideNavigationBarLoading(); //完成停止加载图标
wx.stopPullDownRefresh();
wx.hideLoading();
})
},
getToken: function () {
var self = this;
return new Promise(resolve => {
wx.getStorage({
key: 'token',
success(res) {
self.setData({
token: res.data
})
return resolve();
}
})
})
},
// 支付
toPayOrder(e) {
var item = e.currentTarget.dataset.item;
wx.showToast({
icon: "none",
title: '暂时无法支付',
})
},
//取消订单
toCancelOrder(e) {
var _self = this;
var item = e.currentTarget.dataset.item; //当前订单
app.dialog.loading("加载中...");
app.restAjax.get(app.restAjax.path('{shopUrl}/app/data/listbyparentid/{id}',
[app.shopUrl, "bf2d6bb5-4562-4ace-827e-378e41571576"]), {}, {
headers: {
token: _self.data.token
}
},
function (code, data) {
wx.hideLoading()
if (data && data.length > 0) {
for (let i = 0; i < data.length; i++) {
if (i == 0) {
data[i].check = true;
} else {
data[i].check = false;
}
}
_self.setData({
cancelList: data,
currentCancel: data[0],
isShowCancel: true,
curOrder: item
})
} else {
app.dialog.msg("暂时无法取消订单")
}
},
function (code, data) {
app.dialog.msg(data.msg);
},
function () {
wx.hideLoading();
})
},
//删除订单
toDelOrder(e) {
var _self = this;
var item = e.currentTarget.dataset.item;
wx.showModal({
title: '提示',
content: '确定要删除该订单吗?删除后将无法找回.',
complete: (res) => {
if (res.confirm) {
app.restAjax.delete(app.restAjax.path('{shopUrl}/app/order/delete/{orderId}',
[app.shopUrl, item.orderId]), {}, {
headers: {
token: _self.data.token
}
},
function (code, data) {
if (code == '200') {
app.dialog.msg('删除成功')
}
wx.startPullDownRefresh()
},
function (code, data) {
app.dialog.msg(data.msg);
},
function () {
wx.hideLoading();
})
}
}
})
},
inputRemark(e) {
console.log(e)
this.setData({
cancelRemark: e.detail.value
})
},
//选择取消
chooseCancel(e) {
var item = e.currentTarget.dataset.item;
var index = e.currentTarget.dataset.index;
item.check = true;
var _self = this;
_self.data.cancelList.forEach((item, i) => {
if (i == index) {
item.check = true;
} else {
item.check = false;
}
});
_self.setData({
currentCancel: item,
cancelList: _self.data.cancelList
})
},
cancelDialog() {
this.setData({
isShowCancel: false
})
},
confirmCancel() {
var _self = this;
_self.setData({
isShowCancel: false
})
var cancelBean = {
cancelData: _self.data.currentCancel.dataId,
cancelRemark: _self.data.cancelRemark,
};
app.dialog.loading("取消中...");
app.restAjax.put(app.restAjax.path('{shopUrl}/app/order/updatebuyersclose/{orderId}',
[app.shopUrl, _self.data.curOrder.orderId]), cancelBean, {
headers: {
token: _self.data.token
}
},
function (code, data) {
if (code == '200') {
wx.startPullDownRefresh()
app.dialog.msg('取消成功')
}
},
function (code, data) {
app.dialog.msg(data.msg);
},
function () {
wx.hideLoading();
})
},
onPullDownRefresh: function () {
// 在标题栏中显示加载图标
var _self = this;
_self.setData({
[`pages.page`]: 1,
dataList: []
})
_self.getGoodsList()
},
onReachBottom() {
var _self = this;
if (_self.data.totalSize > _self.data.dataList.length) {
_self.setData({
[`pages.page`]: _self.data.pages.page + 1,
})
_self.getGoodsList();
}
}
})

View File

@ -1,3 +1,5 @@
{
"usingComponents": {}
"usingComponents": {},
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}

View File

@ -1,2 +1,62 @@
<!--subpages/goodsorder/goodsorder.wxml-->
<text>subpages/goodsorder/goodsorder.wxml</text>
<view class="area">
<scroll-view scroll-x="true">
<view class="area-box {{currentIndex == index ? 'active': ''}}" wx:for="{{tabList}}" wx:key="index" data-index="{{index}}" data-type="{{item.type}}" bindtap="changeTab">{{item.name}}</view>
</scroll-view>
</view>
<view class="activity" wx:if="{{isHideLoading}}">
<block wx:if="{{dataList.length>0}}">
<scroll-view style="height: 100%;" scroll-y="true">
<view class="activity-box" wx:for="{{dataList}}" wx:key="index">
<view class="shop-status">
<view class="shop-name">{{item.shopName}}</view>
<view class="order-status">{{item.orderStatusMsg}}</view>
</view>
<view class="goods" wx:for="{{item.orderDetailList}}" wx:key="index" wx:for-item="it" wx:for-index="i">
<image class="goods-img" src="{{it.goodsIcon=='' ? '/images/address.png' : imgUrl+it.goodsLogo}}" mode="scaleToFill" data-index="{{index}}"></image>
<view class="goods-content">
<rich-text class="goods-name" nodes="{{it.goodsName}}" data-index="{{i}}"></rich-text>
<view class="goods-unit-price" data-index="{{i}}">¥{{it.goodsItemPrice}}</view>
<view class="goods-standard" data-index="{{i}}">{{it.goodsItemName}}</view>
<view class="goods-type-box">
<view class="goods-type">数量:{{it.goodsItemCount}}</view>
</view>
</view>
</view>
<view class="order-time-box">
<view class="order-time">下单时间:{{item.orderFinalTime}}</view>
<view class="order-price">总计:¥{{item.amountFinalMoney}}</view>
</view>
<view class="order-control-box" wx:if="{{0==item.isCancel}}">
<view class="order-btn" bindtap="toPayOrder" data-item="{{item}}" wx:if="{{item.orderStatus==0}}">去付款</view>
<view class="order-btn" bindtap="toCancelOrder" data-item="{{item}}" wx:if="{{item.orderStatus==1 || item.orderStatus == 2 || item.orderStatus==0}}">取消订单</view>
<view class="order-btn" bindtap="toDelOrder" data-item="{{item}}" wx:if="{{item.orderStatus==3 || item.orderStatus == 4}}">删除订单</view>
</view>
</view>
<loading-more isShowloading="{{isShowLoading}}" loadingTxt="{{loading}}"></loading-more>
</scroll-view>
</block>
<page-empty wx:else></page-empty>
</view>
<page-loading wx:else></page-loading>
<!-- 订单取消dialog -->
<view wx:if="{{isShowCancel}}" class="shade-box">
<view style="height: 50%;" bindtap="cancelDialog"></view>
<view class="cancel-box">
<view class="cancel-control">
<view class="cancel-btn" bindtap="cancelDialog">取消</view>
<view class="cancel-btn" bindtap="confirmCancel">确定</view>
</view>
<view class="cancel-remark">
<view class="cancel-title">备注</view>
<textarea bindinput="inputRemark" class="cancel-content" placeholder="请输入备注"></textarea>
</view>
<scroll-view style="height: 50%;width: 92%;" scroll-y="true">
<view class="cancel-item" wx:for="{{cancelList}}" wx:key="index" data-item="{{item}}" data-index="{{index}}" bindtap="chooseCancel">
<image src="{{item.check?'/subpages/images/ic_cb_checked.png':'/subpages/images/ic_cb_unchecked.png'}}"></image>
<view class="content">{{item.dataName}}</view>
</view>
</scroll-view>
</view>
</view>

View File

@ -1 +1,358 @@
/* subpages/goodsorder/goodsorder.wxss */
.activity {
padding: 20rpx 30rpx 0;
margin-top: 80rpx;
}
.activity-box {
margin-bottom: 20rpx;
box-shadow: 0px 0px 17rpx 0px rgba(0, 0, 0, 0.1);
border-radius: 10rpx;
overflow: hidden;
padding: 10rpx;
}
.activity-img {
height: 320rpx;
position: relative;
}
.activity-img image {
width: 100%;
height: 100%;
}
.corner {
position: absolute;
top: 20rpx;
right: 20rpx;
display: flex;
color: #fff;
}
.corner view {
padding: 0 10rpx;
background: rgba(0, 0, 0, 0.6);
line-height: 40rpx;
vertical-align: middle;
display: flex;
align-items: center;
border-radius: 5rpx;
}
.view-count {
margin-right: 20rpx;
}
.view-count image {
width: 40rpx;
height: 40rpx;
}
.activity-info {
padding: 15rpx 20rpx;
}
.title {
display: flex;
justify-content: space-between;
}
.activity-title {
width: 70%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 32rpx;
color: #242424;
line-height: 40rpx;
}
.sign {
background: rgba(159, 21, 18, .1);
color: #9F1512;
border-radius: 10rpx;
padding: 0 20rpx;
line-height: 40rpx;
font-size: 28rpx;
}
.date {
margin-top: 10rpx;
font-size: 24rpx;
color: #242424;
}
.area {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 80rpx;
white-space: nowrap;
overflow-x: auto;
background: white;
box-shadow: 5rpx 5rpx 10rpx #f2f2f2;
z-index: 5;
}
.area-box {
display: inline-block;
width: 25%;
line-height: 80rpx;
text-align: center;
font-size: 32rpx;
}
.area-box.active {
color: #9F1512;
font-weight: bold;
}
.shop-status {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 5rpx;
}
.shop-name {
font-size: 32rpx;
font-weight: bold;
color: black;
}
.order-status {
background: #f3f3f3;
border-radius: 5rpx;
padding: 0rpx 10rpx;
font-size: 28rpx;
color: #9f1512;
}
.order-time-box {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-top: 10rpx;
}
.order-time {
font-size: 30rpx;
color: black;
}
.order-price {
font-size: 32rpx;
color: #9f1512;
}
.order-control-box {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
margin-top: 10rpx;
}
.order-btn {
font-size: 28rpx;
color: white;
padding: 5rpx 10rpx;
border-radius: 5rpx;
background: linear-gradient(to right bottom, rgb(240, 78, 78), #9f1512 70rpx);
}
.order-btn:nth-of-type(n+2) {
margin-left: 10rpx;
}
.goods {
display: flex;
flex-direction: row;
justify-content: flex-start;
margin-left: 20rpx;
margin-top: 10rpx;
}
.goods-img {
width: 180rpx;
height: 160rpx;
}
.goods-content {
margin: 0rpx 10rpx;
flex: 1;
}
.goods-name {
font-size: 32rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.goods-unit-price {
font-size: 40rpx;
color: #9f1512;
margin-top: 10rpx;
}
.goods-standard {
margin-top: 10rpx;
font-size: 25rpx;
border: 1rpx solid #9f1512;
border-radius: 3rpx;
color: #9f1512;
width: fit-content;
max-width: fit-content;
padding: 0rpx 10rpx;
}
.goods-type-box {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
margin-top: 20rpx;
}
.goods-type-box image {
width: 48rpx;
height: 48rpx;
}
.goods-type {
color: #9f1512;
font-size: 25rpx;
background: #ecebeb;
padding: 0rpx 10rpx;
text-align: center;
}
.type-box {
display: flex;
flex-direction: row;
width: 50%;
justify-content: flex-start;
align-items: center;
}
.add-del-box {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.add-del-box .txt {
font-size: 35rpx;
padding: 0rpx 15rpx;
}
.control-box {
width: 50%;
display: flex;
flex-direction: row;
justify-content: space-around;
}
.cancel-box {
height: 50%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
background: white;
width: 100%;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
position: absolute;
bottom: 0;
}
.cancel-control {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 90%;
margin-top: 15rpx;
}
.cancel-btn {
font-size: 35rpx;
color: black;
padding: 15rpx;
}
.cancel-btn:last-child {
color: #9F1512;
}
.cancel-remark {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
margin-top: 15rpx;
width: 87%;
}
.cancel-title {
font-size: 32rpx;
color: black;
}
.cancel-content {
font-size: 28rpx;
border-radius: 10rpx;
background: #f3f3f3;
height: 100rpx;
margin-top: 20rpx;
padding: 10rpx;
width: 95%;
}
.cancel-item {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
padding: 10rpx;
margin-left: 20rpx;
}
.cancel-item:first-child {
margin-top: 20rpx;
}
.cancel-item image {
width: 30rpx;
height: 30rpx;
}
.cancel-item .content {
font-size: 32rpx;
margin-left: 15rpx;
color: black;
}
.shade-box {
background: #25252587;
width: 100%;
height: 100%;
z-index: 999999;
position: fixed;
top: 0;
left: 0;
}

View File

@ -13,7 +13,8 @@ Page({
goodsList: [],
imgUrl: app.shopImgUrl,
remark: '',
totalPrice: 0
totalPrice: 0,
carList: []
},
/**
@ -77,6 +78,7 @@ Page({
}
}
_self.setData({
carList: carList,
goodsList: _self.data.goodsList,
totalPrice: tempPrice
})
@ -93,11 +95,60 @@ Page({
},
doSelAddress() {
//选择地址
wx.navigateTo({
url: '/subpages/addresschoose/addresschoose',
})
},
checkParams() {
},
doSave() {
doConfirmOrder() {
var _self = this;
var tempList = [];
for (let i = 0; i < _self.data.goodsList.length; i++) {
const item = _self.data.goodsList[i];
var tempItem = {
count: item.carAmount,
goodsId: item.goodsId,
goodsItemId: item.goodsStandarId,
};
tempList.push(tempItem);
}
var saveBean = {
goodsItemList: tempList,
shopAddressId: _self.data.addressBean.shopAddressId,
words: _self.data.remark
};
app.dialog.loading("下单中...")
app.restAjax.post(app.restAjax.path('{shopUrl}/app/order/savebycart', [app.shopUrl]), saveBean, {
headers: {
token: _self.data.token
}
}, function (code, data) {
wx.hideLoading()
if (code == 200) {
wx.showToast({
title: '下单成功',
success() {
//删除购物车中的数据
for (let i = _self.data.carList.length - 1; i >= 0; i--) {
const element = _self.data.carList[i];
if (element.isCheck) {
_self.data.carList.splice(i, 1);
}
}
_self.setData({
carList: _self.data.carList
})
wx.setStorageSync('carlist', _self.data.carList)
setTimeout(function () {
wx.navigateBack()
}, 1000);
}
})
}
}, function (code, data) {
app.dialog.msg(data.msg)
});
}
})

View File

@ -1,7 +1,7 @@
<!--subpages/orderconfirm/orderconfirm.wxml-->
<scroll-view class="container-box" wx:if="{{addressBean.areaName}}">
<!-- 收货地址 -->
<view class="address-box">
<view class="address-box" bindtap="doSelAddress">
<view class="address-title">收货地址</view>
<view class="address-area-name">{{addressBean.areaName}}</view>
<view class="address-area-content">