Browse Source

上传

master
前端-胡立永 4 months ago
parent
commit
cbc599a912
16 changed files with 266 additions and 56 deletions
  1. +12
    -0
      api/model/index.js
  2. +12
    -0
      api/model/info.js
  3. +26
    -2
      components/product/productItem.vue
  4. +1
    -1
      config.js
  5. +30
    -1
      mixins/configList.js
  6. +39
    -0
      mixins/order.js
  7. +2
    -1
      pages/index/center.vue
  8. +5
    -0
      pages/index/index.vue
  9. +11
    -12
      pages/index/order.vue
  10. +10
    -4
      pages_order/mine/promotion.vue
  11. +22
    -4
      pages_order/mine/recharge.vue
  12. +33
    -14
      pages_order/mine/withdraw.vue
  13. +39
    -10
      pages_order/order/createOrder.vue
  14. +1
    -1
      pages_order/order/orderDetail.vue
  15. +15
    -4
      pages_order/product/productDetail.vue
  16. +8
    -2
      store/store.js

+ 12
- 0
api/model/index.js View File

@ -78,12 +78,24 @@ const api = {
method: 'GET',
auth : true,
},
// 创建订单-再次支付
createOrderTwo: {
url: '/rice_index/createOrderTwo',
method: 'GET',
auth : true,
},
// 多商品创建订单
createSumOrder: {
url: '/rice_index/createSumOrder',
method: 'POST',
auth : true,
},
// 多商品订单再次支付
createSumOrderAgain: {
url: '/rice_index/createSumOrderAgain',
method: 'POST',
auth : true,
},
}
export default api

+ 12
- 0
api/model/info.js View File

@ -2,6 +2,18 @@
// 个人相关接口
const api = {
// 充值
recharge: {
url: '/rice_info/recharge',
method: 'GET',
auth : true,
},
// 提现
withdraw: {
url: '/rice_info/withdraw',
method: 'GET',
auth : true,
},
// 获取地址列表带分页
getAddressPageList: {
url: '/rice_info/getAddressPageList',


+ 26
- 2
components/product/productItem.vue View File

@ -13,8 +13,24 @@
<view class="desc">
{{ item.sku }}
</view>
<view class="price">
<text>{{ item.price }}</text>
<view class="price"
v-if="[2].includes(item.type)">
<view class="">
会员价<text>{{ item.vipPrice }}</text>
</view>
<view class="">
零售价<text>{{ item.price }}</text>
</view>
</view>
<view class="price"
v-else>
<view class="">
价格<text>{{ item.price }}</text>
</view>
<view class="">
原价<text>{{ item.oldPrice }}</text>
</view>
</view>
</view>
</view>
@ -84,6 +100,14 @@
font-size: 30rpx;
font-weight: 900;
}
&>view:nth-child(2){
font-size: 22rpx;
color: #777;
text{
font-size: 26rpx;
font-weight: 900;
}
}
}
}
}

+ 1
- 1
config.js View File

@ -7,7 +7,7 @@ import uvUI from '@/uni_modules/uv-ui-tools'
Vue.use(uvUI);
// 当前环境
const type = 'dev'
const type = 'prod'
// 环境配置


+ 30
- 1
mixins/configList.js View File

@ -4,11 +4,40 @@ import { mapState } from 'vuex'
export default {
data() {
return {
// 默认的全局分享内容
Gshare: {
// title: '三只青蛙',
path: '/pages/index/index', // 全局分享的路径,比如 首页
// imageUrl: '/static/image/login/logo.png', // 全局分享的图片(可本地可网络)
}
}
},
computed: {
...mapState(['configList']),
...mapState(['configList', 'userInfo']),
},
// 定义全局分享
// 1.发送给朋友
onShareAppMessage(res) {
let o = {
...this.Gshare,
title : this.configList.logo_name,
}
if(this.userInfo.id){
o.path = this.Gshare.path + '?shareId=' + this.userInfo.id
}
return o
},
//2.分享到朋友圈
onShareTimeline(res) {
let o = {
...this.Gshare,
title : this.configList.logo_name,
}
if(this.userInfo.id){
o.path = this.Gshare.path + '?shareId=' + this.userInfo.id
}
return o
},
methods: {
}
}

+ 39
- 0
mixins/order.js View File

@ -0,0 +1,39 @@
export default {
data() {
return {
}
},
computed: {
},
methods: {
toPayOrder(item){
let api = ''
if([0, 1].includes(item.shopState)){
api = 'createOrderTwo'
}else{
api = 'createSumOrderAgain'
}
this.$api(api, {
orderId : item.id,
addressId : item.addressId
}, res => {
if(res.code == 200){
uni.requestPaymentWxPay(res)
.then(res => {
uni.showToast({
title: '支付成功',
icon: 'none'
})
this.getData()
}).catch(n => {
this.getData()
})
}
})
},
}
}

+ 2
- 1
pages/index/center.vue View File

