zhouzhenyuan 10 months ago
parent 26d52368a2
commit 073323bb87
  1. 7
      api/goods/index.js
  2. 8
      api/home/index.js
  3. 20
      api/preList/index.js
  4. 11
      pages/category/index.vue
  5. 2
      pages/goods/components/SkuPopup.vue
  6. 130
      pages/goods/detail.vue
  7. 173
      pages/index/index.vue
  8. 15
      pages/news/coupon/list.vue
  9. 59
      pages/news/park/recordHistory.vue
  10. 34
      pages/news/rules/rulesList.vue
  11. 5
      pages/search/index.vue
  12. 255
      pages/sureOrder/index.vue
  13. 7
      pages/user/index.vue

@ -10,7 +10,8 @@ const api = {
skuInfo: 'goods/skuInfo',
recommended: 'goods/recommended',
poster: 'goods/poster',
serveList:'goods.service/list'
serveList:'goods.service/list',
presale:'goods/presale'
}
// 商品浏览记录
@ -18,6 +19,10 @@ export const browseHistory = (param, option) => {
return request.get(api.browseHistory, param, option)
}
// 商品浏览记录
export const presale = (param, option) => {
return request.get(api.presale, param, option)
}
// 服务
export const serveList = (param, option) => {
return request.get(api.serveList, param, option)
}

