作者 燕成杰

功能:我的发布、修改

... ... @@ -35,3 +35,8 @@ export const moneyLog = (page) => request({url: 'user/user_money_log',method: '
// 我的收藏 /api/user/my_fav
export const myFav = (page) => request({url: 'user/my_fav',method: 'post',data:{page}})
// 我的物品 /api/user/my_product
export const myProduct = (status,page,pagenum) => request({url: 'user/my_product',method: 'post',data:{status,page,pagenum}})
// 删除我的物品 /api/user/product_del
export const delProduct = (product_id) => request({url: 'user/product_del',method: 'post',data:{product_id}})
\ No newline at end of file
... ...
... ... @@ -4,8 +4,8 @@ import {
// 买家订单 /api/order/order_list
export const buyerOrderList = (page,pagenum,type) => request({url: 'order/order_list',method: 'post',data: {page,pagenum,type}})
export const buyerOrderList = (status,page,pagenum,type) => request({url: 'order/order_list',method: 'post',data: {status,page,pagenum,type}})
// 卖家订单 /api/order/order_seller_list
export const sellerOrderList = (page,pagenum,type) => request({url: 'order/order_seller_list',method: 'post',data: {page,pagenum,type}})
\ No newline at end of file
export const sellerOrderList = (status,page,pagenum,type) => request({url: 'order/order_seller_list',method: 'post',data: {status,page,pagenum,type}})
\ No newline at end of file
... ...
... ... @@ -21,4 +21,5 @@ export const sendProduct = (data) => request({url: 'product/product_publish',met
export const payGuarantee = () => request({url: 'user/user_cert_withdraw',method: 'post',})
// 获取微信授权登录页面 /api/user/getAuthorizeUrl
export const authorization = (redirect_uri) => request({url: 'user/getAuthorizeUrl',method: 'post',data:{redirect_uri}})
\ No newline at end of file
export const authorization = (redirect_uri) => request({url: 'user/getAuthorizeUrl',method: 'post',data:{redirect_uri}})
... ...
... ... @@ -158,7 +158,7 @@
<script>
import {baseURL} from '@/utils/request.js'
import Botton from "@/components/Botton.vue"
import {sortList} from '@/api/index'
import {sortList,product_detail} from '@/api/index'
import {toa} from '@/utils/toast.js'
import { getCategory,sendProduct,getLastInfo,payGuarantee,authorization } from '@/api/send'
export default {
... ... @@ -190,13 +190,42 @@
}
}
},
onLoad() {
onLoad(e) {
if(e.id){
this.form.product_id = e.id
this.getDetail()
}
this.getLastInfo()
this.sortList()
},
onShow() {
},
methods: {
// 获取详情
async getDetail(){
try {
const res = await product_detail(this.form.product_id)
// this.form = res.detail
this.form.sort_id = res.detail.sort.id
this.sortName = res.detail.sort.name
this.form.product_id = res.detail.id
this.form.name = res.detail.name
this.form.price = res.detail.price
this.form.description = res.detail.description
res.detail.fileList.forEach(it=>{
it.shortUrl = it.url
it.url = it.fullUrl
})
this.fileList1 = res.detail.fileList
console.log(this.fileList1,'图片');
console.log('getDetail', res)
// 保存数据
} catch (err) {
uni.showToast({ title:err,icon:'none' })
console.log('getDetail', err)
}
},
checkNumber(e) {
let val = e.target.value.replace(/(^\s*)|(\s*$)/g, "")
var reg = /[^\d.]/g
... ... @@ -317,6 +346,12 @@
try {
const res = await sendProduct(this.form)
console.log('sendProduct', res)
setTimeout(()=>{
toa.success(this.form.product_id?'修改成功':'发布成功')
},400)
uni.redirectTo({
url:'/pages/mine/myRelease'
})
// 保存数据
} catch (err) {
uni.showToast({ title:err,icon:'none' })
... ...
<template>
<view class="">
<u-sticky bgColor="#fff">
<u-tabs :list="list2" lineColor="#FED000" :scrollable="false" @click="click"></u-tabs>
<u-tabs :list="list2" lineColor="#FED000" :scrollable="false" @click="toggle"></u-tabs>
</u-sticky>
<view class="misslist">
<u-empty
marginTop="251"
mode="list"
text="暂无数据"
v-if="!list.length"
>
</u-empty>
<view class="misslist" v-if="list.length">
<custom-waterfalls-flow :isSend="1" :value="list" :columnSpace="1.5" :seat="2" @edit="edit" @del="del" @wapperClick="wapperClick" @imageClick="wapperClick">
<template v-slot:default="item">
<view class="item">
<view class="title">{{item.title}}</view>
<view class="desc">{{item.desc}}</view>
<view class="title">{{item.name}}</view>
<view class="desc">所属分裂 {{item.sort.name}}</view>
<view class="desc flexA">
张三
{{item.seller_name}}
<view class="money">
<text style="font-size: 20rpx;">¥</text>120
<text style="font-size: 20rpx;">¥</text>{{item.price}}
</view>
</view>
</view>
</template>
</custom-waterfalls-flow>
</view>
<u-modal :show="showDel" :showCancelButton="true" @confirm="delPro" @cancel="showDel=false" content='您是否删除此物品'></u-modal>
</view>
</template>
<script>
var that
import { myProduct ,delProduct} from '@/api/mine.js'
import {toa} from '@/utils/toast.js'
export default {
data() {
return {
... ... @@ -35,50 +46,109 @@
}, {
name: '已售出'
}],
list: [{
image: 'https://via.placeholder.com/200x500.png/ff0000',
title: '比特币',
desc: '所属分类:1 文博收藏品'
}, {
image: 'https://via.placeholder.com/200x300.png/9400D3',
title: '我是标题4',
desc: '描述描述描述描述描述描述描述描述4'
},
{
image: 'https://via.placeholder.com/100x240.png/B0E0E6',
title: '我是标题5',
desc: '描述描述描述描述描述描述描述描述5'
},
{
image: 'https://via.placeholder.com/140x280.png/7FFFAA',
title: '我是标题6',
desc: '描述描述描述描述描述描述描述描述6'
},
{
image: 'https://via.placeholder.com/40x60.png/EEE8AA',
title: '我是标题7',
desc: '描述描述描述描述描述描述描述描述7'
}
]
list: [],
// [ {
// image: 'https://via.placeholder.com/200x500.png/ff0000',
// title: '比特币',
// desc: '所属分类:1 文博收藏品'
// }, {
// image: 'https://via.placeholder.com/200x300.png/9400D3',
// title: '我是标题4',
// desc: '描述描述描述描述描述描述描述描述4'
// },
// {
// image: 'https://via.placeholder.com/100x240.png/B0E0E6',
// title: '我是标题5',
// desc: '描述描述描述描述描述描述描述描述5'
// },
// {
// image: 'https://via.placeholder.com/140x280.png/7FFFAA',
// title: '我是标题6',
// desc: '描述描述描述描述描述描述描述描述6'
// },
// {
// image: 'https://via.placeholder.com/40x60.png/EEE8AA',
// title: '我是标题7',
// desc: '描述描述描述描述描述描述描述描述7'
// }
// ]
page:1,
num:15,
idx:0,
delId:'',
showDel:false
}
},
onLoad() {
that = this
this.myProduct()
},
methods: {
async myProduct(f){
console.log(f);
try {
toa.loading('加载中')
const res = await myProduct(this.idx,this.page,this.num)
toa.hideLoading()
this.lastPage = res.list.last_page
res.list.data.forEach(it=>it.image = it.images_preview[0])
this.list = f?res.list.data :this.list.concat(res.list.data)
console.log('myProduct', res,this.list)
// 保存数据
} catch (err) {
uni.showToast({ title:err,icon:'none' })
console.log('myProduct', err)
}
},
edit(e){
console.log('edit',e);
uni.navigateTo({
url:'/pages/index/send?id=' + e.id
})
console.log('跳转');
},
del(e){
this.delId = e.id
this.showDel = true
console.log('del',e);
},
wapperClick(item) {
uni.navigateTo({
url:'/pages/index/detail?id='+item.id
})
console.log('单项点击事件', item)
},
toggle(e){
this.idx = e.index
this.page = 1
this.myProduct(1)
console.log(e);
},
async delPro(){
try {
const res = await delProduct(this.delId)
console.log('delProduct', res)
setTimeout(()=>{
toa.success('删除成功')
},200)
this.page = 1
this.showDel = false
this.list = []
this.myProduct(1)
// 保存数据
} catch (err) {
uni.showToast({ title:err,icon:'none' })
console.log('delProduct', err)
}
}
},
// 触底触发
onReachBottom() {
// if(that.page >= that.lastPage) return
// that.page=that.page+1
if(that.page >= that.lastPage) return
that.page=that.page+1
this.myProduct()
// this.getForum()
this.list = this.list.concat(this.list)
// this.list = this.list.concat(this.list)
},
}
</script>
... ...
... ... @@ -2,7 +2,7 @@
<template>
<view class="">
<u-sticky bgColor="#fff">
<u-tabs :list="list2" lineColor="#FED000" :scrollable="false" @click="click"></u-tabs>
<u-tabs :list="list2" lineColor="#FED000" :scrollable="false" @click="toggle"></u-tabs>
</u-sticky>
<view class="group">
<view class="item" v-for="(item,idx) in 20" :key="idx">
... ... @@ -98,7 +98,7 @@
</template>
<script>
import { sellerOrderList } from '@/api/mine.js'
import { sellerOrderList } from '@/api/order.js'
export default {
data() {
return {
... ... @@ -112,9 +112,12 @@
name: '已完成'
}],
show:false,
showBuyer:true,
showBuyer:false,
page:1,
num:10
num:10,
idx:0,
lastPage:1,
list:[]
}
},
onLoad() {
... ... @@ -122,16 +125,24 @@
},
methods: {
async sellerOrderList(){
async sellerOrderList(f){
try {
const res = await sellerOrderList()
const res = await sellerOrderList(this.idx,this.page,this.num)
console.log('sellerOrderList', res)
this.lastPage = res.list.last_page
this.list = f?res.list.data :this.list.concat(res.list.data)
// 保存数据
} catch (err) {
uni.showToast({ title:err,icon:'none' })
console.log('sellerOrderList', err)
}
},
toggle(e){
this.idx = e.index
this.page = 1
this.sellerOrderList(1)
console.log(e);
},
},
}
</script>
... ...
... ... @@ -32,12 +32,12 @@
<!-- #ifndef MP-WEIXIN -->
<slot v-bind="item2"></slot>
<!-- #endif -->
<view v-if="isSend==1" class="topState flexC" :class="item2.title=='我是标题4'?'Sale':'Sold'">
{{item2.title=='我是标题4'?'售卖中':'已发货'}}
<view v-if="isSend==1" class="topState flexC" :class="item2.status==1?'Sale':'Sold'">
{{item2.status==1?'售卖中':'已卖出'}}
</view>
<view class="bot" v-if="isSend==1">
<image @click.stop="edit(item2)" src="/static/edit.png" mode=""></image>
<image @click.stop="del(item2)" src="/static/del.png" mode=""></image>
<image @click.stop="del(item2,index2)" src="/static/del.png" mode=""></image>
</view>
</view>
</view>
... ... @@ -276,8 +276,7 @@
edit(item){
this.$emit('edit', item);
},
del(item){
console.log('del');
del(item,idx){
this.$emit('del', item);
}
},
... ...