@ -29,7 +29,8 @@
<view class="earnings">
<view class="member"
v-if="userInfo.isPay">
v-if="userInfo.isPay"
@click="$utils.navigateTo('/pages/index/member')">
<view>会员等级{{ vipType[userInfo.isPay] }}</view>
<view>查看权益></view>
</view>


+ 5
- 0
pages/index/index.vue View File

@ -214,6 +214,11 @@
}
},
computed: {},
onLoad(query) {
if (query.shareId) {
uni.setStorageSync('shareId', query.shareId)
}
},
onShow() {
this.getBanner()
this.getRiceNoticeList()


+ 11
- 12
pages/index/order.vue View File

@ -13,6 +13,7 @@
lineHeight="8rpx"
lineWidth="50rpx"
:current="current"
:scrollable="false"
@click="clickTabs"></uv-tabs>
<view class="list">
@ -36,7 +37,8 @@
v-for="(good, index) in item.commonOrderSkuList">
<view class="left">
<image mode="aspectFill" :src="good.image"></image>
<image mode="aspectFill"
:src="good.image && good.image.split(',')[0]"></image>
</view>
<view class="right">
@ -71,11 +73,11 @@
立即付款
</view>
<view class="b2"
<!-- <view class="b2"
@click.stop=""
v-if="item.state == 3">
立即评价
</view>
</view> -->
</view>
</view>
@ -87,8 +89,9 @@
<script>
import { mapGetters } from 'vuex'
import mixinsList from '@/mixins/list.js'
import mixinsOrder from '@/mixins/order.js'
export default {
mixins : [mixinsList],
mixins : [mixinsList, mixinsOrder],
components : {
},
computed : {
@ -101,9 +104,6 @@
{
name: '待付款'
},
{
name: '已付款'
},
{
name: '待发货'
},
@ -120,18 +120,20 @@
},
onLoad(args) {
this.current = args.type || 0
this.clickTabs(this.current)
this.clickTabs({index : this.current})
},
onShow() {
},
methods: {
//tab
clickTabs(index) {
clickTabs({index}) {
console.log(index);
if (index == 0) {
delete this.queryParams.state
} else {
this.queryParams.state = index - 1
}
this.getData()
},
//
toOrderDetail(id) {
@ -139,9 +141,6 @@
url: '/pages_order/order/orderDetail?id=' + id
})
},
getOrderList(){
},
}
}
</script>


+ 10
- 4
pages_order/mine/promotion.vue View File

