更换版本
This commit is contained in:
169
pages/gujia/index.js
Normal file
169
pages/gujia/index.js
Normal file
@@ -0,0 +1,169 @@
|
||||
var t;
|
||||
(t = getApp()),
|
||||
Page({
|
||||
data: {
|
||||
isShow: !1,
|
||||
buttscan: !1,
|
||||
date: "请选择时间",
|
||||
address: "",
|
||||
cartype: "",
|
||||
licheng: "",
|
||||
userphone: "",
|
||||
carsimgs: [],
|
||||
},
|
||||
release: function (e) {
|
||||
var a = this,
|
||||
i = wx.getStorageSync("uid");
|
||||
if (i) {
|
||||
if (!a.data.buttscan) {
|
||||
a.setData({ buttscan: !0 });
|
||||
var s = e.detail.value.address;
|
||||
if ("" == s || "undefined" == s || "请输入卖车地点" == s)
|
||||
return (
|
||||
t.util.message({ title: "请输入卖车地点", type: "error" }),
|
||||
void a.setData({ buttscan: !1 })
|
||||
);
|
||||
var n = e.detail.value.cartype;
|
||||
if ("" == n || "undefined" == n || "请输入品牌车型" == n)
|
||||
return (
|
||||
t.util.message({ title: "请输入品牌车型", type: "error" }),
|
||||
void a.setData({ buttscan: !1 })
|
||||
);
|
||||
var r = a.data.date;
|
||||
if ("请选择时间" == r || "undefined" == r || "" == r)
|
||||
return (
|
||||
t.util.message({ title: "请选择上牌时间", type: "error" }),
|
||||
void a.setData({ buttscan: !1 })
|
||||
);
|
||||
var o = e.detail.value.licheng;
|
||||
if ("" == o || "undefined" == o || "请输入行驶里程" == o)
|
||||
return (
|
||||
t.util.message({ title: "请输入行驶里程", type: "error" }),
|
||||
void a.setData({ buttscan: !1 })
|
||||
);
|
||||
var u = e.detail.value.phone;
|
||||
if ("" == u || "undefined" == u)
|
||||
return (
|
||||
t.util.message({
|
||||
title: "请填写联系电话,或点击电话授权",
|
||||
type: "error",
|
||||
}),
|
||||
void a.setData({ buttscan: !1 })
|
||||
);
|
||||
var c = a.data.carsimgs;
|
||||
if (c.length < 1)
|
||||
return (
|
||||
t.util.message({ title: "请至少添加1个车辆图片", type: "error" }),
|
||||
void a.setData({ buttscan: !1 })
|
||||
);
|
||||
var d = [];
|
||||
for (var l in c)
|
||||
"" != c[l].imgshort &&
|
||||
"" != c[l].img &&
|
||||
(console.log(c[l]), console.log(c[l].imgshort), d.push(c[l]));
|
||||
var g = {
|
||||
r: "sale.index.ingujia",
|
||||
m: "monai_market",
|
||||
fomid: e.detail.formId,
|
||||
uid: i,
|
||||
address: s,
|
||||
topdate: r,
|
||||
cartype: n,
|
||||
phone: u,
|
||||
licheng: o,
|
||||
carimages: d,
|
||||
};
|
||||
t.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: g,
|
||||
cachetime: "0",
|
||||
success: function (t) {
|
||||
200 == t.data.message
|
||||
? (wx.showToast({
|
||||
title: "提交成功",
|
||||
icon: "success",
|
||||
duration: 2e3,
|
||||
}),
|
||||
a.setData({ buttscan: !1 }))
|
||||
: (console.log(t.data),
|
||||
wx.showToast({
|
||||
title: "提交失败请稍后再试",
|
||||
icon: "none",
|
||||
duration: 2e3,
|
||||
}),
|
||||
a.setData({ buttscan: !1 }));
|
||||
},
|
||||
fail: function (t) {
|
||||
a.setData({ buttscan: !1 });
|
||||
},
|
||||
});
|
||||
}
|
||||
} else a.setData({ isShow: !0 });
|
||||
},
|
||||
getPhoneNumber: function (e) {
|
||||
console.log(e);
|
||||
var a = this;
|
||||
t.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
r: "sale.index.userphone",
|
||||
m: "monai_market",
|
||||
iv: e.detail.iv,
|
||||
encryptedData: e.detail.encryptedData,
|
||||
},
|
||||
cachetime: "0",
|
||||
success: function (t) {
|
||||
a.setData({ userphone: t.data.data });
|
||||
},
|
||||
});
|
||||
},
|
||||
upcarsimgs: function (e) {
|
||||
var a = this;
|
||||
a.data.carsimgs.length >= 3
|
||||
? t.util.message({ title: "您添加的图片已经很多了", type: "error" })
|
||||
: t.upimgs({
|
||||
scannums: 3,
|
||||
filename: "cars",
|
||||
success: function (t) {
|
||||
for (var e in t) a.addinimgs(t[e]);
|
||||
},
|
||||
});
|
||||
},
|
||||
addinimgs: function (t) {
|
||||
var e = this.data.carsimgs,
|
||||
a = { img: t.all, imgshort: t.short };
|
||||
e.push(a), this.setData({ carsimgs: e });
|
||||
},
|
||||
showimgs: function (t) {
|
||||
var e = t.currentTarget.dataset.index,
|
||||
a = this.data.carsimgs;
|
||||
wx.previewImage({ current: a[e].img, urls: [a[e].img] });
|
||||
},
|
||||
upthiscarsimgs: function (e) {
|
||||
var a = e.currentTarget.dataset.index,
|
||||
i = this.data.carsimgs;
|
||||
t.util.request({
|
||||
url: "entry/wxapp/Api",
|
||||
data: {
|
||||
m: "monai_sharing",
|
||||
uid: t.getuid(),
|
||||
imgurl: i[a].img,
|
||||
r: "Upimg.delImg",
|
||||
},
|
||||
}),
|
||||
i.splice(a, 1),
|
||||
this.setData({ carsimgs: i });
|
||||
},
|
||||
onLoad: function (t) {},
|
||||
bindDateChange: function (t) {
|
||||
console.log("picker发送选择改变,携带值为", t.detail.value),
|
||||
this.setData({ date: t.detail.value });
|
||||
},
|
||||
onReady: function () {},
|
||||
onShow: function () {},
|
||||
onHide: function () {},
|
||||
onUnload: function () {},
|
||||
onPullDownRefresh: function () {},
|
||||
onReachBottom: function () {},
|
||||
onShareAppMessage: function () {},
|
||||
});
|
1
pages/gujia/index.json
Normal file
1
pages/gujia/index.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "navigationBarTitleText": "爱车估价", "usingComponents": {} }
|
30
pages/gujia/index.wxml
Normal file
30
pages/gujia/index.wxml
Normal file
@@ -0,0 +1,30 @@
|
||||
<form bindreset="formReset" bindsubmit="release" reportSubmit="true">
|
||||
<view class="body">
|
||||
<view class="modle"> 卖车地点 <input class="modle_right" name="address" placeholder="请输入卖车地点" placeholderStyle="color: #9295A8;" type="text"></input>
|
||||
</view>
|
||||
<view class="modle"> 品牌车型 <input class="modle_right" name="cartype" placeholder="请输入品牌车型" placeholderStyle="color: #9295A8;" type="text"></input>
|
||||
</view>
|
||||
<view class="modle"> 上牌时间 <picker bindchange="bindDateChange" class="modle_right" mode="date" value="{{date}}">
|
||||
<view class="picker"> {{date}} </view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="modle"> 行驶里程(万公里) <input class="modle_right" name="licheng" placeholder="请输入行驶里程" style="width:300rpx;"></input>
|
||||
</view>
|
||||
<view class="modle"> 联系方式 <button bindgetphonenumber="getPhoneNumber" class="shouquan_btn" openType="getPhoneNumber">电话授权</button>
|
||||
<input class="modle_right" name="phone" placeholder="请输入您的电话" style="margin-right:20rpx;width:300rpx;" value="{{userphone}}"></input>
|
||||
</view>
|
||||
<view class="modle" style="border-bottom:0"> 车辆详图 </view>
|
||||
<view class="shop_view_border">
|
||||
<view class="shop_view" wx:if="{{item.img!=''}}" wx:for="{{carsimgs}}" wx:key="item">
|
||||
<image bindtap="upthiscarsimgs" class="shop_view_closeimg" data-index="{{index}}" src="../image/tupiangb_btn.png"></image>
|
||||
<image bindtap="showimgs" class="shop_view_img" data-index="{{index}}" src="{{item.img}}"></image>
|
||||
</view>
|
||||
<view class="shop_view" wx:if="{{carsimgs.length<3}}">
|
||||
<image bindtap="upcarsimgs" class="shop_view_img" src="../image/tianjiantp_btn.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button class="commit_btn" formType="submit">估算价格</button>
|
||||
</form>
|
||||
<import src="/pages/alert/index.wxml"></import>
|
||||
<template is="alert" data="{{isShow:isShow}}"></template>
|
75
pages/gujia/index.wxss
Normal file
75
pages/gujia/index.wxss
Normal file
@@ -0,0 +1,75 @@
|
||||
page {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
.body {
|
||||
background: #fff;
|
||||
margin-top: 20rpx;
|
||||
padding-bottom: 24rpx;
|
||||
width: 100%;
|
||||
}
|
||||
.modle {
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
margin-left: 5%;
|
||||
width: 90%;
|
||||
}
|
||||
.modle_right {
|
||||
color: #9295a8;
|
||||
display: block;
|
||||
float: right;
|
||||
font-size: 24rpx;
|
||||
height: 88rpx;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-align: right;
|
||||
}
|
||||
.shop_view_border {
|
||||
width: 100%;
|
||||
}
|
||||
.shop_view {
|
||||
display: inline-block;
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
.shop_view,
|
||||
.shop_view_img {
|
||||
height: 165rpx;
|
||||
width: 165rpx;
|
||||
}
|
||||
.shop_view_closeimg {
|
||||
height: 38rpx;
|
||||
margin-left: 127rpx;
|
||||
position: absolute;
|
||||
width: 38rpx;
|
||||
}
|
||||
.commit_btn {
|
||||
background: #3d61f0;
|
||||
border-radius: 15rpx;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
margin: 80rpx auto 0;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
width: 690rpx;
|
||||
}
|
||||
button::after {
|
||||
border: none;
|
||||
}
|
||||
.shouquan_btn {
|
||||
background: #fff;
|
||||
border: 1rpx solid #3d61f0;
|
||||
border-radius: 10rpx;
|
||||
color: #3d61f0;
|
||||
float: right;
|
||||
font-size: 27rpx;
|
||||
height: 60rpx;
|
||||
line-height: 56rpx;
|
||||
margin-top: 14rpx;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
width: 150rpx;
|
||||
}
|
Reference in New Issue
Block a user