123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- <template>
- <view style="overflow: hidden;">
- <view class="wrapper">
- <view class="address" @click="selectAddress">
- <view class="left">
- <view class="icon">
- <u-icon color="#ff536f" name="map" size="38"></u-icon>
- </view>
- <view class="title">
- <view class="name">
- {{ mallOrder.receiverAddress }}
- </view>
- <view class="desc">
- {{ mallOrder.receiver }} {{ mallOrder.receiverPhone }}
- </view>
- </view>
- </view>
- <view class="right">
- <u-icon color="#ddd" name="arrow-right" size="30"></u-icon>
- </view>
- <image class="lineImg" mode="widthFix" src="../../static/icon/addr-line.png"></image>
- </view>
- </view>
- <!-- 商品信息 -->
- <view class="wrapper">
- <view class="goods">
- <u-read-more :shadow-style="shadowStyle" close-text="查看更多" color="#909399" show-height="400" text-indent="0"
- toggle>
- <view v-for="(item,index) in goodsList" v-if="item.check" :key="index"
- class="product">
- <view>
- <image :src="item.image" mode="widthFix" style="width: 150rpx;height: 150rpx;"></image>
- </view>
- <view class="right">
- <view class="item-title">{{ item.title }}</view>
- <view class="item-bottom">
- <view class="item-price">
- <view class="new-price">¥{{ item.price }} x {{ item.value }}</view>
- </view>
- </view>
- </view>
- </view>
- </u-read-more>
- <view class="items"></view>
- <view class="info">
- <view class="cell-list">
- <view class="cell" @click="code">
- <view class="left">
- <text>商品金额</text>
- </view>
- <view class="right" style="color:#303133 ;">
- ¥{{ totalPrice }}
- </view>
- </view>
- <!-- <view class="cell" @click="code">
- <view class="left">
- <text class="text" style="
- padding: 6rpx 8rpx;
- margin-right: 8rpx;
- font-size: 20rpx;
- color: #fff;
- border-radius: 8rpx;
- background-color: orange;
- ">满</text>
- <text class="text">订单满减</text>
- </view>
- <view class="right" style="color:#303133 ;">
- -¥30
- </view>
- </view> -->
- <!-- <view class="cell" @click="code">
- <view class="left">
- <text class="text" style="
- padding: 6rpx 8rpx;
- margin-right: 8rpx;
- font-size: 20rpx;
- color: #fff;
- border-radius: 8rpx;
- background-color: #ff536f;
- ">卷</text>
- <text class="text">优惠卷</text>
- </view>
- <view class="right">
- 暂无可用
- </view>
- </view> -->
- <!-- <view class="cell" @click="code">
- <view class="left">
- <text class="text">配送费</text>
- </view>
- <view class="right" style="color: #303133 ">
- -¥0
- </view>
- </view> -->
- </view>
- </view>
- <view class="price">
- 应付:¥{{ totalPrice }}
- </view>
- </view>
- </view>
- <view class="wrapper wrapper-bottom">
- <view class="remark">
- <view class="title">
- 订单备注:
- </view>
- <view class="textArea">
- <u-input v-model="mallOrder.remark" :auto-height="autoHeight" :border="border" :height="height" :type="type"
- placeholder="选填 , 合理需求我们会尽量满足..."/>
- </view>
- </view>
- </view>
- <view class="bottomView">
- <view class="bottomLeft" @click="checkGoods">
- <view class="clear">
- 实付款:
- </view>
- <view class="left">
- ¥{{ totalPrice }}
- </view>
- </view>
- <view class="bottomRight">
- <view class="right" @click="subOrder">
- 提交订单
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import config from "@/common/config.js" // 全局配置文件
- export default {
- data() {
- return {
- type: 'textarea',
- border: false,
- height: 100,
- autoHeight: true,
- shadowStyle: {
- backgroundImage: "none",
- paddingTop: "20rpx",
- },
- goodsList: [],
- totalPrice: 0,
- mallOrder: {
- receiver: '',
- receiverPhone: '',
- receiverAddress: '',
- payAmount: 0,
- payStatus: 1,
- disAmount: 0,
- orderStatus: 1,
- remark: '',
- mallOrderGoodsList: []
- },
- }
- },
- onLoad(option) {
- // 检查token
- this.checkToken();
- if (option.addressId) {
- this.mallOrder.receiverAddress = option.addressName
- this.mallOrder.receiverPhone = option.phone
- this.mallOrder.receiver = option.userName
- } else {
- // 设置默认收货地址
- this.setDefaultAddress()
- }
- // 商品列表
- this.goodsList = this.vuex_cartList.reverse()
- // 计算价格
- this.goodsList.map((val, idx) => {
- if (this.goodsList[idx].check) {
- this.totalPrice = this.totalPrice + this.goodsList[idx].value * this.goodsList[idx].price
- }
- })
- this.mallOrder.payAmount = this.totalPrice
- },
- methods: {
- checkToken() {
- // 判断Token是否有效
- let lifeData = uni.getStorageSync('lifeData');
- let token = lifeData.vuex_token
- if (!token) {
- // 没有token 则跳转到登录
- return uni.reLaunch({
- url: '../login/login'
- })
- } else {
- this.myavatar = config.baseUrl + uni.getStorageSync('lifeData').vuex_user.user.avatar
- }
- },
- subOrder() {
- if (!this.mallOrder.receiverAddress) {
- return this.$mytip.toast('请选择收货地址')
- }
- this.mallOrder.mallOrderGoodsList = this.goodsList
- let url = "/api/mallApi/insertMallOrder"
- this.$u.post(url, this.mallOrder).then(result => {
- this.$u.route('/pages/order/order')
- });
- },
- selectAddress() {
- this.$u.route('/pages/address/address')
- },
- setDefaultAddress() {
- let url = "/api/mallApi/findAddressList";
- this.$u.get(url, {
- orderByColumn: 'create_time',
- isAsc: 'desc',
- pageNum: 1,
- pageSize: 100,
- isDefault: 1
- }).then(result => {
- // 商品数据
- let defaultAddress = result.rows[0];
- this.mallOrder.receiverAddress = defaultAddress.address
- this.mallOrder.receiverPhone = defaultAddress.phone
- this.mallOrder.receiver = defaultAddress.userName
- });
- }
- }
- }
- </script>
- <style lang="scss">
- .wrapper {
- margin: 20 rpx 20 rpx 10 rpx 20 rpx;
- background-color: #fff;
- padding: 20 rpx 20 rpx 20 rpx 20 rpx;
- border-radius: 3px;
- // color: $u-main-color;
- color: $u-tips-color;
- .address {
- margin: 10 rpx 0;
- display: flex;
- justify-content: space-between;
- position: relative;
- .left {
- display: flex;
- align-items: center;
- .title {
- margin-left: 10 rpx;
- .name {
- font-size: 14px;
- font-weight: 600;
- color: $u-main-color;
- }
- .desc {
- font-size: 14px;
- }
- }
- }
- .right {
- position: absolute;
- right: 0;
- }
- .lineImg {
- width: 710 rpx;
- position: absolute;
- bottom: -30rpx;
- left: -20rpx;
- }
- }
- .goods {
- color: $u-main-color;
- .product {
- display: flex;
- margin-bottom: 30 rpx;
- border-bottom: 1px solid #eee;
- &:last-child {
- border-bottom: 0;
- }
- .right {
- margin-left: 20 rpx;
- .item-title {
- font-size: 14px;
- color: $u-main-color;
- font-weight: bold;
- padding-top: 10 rpx;
- padding-left: 10 rpx;
- background-color: #fff;
- }
- .item-bottom {
- margin-top: 20 rpx;
- background-color: #fff;
- display: flex;
- align-items: center;
- .item-price {
- display: flex;
- align-items: center;
- width: 250 rpx;
- max-width: 250 rpx;
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- .new-price {
- font-weight: normal;
- font-size: 14px;
- color: $u-main-color;
- padding: 5px 0 5px 2px;
- }
- }
- }
- .item-desc {
- font-weight: normal;
- font-size: 26 rpx;
- color: $u-tips-color;
- padding-bottom: 5 rpx;
- padding-left: 10 rpx;
- background-color: #fff;
- }
- }
- }
- .info {
- .cell-list {
- background-color: #fff;
- .cell {
- margin-bottom: 30 rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .left {
- display: flex;
- justify-content: space-between;
- align-items: center;
- color: $u-main-color;
- font-size: 30 rpx;
- .text {
- padding-left: 10 rpx;
- }
- }
- .right {
- font-size: 28 rpx;
- color: $u-tips-color;
- }
- }
- }
- }
- .price {
- text-align: right;
- font-weight: 800;
- border-top: 1px solid #eee;
- padding-top: 20 rpx;
- }
- }
- .remark {
- .title {
- color: $u-main-color;
- font-weight: 800;
- }
- .textArea {
- margin-top: 20 rpx;
- }
- }
- }
- .wrapper-bottom {
- margin-bottom: 120 rpx;
- }
- .bottomView {
- box-shadow: 0 -1px 1px 0 rgba(0, 0, 0, 0.05);
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: #ffffff;
- z-index: 999;
- height: 100 rpx;
- line-height: 100 rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 20 rpx;
- .bottomLeft {
- display: flex;
- align-items: center;
- position: relative;
- height: 100 rpx;
- line-height: 100 rpx;
- .clear {
- text-align: center;
- border-radius: 10%;
- color: $u-tips-color;
- font-size: 14px;
- margin-right: 20 rpx;
- }
- .left {
- color: $base-color;
- font-size: 16px;
- font-weight: 800;
- }
- }
- .bottomRight {
- display: flex;
- align-items: center;
- height: 60 rpx;
- line-height: 60 rpx;
- .right {
- color: #fff;
- background: $base-color;
- padding: 2 rpx 20 rpx;
- border-radius: 30 rpx;
- margin-left: 20 rpx;
- }
- ;
- }
- }
- </style>
|