@ -2,7 +2,10 @@
<view class="promotion">
<navbar title="二维码" leftClick @leftClick="$utils.navigateBack" />
<navbar title="二维码"
bgColor="#A3D250"
color="#fff"
leftClick @leftClick="$utils.navigateBack" />
<view class="promotion-card">
<!-- <view class="user-info"> -->
@ -194,6 +197,9 @@
<style lang="scss" scoped>
.promotion {
width: 100%;
height: 100vh;
background-color: $uni-color;
.promotion-card {
width: 90%;
margin: 100rpx auto 0rpx auto;
@ -201,6 +207,7 @@
border-radius: 15rpx;
padding: 40rpx 30rpx;
box-sizing: border-box;
background-color: #fff;
.user-info {
display: flex;
@ -244,10 +251,9 @@
width: 100%;
height: 120rpx;
display: flex;
background: $uni-color;
color: white;
background: #fff;
font-size: 28rpx;
color: $uni-color;
.btn {
flex: 1;
display: flex;


+ 22
- 4
pages_order/mine/recharge.vue View File

@ -14,7 +14,7 @@
</view>
<view class="input-box">
<view class="input">
<input type="text" v-model="num"/>
<input type="text" v-model="form.money"/>
</view>
</view>
<view class="num">
@ -68,7 +68,9 @@
// mixinsListApi : 'getWaterPageList',
list : [],
type : ['-', '+'],
num : 0,
form : {
money : 0,
},
}
},
computed: {
@ -80,12 +82,28 @@
},
methods: {
submit(){
this.$api('', res => {
if(this.$utils.verificationAll(this.form, {
money : '请输入金额'
})){
return
}
if(this.form.money <= 0){
uni.showToast({
title: '输入金额必须大于0',
icon: 'none'
})
return
}
this.$api('recharge', res => {
if(res.code == 200){
uni.showToast({
title: '提现成功',
title: '充值成功',
icon : 'none'
})
setTimeout(uni.navigateBack, 800, -1)
}
})
},


+ 33
- 14
pages_order/mine/withdraw.vue View File

@ -14,9 +14,10 @@
</view>
<view class="input-box">
<view class="input">
<input type="text" v-model="num"/>
<input type="text" v-model="form.money"/>
</view>
<view class="">
<view class=""
@click="selectAll">
全部提现
</view>
</view>
@ -49,7 +50,7 @@
:center="true">
<template #value>
<view class="cell-text">
<view class="price-text">-19.9</view>
<view class="price-text">{{ type[item.type] }}{{ item.money }}</view>
<view class="tips">已到账</view>
</view>
</template>
@ -68,16 +69,13 @@
mixins : [mixinsList],
data() {
return {
// mixinsListApi : 'getWaterPageList',
list : [
{
title : '直播收入',
type : 0,
createTime : '2021-12-12',
}
],
type : ['-', '+'],
num : 0,
mixinsListApi : 'getWaterPageList',
list : [],
type : ['+', '-'],
state : ['审核中', '成功', '失败'],
form : {
money : 0,
},
}
},
computed: {
@ -88,13 +86,34 @@
this.$store.commit('getRiceInfo')
},
methods: {
selectAll(){
this.form.money = this.riceInfo.canWithdraw
},
submit(){
this.$api('', res => {
if(this.$utils.verificationAll(this.form, {
money : '请输入金额'
})){
return
}
if(this.form.money <= 0){
uni.showToast({
title: '输入金额必须大于0',
icon: 'none'
})
return
}
this.$api('withdraw', this.form, res => {
if(res.code == 200){
uni.showToast({
title: '提现成功',
icon : 'none'
})
this.$store.commit('getUserInfo')
this.$store.commit('getRiceInfo')
this.getData()
}
})
},


+ 39
- 10
pages_order/order/createOrder.vue View File

@ -34,13 +34,23 @@
<view class="desc">
{{ item.sku }}
</view>
<view class="price">
<view class="price-box">
<view class="">
<uv-number-box
v-model="item.num"
v-if="[1, 2].includes(item.type)"
></uv-number-box>
</view>
<view class="">
<!-- 会员价普通商品并且是会员的时候显示 -->
<view class="price"
v-if="[2].includes(item.type) && [1].includes(userInfo.isPay)">
会员价{{ item.vipPrice }}
</view>
<!-- 零售价价格 -->
<view class="price"
v-else>
{{ item.price }}
</view>
</view>
@ -114,15 +124,24 @@
let price = 0
this.productList.forEach(n => {
price += n.price * n.num
if([2].includes(n.type) &&
[1].includes(this.userInfo.isPay)){
//
price += n.vipPrice * n.num
}else{
//
price += n.price * n.num
}
})
return Number(price).toFixed(2)
},
...mapState(['payOrderProduct']),
...mapState(['payOrderProduct', 'userInfo']),
},
onLoad() {
this.getRiceProductDetail()
this.$store.commit('getUserInfo')
},
onShow() {
this.getAddressList()
@ -220,12 +239,12 @@
icon: 'none'
})
setTimeout(uni.navigateTo, 700, {
url: '/pages_order/order/order'
setTimeout(uni.redirectTo, 700, {
url: '/pages/index/order'
})
}).catch(n => {
setTimeout(uni.navigateTo, 500, {
url: '/pages_order/order/order'
setTimeout(uni.redirectTo, 700, {
url: '/pages/index/order'
})
})
}
@ -249,7 +268,7 @@
border-radius: 20rpx;
image {
width: 40rpx;
width: 60rpx;
height: 40rpx;
margin: 20rpx;
}
@ -305,12 +324,22 @@
margin-top: 10rpx;
}
.price {
.price-box {
display: flex;
justify-content: space-between;
color: #f40;
font-size: 30rpx;
font-weight: 900;
.price{
&>view:nth-child(2){
font-size: 22rpx;
color: #777;
text{
font-size: 26rpx;
font-weight: 900;
}
}
}
}
}
}


+ 1
- 1
pages_order/order/orderDetail.vue View File

@ -51,7 +51,7 @@
>
<view class="img-box">
<image :src="good.image" mode="aspectFill"></image>
<image :src="good.image && good.image.split(',')[0]" mode="aspectFill"></image>
</view>
<view class="server-info">


+ 15
- 4
pages_order/product/productDetail.vue View File

@ -22,12 +22,23 @@
{{ productDetail.sku }}
</view>
</view>
<view class="">
<view class=""
v-if="[2].includes(productDetail.type)">
<view class="price">
会员价<text>{{ productDetail.price }}</text>
会员价<text>{{ productDetail.vipPrice }}</text>
</view>
<view class="oldPrice">
零售价<text>{{ productDetail.oldPrice }}</text>
零售价<text>{{ productDetail.price }}</text>
</view>
</view>
<view class=""
v-else>
<view class="price">
价格<text>{{ productDetail.price }}</text>
</view>
<view class="oldPrice">
原价<text>{{ productDetail.oldPrice }}</text>
</view>
</view>
</view>
@ -142,7 +153,7 @@
font-size: 26rpx;
color: #999;
text-align: right;
text-decoration: line-through;
// text-decoration: line-through;
margin-top: 14rpx;
}
.desc{


+ 8
- 2
store/store.js View File

@ -46,9 +46,15 @@ const store = new Vuex.Store({
return
}
api('wxLogin', {
let data = {
code : res.code
}, res => {
}
if(uni.getStorageSync('shareId')){
data.shareId = uni.getStorageSync('shareId')
}
api('wxLogin', data, res => {
uni.hideLoading()


Loading…
Cancel
Save