作者 燕成杰

功能:我的发布、修改

@@ -35,3 +35,8 @@ export const moneyLog = (page) => request({url: 'user/user_money_log',method: ' @@ -35,3 +35,8 @@ export const moneyLog = (page) => request({url: 'user/user_money_log',method: '
35 // 我的收藏 /api/user/my_fav 35 // 我的收藏 /api/user/my_fav
36 export const myFav = (page) => request({url: 'user/my_fav',method: 'post',data:{page}}) 36 export const myFav = (page) => request({url: 'user/my_fav',method: 'post',data:{page}})
37 37
  38 +// 我的物品 /api/user/my_product
  39 +export const myProduct = (status,page,pagenum) => request({url: 'user/my_product',method: 'post',data:{status,page,pagenum}})
  40 +
  41 +// 删除我的物品 /api/user/product_del
  42 +export const delProduct = (product_id) => request({url: 'user/product_del',method: 'post',data:{product_id}})
@@ -4,8 +4,8 @@ import { @@ -4,8 +4,8 @@ import {
4 4
5 5
6 // 买家订单 /api/order/order_list 6 // 买家订单 /api/order/order_list
7 -export const buyerOrderList = (page,pagenum,type) => request({url: 'order/order_list',method: 'post',data: {page,pagenum,type}}) 7 +export const buyerOrderList = (status,page,pagenum,type) => request({url: 'order/order_list',method: 'post',data: {status,page,pagenum,type}})
8 8
9 9
10 // 卖家订单 /api/order/order_seller_list 10 // 卖家订单 /api/order/order_seller_list
11 -export const sellerOrderList = (page,pagenum,type) => request({url: 'order/order_seller_list',method: 'post',data: {page,pagenum,type}})  
  11 +export const sellerOrderList = (status,page,pagenum,type) => request({url: 'order/order_seller_list',method: 'post',data: {status,page,pagenum,type}})
@@ -21,4 +21,5 @@ export const sendProduct = (data) => request({url: 'product/product_publish',met @@ -21,4 +21,5 @@ export const sendProduct = (data) => request({url: 'product/product_publish',met
21 export const payGuarantee = () => request({url: 'user/user_cert_withdraw',method: 'post',}) 21 export const payGuarantee = () => request({url: 'user/user_cert_withdraw',method: 'post',})
22 22
23 // 获取微信授权登录页面 /api/user/getAuthorizeUrl 23 // 获取微信授权登录页面 /api/user/getAuthorizeUrl
24 - export const authorization = (redirect_uri) => request({url: 'user/getAuthorizeUrl',method: 'post',data:{redirect_uri}})  
  24 + export const authorization = (redirect_uri) => request({url: 'user/getAuthorizeUrl',method: 'post',data:{redirect_uri}})
  25 +
@@ -158,7 +158,7 @@ @@ -158,7 +158,7 @@
158 <script> 158 <script>
159 import {baseURL} from '@/utils/request.js' 159 import {baseURL} from '@/utils/request.js'
160 import Botton from "@/components/Botton.vue" 160 import Botton from "@/components/Botton.vue"
161 - import {sortList} from '@/api/index' 161 + import {sortList,product_detail} from '@/api/index'
162 import {toa} from '@/utils/toast.js' 162 import {toa} from '@/utils/toast.js'
163 import { getCategory,sendProduct,getLastInfo,payGuarantee,authorization } from '@/api/send' 163 import { getCategory,sendProduct,getLastInfo,payGuarantee,authorization } from '@/api/send'
164 export default { 164 export default {
@@ -190,13 +190,42 @@ @@ -190,13 +190,42 @@
190 } 190 }
191 } 191 }
192 }, 192 },
193 - onLoad() { 193 + onLoad(e) {
  194 + if(e.id){
  195 + this.form.product_id = e.id
  196 + this.getDetail()
  197 + }
194 this.getLastInfo() 198 this.getLastInfo()
195 this.sortList() 199 this.sortList()
  200 +
196 }, 201 },
197 onShow() { 202 onShow() {
198 }, 203 },
199 methods: { 204 methods: {
  205 + // 获取详情
  206 + async getDetail(){
  207 + try {
  208 + const res = await product_detail(this.form.product_id)
  209 + // this.form = res.detail
  210 + this.form.sort_id = res.detail.sort.id
  211 + this.sortName = res.detail.sort.name
  212 + this.form.product_id = res.detail.id
  213 + this.form.name = res.detail.name
  214 + this.form.price = res.detail.price
  215 + this.form.description = res.detail.description
  216 + res.detail.fileList.forEach(it=>{
  217 + it.shortUrl = it.url
  218 + it.url = it.fullUrl
  219 + })
  220 + this.fileList1 = res.detail.fileList
  221 + console.log(this.fileList1,'图片');
  222 + console.log('getDetail', res)
  223 + // 保存数据
  224 + } catch (err) {
  225 + uni.showToast({ title:err,icon:'none' })
  226 + console.log('getDetail', err)
  227 + }
  228 + },
200 checkNumber(e) { 229 checkNumber(e) {
201 let val = e.target.value.replace(/(^\s*)|(\s*$)/g, "") 230 let val = e.target.value.replace(/(^\s*)|(\s*$)/g, "")
202 var reg = /[^\d.]/g 231 var reg = /[^\d.]/g
@@ -317,6 +346,12 @@ @@ -317,6 +346,12 @@
317 try { 346 try {
318 const res = await sendProduct(this.form) 347 const res = await sendProduct(this.form)
319 console.log('sendProduct', res) 348 console.log('sendProduct', res)
  349 + setTimeout(()=>{
  350 + toa.success(this.form.product_id?'修改成功':'发布成功')
  351 + },400)
  352 + uni.redirectTo({
  353 + url:'/pages/mine/myRelease'
  354 + })
320 // 保存数据 355 // 保存数据
321 } catch (err) { 356 } catch (err) {
322 uni.showToast({ title:err,icon:'none' }) 357 uni.showToast({ title:err,icon:'none' })
1 <template> 1 <template>
2 <view class=""> 2 <view class="">
3 <u-sticky bgColor="#fff"> 3 <u-sticky bgColor="#fff">
4 - <u-tabs :list="list2" lineColor="#FED000" :scrollable="false" @click="click"></u-tabs> 4 + <u-tabs :list="list2" lineColor="#FED000" :scrollable="false" @click="toggle"></u-tabs>
5 </u-sticky> 5 </u-sticky>
6 - <view class="misslist"> 6 + <u-empty
  7 + marginTop="251"
  8 + mode="list"
  9 + text="暂无数据"
  10 + v-if="!list.length"
  11 + >
  12 + </u-empty>
  13 + <view class="misslist" v-if="list.length">
7 <custom-waterfalls-flow :isSend="1" :value="list" :columnSpace="1.5" :seat="2" @edit="edit" @del="del" @wapperClick="wapperClick" @imageClick="wapperClick"> 14 <custom-waterfalls-flow :isSend="1" :value="list" :columnSpace="1.5" :seat="2" @edit="edit" @del="del" @wapperClick="wapperClick" @imageClick="wapperClick">
8 15
9 <template v-slot:default="item"> 16 <template v-slot:default="item">
10 <view class="item"> 17 <view class="item">
11 - <view class="title">{{item.title}}</view>  
12 - <view class="desc">{{item.desc}}</view> 18 + <view class="title">{{item.name}}</view>
  19 + <view class="desc">所属分裂 {{item.sort.name}}</view>
13 <view class="desc flexA"> 20 <view class="desc flexA">
14 - 张三 21 + {{item.seller_name}}
15 <view class="money"> 22 <view class="money">
16 - <text style="font-size: 20rpx;">¥</text>120 23 + <text style="font-size: 20rpx;">¥</text>{{item.price}}
17 </view> 24 </view>
18 </view> 25 </view>
19 </view> 26 </view>
20 </template> 27 </template>
21 </custom-waterfalls-flow> 28 </custom-waterfalls-flow>
22 </view> 29 </view>
  30 + <u-modal :show="showDel" :showCancelButton="true" @confirm="delPro" @cancel="showDel=false" content='您是否删除此物品'></u-modal>
23 </view> 31 </view>
24 </template> 32 </template>
25 33
26 34
27 <script> 35 <script>
  36 + var that
  37 + import { myProduct ,delProduct} from '@/api/mine.js'
  38 + import {toa} from '@/utils/toast.js'
28 export default { 39 export default {
29 data() { 40 data() {
30 return { 41 return {
@@ -35,50 +46,109 @@ @@ -35,50 +46,109 @@
35 }, { 46 }, {
36 name: '已售出' 47 name: '已售出'
37 }], 48 }],
38 - list: [{  
39 - image: 'https://via.placeholder.com/200x500.png/ff0000',  
40 - title: '比特币',  
41 - desc: '所属分类:1 文博收藏品'  
42 - }, {  
43 - image: 'https://via.placeholder.com/200x300.png/9400D3',  
44 - title: '我是标题4',  
45 - desc: '描述描述描述描述描述描述描述描述4'  
46 - },  
47 - {  
48 - image: 'https://via.placeholder.com/100x240.png/B0E0E6',  
49 - title: '我是标题5',  
50 - desc: '描述描述描述描述描述描述描述描述5'  
51 - },  
52 - {  
53 - image: 'https://via.placeholder.com/140x280.png/7FFFAA',  
54 - title: '我是标题6',  
55 - desc: '描述描述描述描述描述描述描述描述6'  
56 - },  
57 - {  
58 - image: 'https://via.placeholder.com/40x60.png/EEE8AA',  
59 - title: '我是标题7',  
60 - desc: '描述描述描述描述描述描述描述描述7'  
61 - }  
62 - ] 49 + list: [],
  50 + // [ {
  51 + // image: 'https://via.placeholder.com/200x500.png/ff0000',
  52 + // title: '比特币',
  53 + // desc: '所属分类:1 文博收藏品'
  54 + // }, {
  55 + // image: 'https://via.placeholder.com/200x300.png/9400D3',
  56 + // title: '我是标题4',
  57 + // desc: '描述描述描述描述描述描述描述描述4'
  58 + // },
  59 + // {
  60 + // image: 'https://via.placeholder.com/100x240.png/B0E0E6',
  61 + // title: '我是标题5',
  62 + // desc: '描述描述描述描述描述描述描述描述5'
  63 + // },
  64 + // {
  65 + // image: 'https://via.placeholder.com/140x280.png/7FFFAA',
  66 + // title: '我是标题6',
  67 + // desc: '描述描述描述描述描述描述描述描述6'
  68 + // },
  69 + // {
  70 + // image: 'https://via.placeholder.com/40x60.png/EEE8AA',
  71 + // title: '我是标题7',
  72 + // desc: '描述描述描述描述描述描述描述描述7'
  73 + // }
  74 + // ]
  75 + page:1,
  76 + num:15,
  77 + idx:0,
  78 + delId:'',
  79 + showDel:false
63 } 80 }
64 }, 81 },
  82 + onLoad() {
  83 + that = this
  84 + this.myProduct()
  85 + },
65 methods: { 86 methods: {
  87 + async myProduct(f){
  88 + console.log(f);
  89 + try {
  90 + toa.loading('加载中')
  91 + const res = await myProduct(this.idx,this.page,this.num)
  92 + toa.hideLoading()
  93 + this.lastPage = res.list.last_page
  94 + res.list.data.forEach(it=>it.image = it.images_preview[0])
  95 + this.list = f?res.list.data :this.list.concat(res.list.data)
  96 + console.log('myProduct', res,this.list)
  97 + // 保存数据
  98 + } catch (err) {
  99 + uni.showToast({ title:err,icon:'none' })
  100 + console.log('myProduct', err)
  101 + }
  102 + },
66 edit(e){ 103 edit(e){
67 console.log('edit',e); 104 console.log('edit',e);
  105 + uni.navigateTo({
  106 + url:'/pages/index/send?id=' + e.id
  107 + })
  108 + console.log('跳转');
68 }, 109 },
69 del(e){ 110 del(e){
  111 + this.delId = e.id
  112 + this.showDel = true
70 console.log('del',e); 113 console.log('del',e);
71 }, 114 },
72 wapperClick(item) { 115 wapperClick(item) {
  116 + uni.navigateTo({
  117 + url:'/pages/index/detail?id='+item.id
  118 + })
73 console.log('单项点击事件', item) 119 console.log('单项点击事件', item)
  120 + },
  121 + toggle(e){
  122 + this.idx = e.index
  123 + this.page = 1
  124 + this.myProduct(1)
  125 + console.log(e);
  126 + },
  127 + async delPro(){
  128 + try {
  129 + const res = await delProduct(this.delId)
  130 + console.log('delProduct', res)
  131 + setTimeout(()=>{
  132 + toa.success('删除成功')
  133 + },200)
  134 + this.page = 1
  135 + this.showDel = false
  136 + this.list = []
  137 + this.myProduct(1)
  138 + // 保存数据
  139 + } catch (err) {
  140 + uni.showToast({ title:err,icon:'none' })
  141 + console.log('delProduct', err)
  142 + }
74 } 143 }
75 }, 144 },
76 // 触底触发 145 // 触底触发
77 onReachBottom() { 146 onReachBottom() {
78 - // if(that.page >= that.lastPage) return  
79 - // that.page=that.page+1 147 + if(that.page >= that.lastPage) return
  148 + that.page=that.page+1
  149 + this.myProduct()
80 // this.getForum() 150 // this.getForum()
81 - this.list = this.list.concat(this.list) 151 + // this.list = this.list.concat(this.list)
82 }, 152 },
83 } 153 }
84 </script> 154 </script>
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <template> 2 <template>
3 <view class=""> 3 <view class="">
4 <u-sticky bgColor="#fff"> 4 <u-sticky bgColor="#fff">
5 - <u-tabs :list="list2" lineColor="#FED000" :scrollable="false" @click="click"></u-tabs> 5 + <u-tabs :list="list2" lineColor="#FED000" :scrollable="false" @click="toggle"></u-tabs>
6 </u-sticky> 6 </u-sticky>
7 <view class="group"> 7 <view class="group">
8 <view class="item" v-for="(item,idx) in 20" :key="idx"> 8 <view class="item" v-for="(item,idx) in 20" :key="idx">
@@ -98,7 +98,7 @@ @@ -98,7 +98,7 @@
98 </template> 98 </template>
99 99
100 <script> 100 <script>
101 - import { sellerOrderList } from '@/api/mine.js' 101 + import { sellerOrderList } from '@/api/order.js'
102 export default { 102 export default {
103 data() { 103 data() {
104 return { 104 return {
@@ -112,9 +112,12 @@ @@ -112,9 +112,12 @@
112 name: '已完成' 112 name: '已完成'
113 }], 113 }],
114 show:false, 114 show:false,
115 - showBuyer:true, 115 + showBuyer:false,
116 page:1, 116 page:1,
117 - num:10 117 + num:10,
  118 + idx:0,
  119 + lastPage:1,
  120 + list:[]
118 } 121 }
119 }, 122 },
120 onLoad() { 123 onLoad() {
@@ -122,16 +125,24 @@ @@ -122,16 +125,24 @@
122 125
123 }, 126 },
124 methods: { 127 methods: {
125 - async sellerOrderList(){ 128 + async sellerOrderList(f){
126 try { 129 try {
127 - const res = await sellerOrderList() 130 + const res = await sellerOrderList(this.idx,this.page,this.num)
128 console.log('sellerOrderList', res) 131 console.log('sellerOrderList', res)
  132 + this.lastPage = res.list.last_page
  133 + this.list = f?res.list.data :this.list.concat(res.list.data)
129 // 保存数据 134 // 保存数据
130 } catch (err) { 135 } catch (err) {
131 uni.showToast({ title:err,icon:'none' }) 136 uni.showToast({ title:err,icon:'none' })
132 console.log('sellerOrderList', err) 137 console.log('sellerOrderList', err)
133 } 138 }
134 }, 139 },
  140 + toggle(e){
  141 + this.idx = e.index
  142 + this.page = 1
  143 + this.sellerOrderList(1)
  144 + console.log(e);
  145 + },
135 }, 146 },
136 } 147 }
137 </script> 148 </script>
@@ -32,12 +32,12 @@ @@ -32,12 +32,12 @@
32 <!-- #ifndef MP-WEIXIN --> 32 <!-- #ifndef MP-WEIXIN -->
33 <slot v-bind="item2"></slot> 33 <slot v-bind="item2"></slot>
34 <!-- #endif --> 34 <!-- #endif -->
35 - <view v-if="isSend==1" class="topState flexC" :class="item2.title=='我是标题4'?'Sale':'Sold'">  
36 - {{item2.title=='我是标题4'?'售卖中':'已发货'}} 35 + <view v-if="isSend==1" class="topState flexC" :class="item2.status==1?'Sale':'Sold'">
  36 + {{item2.status==1?'售卖中':'已卖出'}}
37 </view> 37 </view>
38 <view class="bot" v-if="isSend==1"> 38 <view class="bot" v-if="isSend==1">
39 <image @click.stop="edit(item2)" src="/static/edit.png" mode=""></image> 39 <image @click.stop="edit(item2)" src="/static/edit.png" mode=""></image>
40 - <image @click.stop="del(item2)" src="/static/del.png" mode=""></image> 40 + <image @click.stop="del(item2,index2)" src="/static/del.png" mode=""></image>
41 </view> 41 </view>
42 </view> 42 </view>
43 </view> 43 </view>
@@ -276,8 +276,7 @@ @@ -276,8 +276,7 @@
276 edit(item){ 276 edit(item){
277 this.$emit('edit', item); 277 this.$emit('edit', item);
278 }, 278 },
279 - del(item){  
280 - console.log('del'); 279 + del(item,idx){
281 this.$emit('del', item); 280 this.$emit('del', item);
282 } 281 }
283 }, 282 },