更换版本
This commit is contained in:
313
pages/salelist/index.js
Normal file
313
pages/salelist/index.js
Normal file
@@ -0,0 +1,313 @@
|
||||
var a;
|
||||
(a = getApp()),
|
||||
Page({
|
||||
data: {
|
||||
userinfo: [],
|
||||
settopfee: 0,
|
||||
settoptime: 0,
|
||||
carslist: [],
|
||||
table: ["全部", "未上架", "已上架"],
|
||||
activeIndex: 0,
|
||||
nav_width: "",
|
||||
onshelffee: "",
|
||||
dropdown: 1,
|
||||
page: 1,
|
||||
},
|
||||
onLoad: function () {
|
||||
var t = this;
|
||||
t.setData({ nav_width: 100 / t.data.table.length }),
|
||||
t.getcarslist(t, 0),
|
||||
a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: { m: "monai_market", r: "sale.salelist.getfee" },
|
||||
success: function (a) {
|
||||
(t.data.onshelffee = a.data.data.onshelffee),
|
||||
(t.data.settopfee = a.data.data.settopfee),
|
||||
(t.data.settoptime = a.data.data.settoptime);
|
||||
},
|
||||
});
|
||||
},
|
||||
onShow: function () {
|
||||
var a = this;
|
||||
a.getcarslist(a, a.data.activeIndex);
|
||||
},
|
||||
ActiveClick: function (a) {
|
||||
var t = this;
|
||||
t.setData({ activeIndex: a.currentTarget.dataset.index, page: 1 }),
|
||||
t.getcarslist(t, a.currentTarget.dataset.index);
|
||||
},
|
||||
getcarslist: function (t, e) {
|
||||
a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_market",
|
||||
uid: a.getuid(),
|
||||
leftid: "",
|
||||
types: e,
|
||||
r: "sale.salelist.getlist",
|
||||
},
|
||||
success: function (a) {
|
||||
t.setData({ carslist: a.data.data.cars, userinfo: a.data.data.user });
|
||||
},
|
||||
});
|
||||
},
|
||||
upthiscar: function (a) {
|
||||
var t = this,
|
||||
e = a.currentTarget.dataset.index,
|
||||
s = a.currentTarget.dataset.id;
|
||||
3 == t.data.carslist[e].status
|
||||
? t.data.settopfee > 0
|
||||
? wx.showModal({
|
||||
content:
|
||||
"需要支付" +
|
||||
t.data.settopfee +
|
||||
"元后会置顶" +
|
||||
t.data.settoptime +
|
||||
"天",
|
||||
success: function (a) {
|
||||
a.confirm
|
||||
? t.dosettoppay(s)
|
||||
: a.cancel && console.log("用户点击取消");
|
||||
},
|
||||
})
|
||||
: t.dosettoppay(s)
|
||||
: wx.showModal({
|
||||
content: "此商品未上架,请在上架后再进行置顶操作",
|
||||
showCancel: !1,
|
||||
});
|
||||
},
|
||||
dosettoppay: function (t) {
|
||||
a.util.request({
|
||||
url: "entry/wxapp/paysettop",
|
||||
data: { m: "monai_market", uid: a.getuid(), car: t },
|
||||
success: function (e) {
|
||||
e.data && e.data.data && 1e3 == e.data.message
|
||||
? a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_market",
|
||||
uid: a.getuid(),
|
||||
car: t,
|
||||
r: "sale.salelist.maketop",
|
||||
},
|
||||
success: function (a) {
|
||||
wx.showModal({
|
||||
content: a.data.message,
|
||||
success: function (a) {
|
||||
wx.reLaunch({ url: "/pages/index/index" });
|
||||
},
|
||||
});
|
||||
},
|
||||
})
|
||||
: e.data &&
|
||||
e.data.data &&
|
||||
!e.data.errno &&
|
||||
wx.requestPayment({
|
||||
timeStamp: e.data.data.timeStamp,
|
||||
nonceStr: e.data.data.nonceStr,
|
||||
package: e.data.data.package,
|
||||
signType: "MD5",
|
||||
paySign: e.data.data.paySign,
|
||||
success: function (s) {
|
||||
a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_market",
|
||||
uid: a.getuid(),
|
||||
car: t,
|
||||
orderid: e.data.data.orderid,
|
||||
r: "sale.salelist.maketop",
|
||||
},
|
||||
success: function (a) {
|
||||
wx.showModal({
|
||||
content: a.data.message,
|
||||
success: function (a) {
|
||||
wx.reLaunch({ url: "/pages/index/index" });
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
onReachBottom: function () {
|
||||
var t = this,
|
||||
e = t.data.carslist;
|
||||
2 != t.data.dropdown &&
|
||||
((t.data.dropdown = 2),
|
||||
a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_market",
|
||||
uid: a.getuid(),
|
||||
leftid: t.data.page + 1,
|
||||
types: t.data.activeIndex,
|
||||
r: "sale.salelist.getlist",
|
||||
},
|
||||
success: function (a) {
|
||||
var s = a.data.data.cars.length;
|
||||
if (s > 0) for (var n = 0; n < s; n++) e.push(a.data.data.cars[n]);
|
||||
t.setData({ carslist: e, page: t.data.page + 1 });
|
||||
},
|
||||
complete: function () {
|
||||
t.data.dropdown = 1;
|
||||
},
|
||||
}));
|
||||
},
|
||||
makeshelf: function (t) {
|
||||
var e = this,
|
||||
s = t.currentTarget.dataset.index,
|
||||
n = t.currentTarget.dataset.id,
|
||||
i = e.data.carslist[s];
|
||||
console.log(i),
|
||||
3 != i.status
|
||||
? i.status < 2 && 1 != e.data.userinfo.is_vip
|
||||
? e.data.onshelffee > 0
|
||||
? wx.showModal({
|
||||
content: "需要支付" + e.data.onshelffee + "元后才能上架哦",
|
||||
confirmColor: "#3d61f0",
|
||||
confirmText: "去支付",
|
||||
success: function (a) {
|
||||
a.confirm && e.dopay(e, n);
|
||||
},
|
||||
})
|
||||
: e.dopay(e, n)
|
||||
: (2 != i.status && 1 != e.data.userinfo.is_vip) ||
|
||||
wx.showModal({
|
||||
content: "是否更改当前状态",
|
||||
confirmColor: "#3d61f0",
|
||||
confirmText: "上架",
|
||||
success: function (t) {
|
||||
t.confirm &&
|
||||
a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_market",
|
||||
uid: a.getuid(),
|
||||
car: n,
|
||||
r: "sale.salelist.onshelf",
|
||||
},
|
||||
success: function (a) {
|
||||
wx.showModal({
|
||||
content: a.data.message,
|
||||
success: function () {
|
||||
wx.reLaunch({ url: "/pages/index/index" });
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
})
|
||||
: wx.showModal({
|
||||
content: "是否更改当前状态",
|
||||
confirmColor: "#3d61f0",
|
||||
confirmText: "下架",
|
||||
success: function (t) {
|
||||
t.confirm &&
|
||||
a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_market",
|
||||
uid: a.getuid(),
|
||||
car: n,
|
||||
r: "sale.salelist.downshelf",
|
||||
},
|
||||
success: function (a) {
|
||||
wx.showModal({ content: a.data.message }),
|
||||
e.getcarslist(e, e.data.activeIndex);
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
dopay: function (t, e) {
|
||||
a.util.request({
|
||||
url: "entry/wxapp/paysale",
|
||||
data: { m: "monai_market", uid: a.getuid(), car: e },
|
||||
success: function (s) {
|
||||
s.data && s.data.data && 1e3 == s.data.message
|
||||
? a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_market",
|
||||
uid: a.getuid(),
|
||||
car: e,
|
||||
r: "sale.salelist.onshelf",
|
||||
},
|
||||
success: function (a) {
|
||||
wx.showModal({ content: a.data.message }),
|
||||
t.getcarslist(t, t.data.activeIndex);
|
||||
},
|
||||
})
|
||||
: s.data &&
|
||||
s.data.data &&
|
||||
!s.data.errno &&
|
||||
wx.requestPayment({
|
||||
timeStamp: s.data.data.timeStamp,
|
||||
nonceStr: s.data.data.nonceStr,
|
||||
package: s.data.data.package,
|
||||
signType: "MD5",
|
||||
paySign: s.data.data.paySign,
|
||||
success: function (s) {
|
||||
a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_market",
|
||||
uid: a.getuid(),
|
||||
car: e,
|
||||
r: "sale.salelist.onshelf",
|
||||
},
|
||||
success: function (a) {
|
||||
wx.showModal({ content: a.data.message }),
|
||||
t.getcarslist(t, t.data.activeIndex);
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
delcar: function (t) {
|
||||
var e = this,
|
||||
s = t.currentTarget.dataset.index,
|
||||
n = t.currentTarget.dataset.id,
|
||||
i = e.data.carslist[s];
|
||||
console.log(i),
|
||||
wx.showModal({
|
||||
content: "确定删除当前汽车么?",
|
||||
confirmColor: "#F75F5F",
|
||||
confirmText: "删除",
|
||||
success: function (t) {
|
||||
t.confirm &&
|
||||
a.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_market",
|
||||
uid: a.getuid(),
|
||||
car: n,
|
||||
r: "sale.salelist.delsale",
|
||||
},
|
||||
success: function (a) {
|
||||
wx.showModal({ content: a.data.message }),
|
||||
e.getcarslist(e, e.data.activeIndex);
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
upcar: function (a) {
|
||||
var t = a.currentTarget.dataset.id;
|
||||
wx.navigateTo({ url: "/pages/saledetail/index?car=" + t });
|
||||
},
|
||||
detile: function (t) {
|
||||
var e = a.getAttr(t, "id");
|
||||
wx.navigateTo({ url: "/pages/home/carMessage/carMessage?id=" + e });
|
||||
},
|
||||
onReady: function () {},
|
||||
onHide: function () {},
|
||||
onUnload: function () {},
|
||||
onPullDownRefresh: function () {},
|
||||
onShareAppMessage: function () {},
|
||||
});
|
1
pages/salelist/index.json
Normal file
1
pages/salelist/index.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "navigationBarTitleText": " 我的汽车", "usingComponents": {} }
|
26
pages/salelist/index.wxml
Normal file
26
pages/salelist/index.wxml
Normal file
@@ -0,0 +1,26 @@
|
||||
<view class="modle_1_nav">
|
||||
<view bindtap="ActiveClick" class="modle_1_nav_modle {{activeIndex==index?'modle_1_nav_active':''}}" data-index="{{index}}" style="width:{{nav_width}}%" wx:for="{{table}}" wx:key="table">{{item}} <view class="modle_1_nav_modle_border" wx:if="{{activeIndex==index}}"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nav"></view>
|
||||
<view class="modle_border" wx:if="{{carslist.length>0}}" wx:for="{{carslist}}" wx:key="carslist">
|
||||
<view class="modle">
|
||||
<image bindtap="detile" class="modle_img" data-id="{{item.id}}" src="{{item.img_patch}}"></image>
|
||||
<view class="modle_name">
|
||||
<view bindtap="detile" class="modle_name_left" data-id="{{item.id}}">{{item.name}} {{item.km}}万公里 {{item.agelimit<1?'准新车':item.agelimit+'年车'}}</view>
|
||||
<view class="modle_name_right {{item.status==3&&item.audit_type==1?'modle_name_right_active':''}}"> {{item.price}}万 </view>
|
||||
</view>
|
||||
<view class="modle_time"> {{item.toptype}} </view>
|
||||
<view class="modle_btn_view"> {{item.status==3?'已上架':'未上架'}} <button bindtap="upcar" class="modle_chexing_btnsc btn_active" data-id="{{item.id}}" wx:if="{{item.status<2}}">编辑</button>
|
||||
<button bindtap="makeshelf" class="modle_chexing_btnsc btn_active" data-id="{{item.id}}" data-index="{{index}}" style="margin-right:20rpx;">{{item.status==3?'下架':'上架'}}</button>
|
||||
<button bindtap="delcar" class="modle_chexing_btnsc" data-id="{{item.id}}" data-index="{{index}}" style="margin-right:20rpx;">删除</button>
|
||||
<button bindtap="upthiscar" class="modle_chexing_btnsc btn_active" data-id="{{item.id}}" data-index="{{index}}" style="margin-right:20rpx;">置顶</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<block wx:if="{{carslist.length<=0}}">
|
||||
<import src="/pages/data_null/index.wxml"></import>
|
||||
<view>
|
||||
<template is="title" data="{{title:'暂无查看数据'}}"></template>
|
||||
</view>
|
||||
</block>
|
154
pages/salelist/index.wxss
Normal file
154
pages/salelist/index.wxss
Normal file
@@ -0,0 +1,154 @@
|
||||
page {
|
||||
height: 100%;
|
||||
}
|
||||
.modle_border {
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
}
|
||||
.modle {
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
height: 180rpx;
|
||||
margin-left: 5%;
|
||||
padding-bottom: 30rpx;
|
||||
padding-top: 30rpx;
|
||||
width: 90%;
|
||||
}
|
||||
.modle_img {
|
||||
float: left;
|
||||
height: 180rpx;
|
||||
width: 180rpx;
|
||||
}
|
||||
.modle_name {
|
||||
color: #333;
|
||||
font-size: 30rpx;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
.modle_chexing,
|
||||
.modle_name {
|
||||
float: left;
|
||||
padding-left: 25rpx;
|
||||
width: 470rpx;
|
||||
}
|
||||
.modle_chexing {
|
||||
color: #555;
|
||||
font-size: 26rpx;
|
||||
line-height: 54rpx;
|
||||
min-height: 54rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
word-break: keep-all;
|
||||
}
|
||||
.modle_chexing_btn {
|
||||
background: #3d61f0;
|
||||
border-radius: 10rpx;
|
||||
color: #fff;
|
||||
float: right;
|
||||
font-size: 20rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
text-align: center;
|
||||
width: 72rpx;
|
||||
}
|
||||
.modle_price {
|
||||
color: #f75f5f;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
margin-top: 35rpx;
|
||||
}
|
||||
.modle_price,
|
||||
.modle_time {
|
||||
float: left;
|
||||
line-height: 40rpx;
|
||||
padding-left: 20rpx;
|
||||
width: 475rpx;
|
||||
}
|
||||
.modle_time {
|
||||
color: #9295a8;
|
||||
font-size: 24rpx;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
.modle_btn_view {
|
||||
color: #f75f5f;
|
||||
float: left;
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
margin-top: 40rpx;
|
||||
padding-left: 20rpx;
|
||||
width: 475rpx;
|
||||
}
|
||||
.modle_chexing_btnsc {
|
||||
background: #fff;
|
||||
border: 1px solid #f75f5f;
|
||||
border-radius: 5rpx;
|
||||
color: #f75f5f;
|
||||
float: right;
|
||||
font-size: 25rpx;
|
||||
height: 38rpx;
|
||||
line-height: 38rpx;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
width: 72rpx;
|
||||
}
|
||||
button::after {
|
||||
border: none;
|
||||
}
|
||||
.modle_name_left {
|
||||
float: left;
|
||||
font-weight: 700;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 330rpx;
|
||||
word-break: keep-all;
|
||||
}
|
||||
.modle_name_right {
|
||||
color: #f75f5f;
|
||||
float: right;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.modle_name_right_active {
|
||||
color: #f75f5f;
|
||||
font-weight: 700;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.btn_active {
|
||||
border: 1rpx solid #333;
|
||||
color: #333;
|
||||
}
|
||||
.modle_1_nav {
|
||||
background-color: #fff;
|
||||
border-bottom: 1rpx solid #f9f9f9;
|
||||
color: #666;
|
||||
font-size: 28rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
position: fixed;
|
||||
top: 0rpx;
|
||||
width: 100%;
|
||||
z-index: 100;
|
||||
}
|
||||
.modle_1_nav_modle {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
word-break: keep-all;
|
||||
}
|
||||
.modle_1_nav_modle_border {
|
||||
background: #333;
|
||||
height: 5rpx;
|
||||
margin: 0 auto;
|
||||
width: 30rpx;
|
||||
}
|
||||
.modle_1_nav_active {
|
||||
color: #333;
|
||||
line-height: 62rpx;
|
||||
}
|
||||
.nav {
|
||||
height: 70rpx;
|
||||
width: 100%;
|
||||
}
|
Reference in New Issue
Block a user