@ -5,14 +5,18 @@ const api = {
list: 'goods/list',
chartsGoodsJing:'goods/chartsGoodsJing',
brandList:'goods/brandList',
typeList:'category/list'
typeList:'category/list',
cityInfo:'goods/cityInfo'
}
// 商品列表
export const cityInfo = (param, option) => {
return request.get(api.cityInfo, param, option)
}
// 商品列表
export const list = (param, option) => {
return request.get(api.list, param, option)
}
// 首页排行榜
export const chartsGoodsJing = (param, option) => {
return request.get(api.chartsGoodsJing, param, option)

@ -0,0 +1,20 @@
import request from '@/utils/request'
// api地址
const api = {
list: 'goods/presaleList',
canlpresale: 'goods/canlpresale'
}
/**
* 获取支付订单的信息
* @param {Number} orderId
* @param {Object} param
*/
export function list(param) {
return request.get(api.list, param)
}
export function canlpresale(param) {
return request.get(api.canlpresale, param)
}

@ -26,10 +26,10 @@
热门分类
</view>
<view class="goodsList">
<view class="listItem" v-for="(item,index) in hotList" :key="index">
<image src="/static/home/goodsDemo.png" mode="" class="goodsImg"></image>
<view class="listItem" v-for="(item,index) in hotList" :key="index" @click="choseSecondMenu(item)">
<image :src="item.image.preview_url" mode="" class="goodsImg" v-if="item.image.preview_url"></image>
<view class="goodsName">
TCL
{{item.name}}
</view>
</view>
</view>
@ -60,7 +60,7 @@
return {
secondChose:'',
menuList: [],
typeName: '空调',
typeName: '',
goodsList: [],
isChose: '',
hotList: [],
@ -76,11 +76,14 @@
this.isChose = item.category_id;
this.secondMenu = item.children;
this.secondChose=''
this.hotList = item.children
// this.secondChose = this.secondMenu[0].category_id;
this.getSonList(this.isChose)
},
choseSecondMenu(item){
this.secondChose = item.category_id;
this.typeName = item.name
this.getSonList(this.secondChose)
},
getGoodsTypeList() {

@ -168,7 +168,7 @@
//
buyNow(selectShop) {
//
this.$navTo('pages/checkout/index', {
this.$navTo('pages/sureOrder/index', {
mode: 'buyNow',
goodsId: selectShop.goods_id,
goodsSkuId: selectShop.goods_sku_id,

@ -10,7 +10,7 @@
<view class="head">
<view class="share">
<view class="sp"></view>
<image src="/static/detail/share.png" mode="" class="shareIcon"></image>
<image src="/static/detail/share.png" mode="" class="shareIcon" @click="shareImg"></image>
</view>
<view class="swiper">
<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay"
@ -61,7 +61,7 @@
{{goods.goods_name}}
</view>
<view class="goodsOpera">
<view class="goodsNum" @click="copyNum" >
<view class="goodsNum" @click="copyNum" v-if="goods.skuList.length>0">
<text>{{goods.skuList[0].goods_sku_id}}</text>
<image src="/static/detail/copy.png" mode=""></image>
</view>
@ -90,7 +90,7 @@
<image src="../../static/detail/rightIcon.png" mode=""></image>
</view>
<view class="address">
{{}}
{{addressInfo.region.province +'-'+addressInfo.region.city+'-'+addressInfo.region.region}}
</view>
</view>
</view>
@ -107,15 +107,12 @@
<view class="busSour">
<text>商家来源平台认证商户</text>
</view>
<!-- <view class="busName">
<text>商家名称北京伊莫电子科技有限公司</text>
</view> -->
</view>
</view>
<view class="chosed">
<view class="chosed" v-if="serveList.length>0">
<view class="title">服务</view>
<image src="/static/detail/buy.png" mode="" class="buy"></image>
<view class="info">枪色 1</view>
<!-- <image src="/static/detail/buy.png" mode="" class="buy"></image> -->
<view class="info" v-for="(item,index) in serveList" :key="index">{{item.name}}</view>
</view>
</view>
<view class="about">
@ -171,14 +168,14 @@
<view class="buyNow" v-if="!isPre" @click="buyNow">
立即购买
</view>
<view class="buyNow" v-if="isPre">
<view class="buyNow" v-if="isPre" @click="preNow" :style="{'color':goods.stock_total==0?'#666':'#FFF'}">
立即预约
</view>
</view>
</view>
<view class="dia" v-if="openDialog">
<view class="preSuc" v-if="diaShow">
<view class="preSuc" v-if="shareType=='pre'">
<view class="preImg">
<image src="../../static/order/ld.png" mode="" class="ldImg"></image>
</view>
@ -189,7 +186,7 @@
我知道了
</view>
</view>
<view class="setMs" v-if="setPrice">
<view class="setMs" v-if="shareType=='setPrice'">
<view class="msprice">
设置秒杀价格
</view>
@ -232,33 +229,33 @@
</view>
</view>
</view>
<view class="shareWechat">
<view class="shareWechat" v-if="shareType=='share'">
<view class="shareGoods">
<image src="/static/detail/tv.png" mode="" class="shareImg"></image>
</view>
<view class="shareInfo">
<view class="shareGoodsInfo">
夏普4T-M70H7DA 70英寸 4K 高清进口屏智能语音平板液晶电视机6575
{{goods.goods_name}}
</view>
<view class="sharePrice">
4980
{{goods.goods_price_min}}
</view>
</view>
<view class="shareOpera">
<view class="operaItem">
<view class="operaItem" @click="copyText(goods.goods_name)">
<view class="imgIcon">
<u-icon name="order" class="iconIm"></u-icon>
</view>
<view class="shareText">
<view class="shareText" >
复制文案
</view>
</view>
<view class="operaItem">
<view class="operaItem" @click="goShare">
<view class="imgIcon weChatIcon">
<u-icon name="order" class="iconIm"></u-icon>
</view>
<view class="shareText">
微信好友
<button open-type="share" @click="shareWechat">微信好友</button>
</view>
</view>
<view class="operaItem">
@ -304,27 +301,94 @@
userInfo: {},
addressList:[],
addressInfo:{},
serveList:[],
token:'',
}
},
onLoad(options) {
this.isPre = options.isPre
this.goodsId = options.goodsId
this.getGoodsDetail(options.goodsId)
},
onShow() {
this.token = uni.getStorageSync('token')
this.getAddressList()
this.getSuggestGoods()
this.userInfo = uni.getStorageSync('userInfo');
this.getServeList()
},
methods: {
copyText(val){
//
let text = val;
uni.setClipboardData({
data: text,
success(res) {
console.log('成功复制到剪贴板');
},
fail(err) {
console.error('复制失败', err);
}
});
},
shareWechat(){
uni.share({
provider: "weixin",
scene: "WXSceneSession",
type: 2,
imageUrl: this.goods.goods_image,
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
}
});
},
shareImg(){
this.openDialog =true
this.shareType= 'share'
},
preNow(){
const that = this
let params={
goods_id:that.goods.goods_id,
pre_id:1
}
GoodsApi.presale(params).then(res => {
if (res.status == 200) {
that.$toast(res.message)
}
})
.catch()
},
getServeList(){
const that = this
let params = {
goodsId:that.goodsId
}
return new Promise((resolve, reject) => {
GoodsApi.serveList(params).then(res => {
if (res.status == 200) {
that.serveList = res.data.list
}
})
.catch()
})
},
//
getAddressList(){
const that = this
return new Promise((resolve, reject) => {
address.list().then(res => {
if (res.code == 200) {
if (res.status == 200) {
that.addressList = res.data.list
console.log('58555559999')
console.log('58555559999',that.addressList)
that.getDefaultAddress()
}
})
@ -336,10 +400,12 @@
const that = this
return new Promise((resolve, reject) => {
address.defaultId().then(res => {
if (res.code == 200) {
if (res.status == 200) {
for (var i = 0; i < that.addressList.length; i++) {
if (res.data.defaultId == that.addressList[i].address_id) {
that.addressInfo = that.addressList[i]
that.addressInfo = that.addressList[i];
console.log(that.addressInfo,'获取地址')
}
}
}
@ -413,8 +479,20 @@
},
buyNow() {
//
console.log(this.token,'登录信息')
// if(!this.token){
// this.$toast('')
// uni.navigateTo({
// url:'/pages/login/index'
// })
// }
if(this.goods.stock_total==0){
return this.$toast('库存不足,请选择其他商品购买')
}
const item = JSON.stringify(this.goods)
uni.navigateTo({
url: '/pages/sureOrder/index?goodsInfo=' + JSON.stringify(this.goods)
url: '/pages/sureOrder/index?goodsID=' +encodeURIComponent(item)
})
},
shareCancel() {
@ -936,8 +1014,8 @@
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
line-height: 33rpx;
display: -webkit-box;
// line-height: 33rpx;
// display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
white-space: normal !important;

@ -243,45 +243,52 @@
</view>
</view>
<view class="sameCity" v-if="sameCity">
<view class="shopBg">
<view class="shopBg" >
</view>
<view class="shopInfo">
<view class="shopName">
<view class="name">
昆明湖店·YN_k121
{{cityInfo.shop_name}}
</view>
<view class="status">
营业中
</view>
</view>
<view class="star">
<image src="/static/home/star.png" mode="" class="starImg" v-for="(item,index) in 5"
<image src="/static/home/star.png" mode="" class="starImg" v-for="(item,index) in cityInfo.star"
:key="index"></image>
<text>5.0</text>
</view>
<view class="openTime">
营业时间9:00-21:30
营业时间{{cityInfo.shop_hours}}
</view>
<view class="tip">
<view class="tipItem" v-for="(item,index) in 4" :key="index">
手机选购
</view>
<view class="ask">
<image src="/static/user/weChat.png" mode="" class="weChat"></image>
<view class="askText">
咨询
<view class="tipleft">
<view class="tipItem" v-for="(item,index) in cityInfo.remark" :key="index">
{{item}}
</view>
</view>
<view class="al">
</view>
<view class="ask">
<image src="/static/home/ph.png" mode="" class="weChat"></image>
<view class="askText">
电话
<view class="tipRight">
<view class="ask">
<image src="/static/user/weChat.png" mode="" class="weChat"></image>
<view class="askText">
咨询
</view>
</view>
<view class="al">
</view>
<view class="ask">
<image src="/static/home/ph.png" mode="" class="weChat"></image>
<view class="askText">
电话
</view>
</view>
</view>
</view>
<view class="hline">
@ -289,15 +296,15 @@
<view class="shopAddress">
<view class="address">
<view class="ad">
昆明市盘龙区盘江路瀑布公园广场
{{cityInfo.address}}
<u-icon name="arrow-right"></u-icon>
</view>
<view class="adInfo">
<u-icon name="map-fill"></u-icon>
距地铁2号线大道站2号口600m
{{cityInfo.summary}}
</view>
</view>
<view class="pCar">
<view class="pCar" @click="toPark">
<image src="/static/home/p.png" mode="" class="p"></image>
<view class="car">
附近停车场
@ -335,8 +342,8 @@
</view>
</view>
<view class="pictureList">
<view class="picItem" v-for="(item,index) in 3" :key="index">
<image src="/static/home/up.png" alt="" class="pic"></image>
<view class="picItem" v-for="(item,index) in cityInfo.imageList" :key="index">
<image :src="item" alt="" class="pic"></image>
</view>
</view>
</view>
@ -353,15 +360,15 @@
<view class="customerEvalu">
<view class="cusInfo">
<view class="cusLeft">
<image src="" mode="" class="ch"></image>
<text class="cusName">Shark特</text>
<image :src="cityInfo.evaluate.image" mode="" class="ch"></image>
<text class="cusName">{{cityInfo.evaluate.nickname}}</text>
</view>
<view class="day">
1天前
</view>
</view>
<view class="evaluateInfo">
非常棒讲解细致下次还来
{{cityInfo.evaluate.content}}
</view>
</view>
<view class="evaLine">
@ -377,8 +384,8 @@
</view>
</view>
<view class="pictureList">
<view class="picItem" v-for="(item,index) in 3" :key="index">
<image src="/static/home/up.png" alt="" class="pic"></image>
<view class="picItem" v-for="(item,index) in cityInfo.imageList" :key="index">
<image :src="item" alt="" class="pic"></image>
</view>
</view>
</view>
@ -393,7 +400,15 @@
</view>
</view>
<view class="steps">
<u-steps :list="numList" mode="dot" direction="column"></u-steps>
<u-time-line-item node-top="2">
<template v-slot:node>
<u-icon name="pushpin-fill" color="#ddd" :size="24"></u-icon>
</template>
<template v-slot:content>
{{cityInfo.history.contenmt}}
</template>
</u-time-line-item>
<!-- <u-steps :list="numList" mode="dot" direction="column"></u-steps> -->
</view>
</view>
</view>
@ -441,6 +456,7 @@
],
goodsType: [],
cityInfo:{}
}
},
onShow() {
@ -448,9 +464,22 @@
this.getRankingList();
this.getbrandList();
this.getSeckill();
this.getSuggest()
this.getSuggest();
this.getCityInfo()
},
methods: {
getCityInfo(){
const that =this
GoodsApi.cityInfo()
.then(res => {
if (res.status == 200) {
that.cityInfo = res.data
}
})
.finally(() => {})
},
getTypeList() {
const that = this
GoodsApi.typeList()
@ -551,6 +580,12 @@
url: '/pages/search/index'
})
},
toPark(){
//
uni.navigateTo({
url: '/pages/news/park/index'
})
},
goDetails(item) {
uni.navigateTo({
url: '/pages/goods/detail?goodsId=' + item.goods_id
@ -1710,7 +1745,7 @@
.shopInfo {
width: 698rpx;
height: 400rpx;
min-height: 400rpx;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, #FFFFFF 100%);
border-radius: 8rpx 8rpx 8rpx 8rpx;
opacity: 1;
@ -1771,23 +1806,49 @@
.tip {
display: flex;
justify-content: space-between;
margin-top: 10rpx;
.tipItem {
margin-right: 10rpx;
width: 116rpx;
height: 42rpx;
background: #F5F5F5;
border-radius: 4rpx 4rpx 4rpx 4rpx;
opacity: 1;
text-align: center;
line-height: 42rpx;
font-size: 24rpx;
font-weight: 400;
color: #818181;
.tipleft{
display: flex;
.tipItem {
margin-right: 10rpx;
width: 116rpx;
height: 42rpx;
background: #F5F5F5;
border-radius: 4rpx 4rpx 4rpx 4rpx;
opacity: 1;
text-align: center;
line-height: 42rpx;
font-size: 24rpx;
font-weight: 400;
color: #818181;
}
}
.tipRight{
display: flex;
align-items: center;
.ask {
margin-left: 16rpx;
position: relative;
top: -20rpx;
.weChat {
width: 32rpx;
height: 32rpx;
}
.askText {
height: 28rpx;
font-size: 20rpx;
font-weight: 400;
color: #989898;
line-height: 28rpx;
}
}
}
.al {
width: 0rpx;
@ -1797,25 +1858,7 @@
margin-left: 8rpx;
}
.ask {
margin-left: 16rpx;
position: relative;
top: -20rpx;
.weChat {
width: 32rpx;
height: 32rpx;
}
.askText {
height: 28rpx;
font-size: 20rpx;
font-weight: 400;
color: #989898;
line-height: 28rpx;
}
}
}
.hline {
@ -1841,7 +1884,7 @@
}
.adInfo {
height: 40rpx;
min-height: 40rpx;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;

@ -5,7 +5,7 @@
:is-scroll="false" v-model="tabIndex" @change="change"></u-tabs>
</view>
<view class="coupon-bd">
<view class="item" :class="tabIndex == 2?'item-on':''" v-for="(item,index) in couponList" :key="index">
<view class="item" :class="tabIndex == 2?'item-on':''" v-for="(item,index) in couponList" :key="index" @click="choseItem(item)" :style="{'border':item.user_coupon_id==choseId?'2rpx solid red':none}">
<view class="a" v-if="item.coupon_type==10"><text>{{item.reduce_price}}</text></view>
<view class="a" v-if="item.coupon_type==20"><text>{{item.discount}}</text></view>
<view class="b">有效期{{item.end_time}}</view>
@ -39,6 +39,7 @@
export default {
data() {
return {
choseId:'',
list: [{
name: '未使用',
val:'isUsable'
@ -50,13 +51,23 @@
val:'isExpire'
}],
tabIndex: 0,
couponList:[]
couponList:[],
isChose:false
}
},
onLoad(o){
this.isChose = o.chose
},
onShow() {
this.getCoupon(this.tabIndex)
},
methods: {
choseItem(item){
if(this.isChose){
uni.setStorageSync('couponId',item.coupon_id)
uni.navigateBack()
}
},
getCoupon(e) {
const that = this
let param={

@ -1,30 +1,63 @@
<template>
<view class="record">
<view class="item" v-for="o in 10" :key="o">
<view class="item" v-for="(item,index) in preList" :key="index">
<view class="hd">
<image src="@/static/home/phone.jpg"></image>
<view class="info">
<view class="a">iphone13 绿色 128GBiphone13 绿色 128GBiphone13 绿色 128GBiphone13 绿色 128GB</view>
<view class="b"><text>倒计时</text><u-count-down :timestamp="timestamp" format="HH:mm:ss"></u-count-down></view>
<view class="c">预约价:<text>3599</text></view>
<view class="a">{{item.goods_name}}</view>
<view class="b"><text>倒计时</text><u-count-down :timestamp="item.p_time" ></u-count-down></view>
<view class="c">预约价:<text>{{item.goods_price_min}}</text></view>
</view>
<view class="status">已预约</view>
</view>
<view class="bd">
<view class="btn">取消</view>
<view class="btn btn-01">详情</view>
<view class="btn" @click="cancelPre(item.id)">取消</view>
<view class="btn btn-01" @click="goDetail(item.id)">详情</view>
</view>
</view>
<view class="content" v-if="preList.length==0">
暂无预约记录
</view>
</view>
</template>
<script>
<script>
import * as preInfo from '@/api/preList/index.js'
export default {
data() {
return {
timestamp: 24*3600*1000,
timestamp: 24*3600*1000,
preList:[]
};
}
},
onShow(){
this.getPreList()
},
methods:{
getPreList(){
preInfo.list({page:1}).then(res=>{
if(res.status==200){
this.preList = res.data.list.data
}
})
},
cancelPre(val){
preInfo.list({id:pre}).then(res=>{
if(res.status==200){
this.$toast(res.message)
this.getPreList()
}
})
},
goDetail(val){
uni.navigateTo({
url:'/pages/goods/detail?isPre=true&goodsId='+val
})
},
},
}
</script>
@ -119,5 +152,13 @@
}
}
}
}
.content{
padding-top: 50%;
text-align: center;
width: 100%;
color: gray;
font-size: 28rpx;
line-height: 30rpx;
}
</style>

@ -1,39 +1,39 @@
<template>
<view class="pages">
<view class="header">
<u-navbar is-back="false" :title="title" ></u-navbar>
<u-navbar is-back="false" :title="title"></u-navbar>
</view>
<view class="content">
<view v-for="(item,index) in list" :key="index" class="item">
<view class="title" @click="goRules(item)">
{{item.title}}
</view>
<u-line />
</view>
</view>
</view>
</template>
<script>
export default{
data(){
return{
title:'',
list:[],
itemInfo:{}
export default {
data() {
return {
title: '',
list: [],
itemInfo: {}
}
},
onLoad(options){
onLoad(options) {
this.itemInfo = JSON.parse(options.itemInfo)
this.title = this.itemInfo.name
this.list = this.itemInfo.child
},
methods:{
goRules(item){
methods: {
goRules(item) {
uni.navigateTo({
url:'/pages/news/rules/index?itemInfo='+JSON.stringify(item)
url: '/pages/news/rules/index?itemInfo=' + JSON.stringify(item)
})
}
}
@ -41,15 +41,17 @@
</script>
<style scoped lang="scss">
.pages{
.pages {
width: 100%;
height: 100%;
padding: 30rpx;
}
.item{
.item {
margin-bottom: 28rpx;
}
.title{
.title {
margin-bottom: 28rpx;
}
</style>

@ -79,10 +79,13 @@
this.searchList = uni.getStorageSync('searchList')
this.searchList = Array.from(new Set(this.searchList));
}
this.getHot()
},
methods: {
getHot(){
},
searchGoods(item){
this.searchList.push(this.searchValue)
this.searchList = Array.from(new Set(this.searchList));

@ -23,7 +23,7 @@
</view>
</view>
<view class="getSelf">
<view class="shopAddress">
<view class="shopAddress" v-if="buyType=='zq'">
<view class="youTime">
花梨服务站
</view>
@ -33,9 +33,9 @@
</view>
</view>
<view class="addressDetail">
{{addressInfo.name}}
{{addressInfo.name}} {{addressInfo.region.province +addressInfo.region.city+addressInfo.region.region}}
</view>
<view class="lookMap">
<view class="lookMap" v-if="buyType=='zq'">
<image src="/static/user/address.png" mode="" class="addressIcon"></image>
<view class="range">
距您16.39km
@ -94,7 +94,7 @@
<switch />
</view>
</view>
<view class="time">
<!-- <view class="time">
<view class="youTime">
预计到货时间
</view>
@ -103,8 +103,8 @@
<image src="/static/order/left.png" mode=""></image>
</view>
</view>
<view class="time">
</view> -->
<!-- <view class="time">
<view class="youTime">
您期待的收货时间
</view>
@ -112,7 +112,7 @@
请选择
<image src="/static/order/left.png" mode=""></image>
</view>
</view>
</view> -->
<view class="goodsDetail">
<view class="goodsType">
<image src="/static/order/bag.png" mode="" class="bag"></image>
@ -121,14 +121,14 @@
</view>
<view class="goods">
<view class="goodsImg">
<image src="/static/home/goodsDemo.png" mode=""></image>
<image :src="goodsInfo.goods_image" mode=""></image>
</view>
<view class="goodsInfo">
<view class="goodsName">
iphone13 绿色 128GB
{{goodsInfo.goods_name}}
</view>
<view class="goodsPrice">
<text>7599</text>
<text>{{goodsInfo.goods_price_min}}</text>
</view>
</view>
<view class="goodsNum">
@ -137,13 +137,11 @@
</view>
</view>
<view class="time">
<view class="youTime">
<view class="youTime" style="width: 60rpx;">
留言
</view>
<view class="leftImg">
建议留言前与客服沟通确认
<image src="/static/order/left.png" mode=""></image>
</view>
<input type="textarea" placeholder="建议留言前先和店家沟通" v-model="remark" style="width:100%;" maxlength="100" />
</view>
<view class="orderTips">
<view class="orderTitle">
@ -151,7 +149,7 @@
商品总额
</view>
<view class="price">
7599
{{goodsInfo.goods_price_min}}
</view>
</view>
<view class="orderTitle">
@ -159,7 +157,7 @@
运费
</view>
<view class="price">
7599
{{goodsInfo.goods_price_min}}
</view>
</view>
<view class="orderTitle">
@ -174,8 +172,8 @@
<view class="total">
优惠券
</view>
<view class="price">
<text class="couponNum">0张可用</text>
<view class="price" @click="choseCoupon">
<text class="couponNum">{{couponList.length}}张可用</text>
<image src="/static/order/left.png" mode=""></image>
</view>
</view>
@ -188,7 +186,7 @@
</view>
<view class="right">
<text class="totalNum">共1件合计</text>
<text class="allPrice">7664</text>
<text class="allPrice">{{goodsInfo.goods_price_min}}</text>
</view>
</view>
</view>
@ -204,30 +202,32 @@
</view>
<view class="itemType">
<view class="payName">
<image src="/static/order/friends.png" mode="" class="payIcon"></image>
找微信好友代付
<view class="" v-for="(item,index) in payMethList" :key="index" @click="chosePayType(item)">
<view class="payName">
<image src="/static/order/friends.png" mode="" class="payIcon"></image>
余额支付
</view>
<image src="/static/order/right.png" mode="" class="chose" v-if="payType==item.method"></image>
</view>
<!-- <image src="/static/order/right.png" mode="" class="chose"></image> -->
</view>
<view class="line">
</view>
<view class="itemType">
<!-- <view class="itemType">
<view class="payName">
<image src="/static/order/shop.png" mode="" class="payIcon"></image>
到店支付
</view>
<!-- <image src="/static/order/right.png" mode="" class="chose"></image> -->
</view>
</view> -->
</view>
<view class="footer">
<view class="meetPrice">
应付款
<text class="type"></text>
<text class="price">7640</text>
<text class="price">{{goodsInfo.goods_price_min}}</text>
</view>
<view class="btn" @click="orderSubmit">
<view class="btn" @click="orderPay">
提交订单
</view>
</view>
@ -239,9 +239,16 @@
import img from "@/static/member/head.png"
import * as storeShop from '@/api/shop.js'
import * as address from '@/api/address.js'
import * as cashier from '@/api/cashier/index.js'
import * as CouponApi from '@/api/coupon'
import {
Wechat
} from '@/core/payment'
export default {
data() {
return {
remark: '',
payType: 'weChat',
buyType: 'sm',
background: {
background: 'url(' + img + ') center top no-repeat',
@ -250,31 +257,61 @@
goodsInfo: {},
shopInfo: {},
addressList: [],
addressInfo: {}
addressInfo: {},
payMethList: [],
orderID: '',
couponList: [],
}
},
onLoad(options) {
if (options.goodsInfo) {
this.goodsInfo = JSON.parse(options.goodsInfo)
}
console.log(options, 'kkkkkk')
// if (options.goodsInfo) {
let goodsInfo = options.goodsID;
console.log(goodsInfo, '5555555', typeof(goodsInfo));
this.goodsInfo = JSON.parse(decodeURIComponent(goodsInfo))
console.log(this.goodsInfo, '666666');
// }
},
onShow() {
this.getGoodsInfo()
this.getShopInfo()
this.getAddressList();
this.orderSubmit()
this.getCoupon()
},
methods: {
getCoupon() {
const that =this
let param = {
dataType:'isUsable'
}
CouponApi.myCouponList(param)
.then(res => {
that.couponList = res.data.list.data
})
.finally()
},
choseCoupon() {
//
uni.navigateTo({
url: '/pages/news/coupon/list?chose=true',
})
},
chosePayType(item) {
this.payType = item.method
},
choseType(val) {
this.buyType = val
},
getDefaultAddress() {
const that = this
return new Promise((resolve, reject) => {
address.defaultId().then(res => {
if (res.code == 200) {
if (res.status == 200) {
for (var i = 0; i < that.addressList.length; i++) {
if (res.data.defaultId == that.addressList[i].address_id) {
that.addressInfo = that.addressList[i]
that.getOrderInfo()
console.log(that.addressInfo, '获取收货地址')
}
}
}
@ -282,23 +319,11 @@
.catch()
})
},
getOrderInfo() {
const that = this
return new Promise((resolve, reject) => {
address.list().then(res => {
if (res.code == 200) {
that.addressList = res.data.list
that.getDefaultAddress()
}
})
.catch()
})
},
getAddressList() {
const that = this
return new Promise((resolve, reject) => {
address.list().then(res => {
if (res.code == 200) {
if (res.status == 200) {
that.addressList = res.data.list
that.getDefaultAddress()
}
@ -306,7 +331,7 @@
.catch()
})
},
getGoodsInfo() {
getShopInfo() {
return new Promise((resolve, reject) => {
storeShop.list().then(res => {
console.log(res, '获取店铺信息')
@ -316,25 +341,131 @@
},
orderSubmit() {
const that = this
const that = this;
console.log(that.goodsInfo, '55555')
let params = {
mode: '结算模式',
delivery: '配送方式(10快递配送 20上门自提',
mode: 'buyNow',
delivery: '10',
couponId: '',
isUsePoints: 0,
remark: '留言',
remark: that.remark,
shopId: '',
linkman: '姓名',
phone: '手机哈',
goodsId: '商品id',
linkman: '',
phone: '',
goodsId: that.goodsInfo.goods_id,
goodsNum: 1,
goodsSkuId: '',
goodsSkuId: that.goodsInfo.skuList[0].goods_sku_id,
cartIds: ''
}
order.submit(params)
order.submit('buyNow', params)
.then(res => {
if (res.status == 200) {
that.orderId = res.data.orderId
that.getOrderInfoPay(res.data.orderId)
}
})
.catch()
},
getOrderInfoPay(val) {
cashier.orderInfo(val).then(res => {
if (res.status == 200) {
this.payMethList = res.data.paymentMethods
}
})
.catch()
},
onShowSuccess(res) {
this.$toast(message || '订单支付成功')
uni.navigateTo({
url: '/pages/news/recycling/orderList'
})
},
orderPay() {
const that = this
if (that.payType == 'balance') {
that.payBanlance()
return
}
cashier.orderPay(that.orderID).then(res => {
if (res.status == 200) {
let paymentData = res.data.payment
Wechat.payment({
orderKey: res.data.payment.out_trade_no,
...paymentData
})
.then((result) => {
console.log(result)
that.onShowSuccess(result)
})
.catch(err => {
console.log(err)
})
}
})
.catch()
},
payBanlance() {
const that = this
let params = {
extra: {},
method: 'balance',
client: 'weChat'
}
cashier.orderPay(that.orderID, params).then(res => {
that.$toast(res.message)
if (res.status == 200) {
setTimeout(() => {
uni.navigateTo({
url: '/pages/news/recycling/orderList'
})
}, 1000)
}
})
.catch()
},
// getOrderInfo() {
// const that = this
// let params = {
// orderId: 10202,
// client: 'wechat'
// }
// cashier.orderInfo(params)
// .then(res => {
// if (res.status == 200) {
// that.payOrderInfo()
// }
// })
// .catch()
// },
payOrderInfo() {
const that = this
let form = {
client: 'wechat',
method: 'wechat',
extra: {}
}
cashier.orderInfo(10202, form)
.then(res => {
if (res.status == 200) {
// that.$toast(res.message)
let paymentData = res.data.payment
Wechat.payment({
orderKey: res.data.payment.out_trade_no,
...paymentData
})
.then((result) => {
console.log(result)
})
.catch(err => {
console.log(err)
})
}
})
.catch()
@ -607,7 +738,7 @@
.goodsDetail {
width: 694rpx;
height: 266rpx;
min-height: 266rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
opacity: 1;
@ -656,7 +787,7 @@
margin-left: 20rpx;
.goodsName {
height: 40rpx;
min-height: 40rpx;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;

@ -126,7 +126,7 @@
</view>
<view class="coupon" v-if="userInfo.user_type!=40">
<view class="walletList">
<view class="listItem">
<view class="listItem" @click="preList">
<view class="num">
235
</view>
@ -486,6 +486,11 @@
this.getSuggest()
},
methods: {
preList(){
uni.navigateTo({
url:'/pages/news/park/recordHistory'
})
},
getSuggest() {
//
const that = this

Loading…
Cancel
Save