Browse Source

优化详情页

master
wanghongjun 2 years ago
parent
commit
84bcb416e0
  1. 12
      api/order.js
  2. 56
      api/order/comment.js
  3. 4
      pages.json
  4. 7
      pages/goods/payment/orderPayment.vue
  5. 292
      pages/user/order/buyOrder.vue

12
api/order.js

@ -12,6 +12,7 @@ const api = {
ordquery:'AgencyAddress/order/queryRrder', //订单查询
getTicket:'AgencyAddress/order/getTicket', //发票管理
delOrder:'AgencyAddress/order/delOrder', //单资源,资源集数据显示
}
// 当前用户待处理的订单数量
@ -63,4 +64,15 @@ export function getTicket(data){
"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"
}}
return request.post(api.getTicket,data,option)
}
// 资源集数据显示
export function getSourceNewList(batchcode,user_isli,orderDetail) {
let data = {
batchcode: batchcode,
user_isli: user_isli,
orderDetail: orderDetail,
user_role: 1
}
return request.post(api.delOrder, data)
}

56
api/order/comment.js

@ -15,3 +15,59 @@ export const list = (orderId, param) => {
export const submit = (orderId, data) => {
return request.post(api.submit, { orderId, form: data })
}
// 获取默认随机图片
export const getDefaultImage = () => {
let myPix = new Array("../../../portal/images/180-180.jpg", "../../../portal/images/180-180-2.jpg", "../../../portal/images/180-180-3.jpg", "../../../portal/images/180-180-3.jpg")
let randomNum = Math.floor((Math.random() * myPix.length))
return myPix[randomNum]
}
// 倒计时
export const getDateTime = (value,status) => {
if (typeof value == "string") {
value = new Date(value.replace(/-/g, "/"));
}
let date = new Date(value);
let myDate = new Date();
let newDate = date.getTime() + (1000 * 60 * 30);
let nowDate = newDate - myDate.getTime();
let new_nowDate = parseInt(nowDate);
value = parseInt(new_nowDate / 1000 / 60);
if (status == "1") {
return value + '分';
}
return value = '--';
}
// 金额保留两位小数
export const formatAmount = (amount) => {
// 将金额保留两位小数
const formattedAmount = parseFloat(amount).toFixed(2);
// 添加千位英文逗号分隔符
const parts = formattedAmount.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");
}
export const getDateTerm = (value,status) => {
if (typeof value == "string") {
value = new Date(value.replace(/-/g, "/"));
}
let date = new Date(value);
let myDate = new Date();
let newDate = date.getTime() + (24 * 60 * 60 * 1000 * 7);
let nowDate = newDate - myDate.getTime();
let new_nowDate = parseInt(nowDate);
value = parseInt(new_nowDate / 1000 / 60 / 60 / 24);
if (status == "1" || status == "5") {
return value = '--';
} else {
if (value < 0) {
return value = '已过期';
}
return value + '天';
}
}

4
pages.json

@ -318,6 +318,8 @@
"style" :
{
"navigationBarTitleText" : "买入订单",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#1c223b",
"enablePullDownRefresh" : false
}
},
@ -326,6 +328,8 @@
"style" :
{
"navigationBarTitleText" : "卖出订单",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#1c223b",
"enablePullDownRefresh" : false
}
},

7
pages/goods/payment/orderPayment.vue

@ -27,7 +27,9 @@
</uni-tr>
<uni-tr v-for="(item, index) in tableList" :key="index">
<uni-td align="center">
<image class="td-image" :src="item.order_detail[0].goods_image"></image>
<image v-if="item.order_detail[0].goods_image" class="td-image" :src="item.order_detail[0].goods_image"></image>
<image v-else-if="img" class="td-image" :src="img"></image>
<image v-else class="td-image" :src="Comment.getDefaultImage"></image>
</uni-td>
<uni-td align="center">{{ item.buy_username }}</uni-td>
<uni-td align="center">{{ item.buy_islicode }}</uni-td>
@ -74,6 +76,7 @@
import * as GoodsApi from '@/api/goods'
import * as VerifyApi from '@/api/verify'
import * as Comment from '@/api/order/comment'
import uniTable from "@/uni_modules/uni-table/components/uni-table/uni-table"
import uniTr from "@/uni_modules/uni-table/components/uni-tr/uni-tr"
import uniTh from "@/uni_modules/uni-table/components/uni-th/uni-th"
@ -128,6 +131,7 @@ export default {
marketislicode: '',
payResult: 0, //
goBuyOrder: false, //
img: '', //
}
},
watch: {
@ -145,6 +149,7 @@ export default {
onLoad(options) {
this.selectedIndexs = []
this.batchcode = options.batchcode
this.img = options.img
this.getTableList()
},
methods: {

292
pages/user/order/buyOrder.vue

@ -3,7 +3,7 @@
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ native: true }" @down="downCallback" :up="upOption" @up="upCallback">
<!-- tab栏 -->
<u-tabs :list="tabs" :is-scroll="false" :current="curTab" active-color="#FA2209" :duration="0.2" @change="onChangeTab" />
<u-tabs :list="tabs" :is-scroll="false" :current="curTab" active-color="#26587b" :duration="0.2" @change="onChangeTab" />
<!-- 订单列表 -->
<view class="order-list">
@ -27,29 +27,27 @@
<!-- 商品信息 -->
<view class="goods-content">
<view class="goods-title">
<text class="twoline-hide">{{ goods.goods_name }}</text>
<text class="twoline-hide">
<view class="twoline-hide">
<text class="twoline-hide-name">{{ goods.goods_name }}</text>
</view>
<view class="twoline-hide-info">
<text class="twoline-hide-price">
单价
<text class="twoline-hide-icon"></text>
<view class="twoline-hide-icon"></view>
{{ goods.price }}
</text>
</text>
<text class="twoline-hide">
<text class="twoline-hide-price">
购买年限 {{ goods.transaction_count }}
</text>
</text>
<text class="twoline-hide">
<text class="twoline-hide-price">
交易佣金
<text class="twoline-hide-icon"></text>
<view class="twoline-hide-icon"></view>
{{ goods.service_charge }}
<text class="twoline-hide-sum">
<view class="twoline-hide-sum">
合计{{goods.money}}
</text>
</view>
</text>
</text>
</view>
</view>
</view>
<!-- 委托方等信息 -->
@ -58,6 +56,36 @@
<view class="goods-props-item">
<text>交易方式{{goods.goods_entrust=="1"?'转让':'授权'}}</text>
</view>
<view class="goods-props-item" v-if="item.status == 2 || item.status == '3' || item.status == '4'">
<text>交易ISLI编码{{goods.contract_code ? goods.contract_code :'--'}}</text>
</view>
<view class="goods-props-item" v-if="item.status == 2 || item.status == '3' || item.status == '4'">
<text>提取期限{{item.paymenttimeStr}}</text>
</view>
<view class="goods-props-bt"><!--v-if="item.status == 2 || item.status == '3' || item.status == '4'"-->
<view class="goods-props-bt-down" @click="handelDownload(idx,item.batchcode,goods)">
下载
</view>
</view>
</view>
</view>
<view class="goods-sum">
<view class="goods-sum-date">
提交时间{{item.createtime}}
</view>
<view class="goods-sum-time" v-if="item.status == 1">
付款倒计时{{item.createDateTime}}
</view>
<view class="goods-sum-time" v-if="item.status == 2 || item.status == '3' || item.status == '4'">
支付时间{{item.paymenttime}}
</view>
<view class="goods-sum-amount">
订单金额{{item.total_money_str}}
</view>
<view v-if="item.status == 1" class="goods-sum-bt">
<view class="goods-sum-bt-pay" @click="onGoodsPayment(item.batchcode)">
支付
</view>
</view>
</view>
</view>
@ -69,17 +97,19 @@
<script>
import * as OrderApi from '@/api/order'
import * as Comment from '@/api/order/comment'
import { checkLogin } from '@/core/app'
import { getEmptyPaginateObj, getMoreListData } from '@/core/app'
import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue'
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins'
import {getSourceNewList} from "../../../api/order";
//
const pageSize = 10
// tab
const tabs = [
{name: `全部`,value: 'all',key: ''},
{name: `全部订单`,value: 'all',key: ''},
{name: `待付款`,value: 'payment',key: 1},
{name: `待交付`,value: 'delivery',key: 2},
{name: `已终止`,value: 'hasabort',key: '3,4'},
@ -116,6 +146,7 @@
},
// onShow
canReset: false,
downList: [],//
}
},
/**
@ -206,7 +237,10 @@
initList(newList) {
newList.data.forEach(item => {
item.total_num = item.order_detail.length
item.state_text = this.showStateText(item.staus)
item.state_text = this.showStateText(item.status)
item.createDateTime = Comment.getDateTime(item.createtime,item.status)
item.total_money_str = Comment.formatAmount(item.total_money)
item.paymenttimeStr = Comment.getDateTerm(item.paymenttime,item.status)
})
return newList
},
@ -226,7 +260,123 @@
}
return state_txt;
},
//
onGoodsPayment(batchcode) {
this.list.data.forEach(item => {
if (batchcode == item.batchcode) {
let newdaimg = Comment.getDefaultImage()
this.$navTo('pages/goods/payment/orderPayment', { batchcode: batchcode, img: newdaimg })
}
})
},
//
handelDownload (index,batchcode,goods) {
let app = this
let source_download = goods.source_download
let isliCode = uni.getStorageSync("isliCode")
OrderApi.getSourceNewList(batchcode,isliCode,goods.goods_islicode).then(res => {
if (res.resultCode === "00000000") {
let sourceData = [],targetData = [],targetData2 = []
if (res.data.length > 0) {
res.data[0].singleResource.myForEach(function (item, index, arr) {
sourceData.push(JSON.parse(item.source_data))
});
res.data[0].moreResources.myForEach(function (item, index, arr) {
if (targetData2.indexOf(JSON.parse(item.source_data).isliCode) == -1) {
targetData2.push(JSON.parse(item.source_data).isliCode);
targetData.push([]);
}
targetData[targetData2.indexOf(JSON.parse(item.source_data).isliCode)].push(item);
});
app.query_type(source_download,targetData,sourceData);
} else {
app.$error('无资源下载')
}
} else {
app.$error(res.resultMsg)
}
})
},
query_type(source_download,targetData,sourceData) {
const app = this
let sumSourceData = []; //
let unitSource = []; //
let bothSource = []; //
if (targetData.length > 0) {
targetData.myForEach(function (v, index, arr) {
v.myForEach(function (item, index) {
item.copyTarget_data = JSON.parse(item.target_data);
bothSource.push(item);
})
});
}
sourceData.myForEach(function (item, index, arr) {
item.copyTarget_data = item;
unitSource.push(item);
});
sumSourceData = unitSource.concat(bothSource);
let new_sumDate = JSON.parse(source_download);
let obj = [];
sumSourceData.myForEach(function (item, index, arr) {
let new_obj = {};
for (let attr in item) {
new_obj[attr] = item[attr];
}
for (let attr in new_sumDate[index]) {
new_obj[attr] = new_sumDate[index][attr];
}
return obj.push(new_obj);
})
obj.myForEach(function (v, index, arr) {
let status_name = "";
if (v.status == 1) {
status_name = "解密中,请稍后再试"
} else if (v.status == 2) {
status_name = "获取下载地址失败"
} else if (v.status == 3) {
status_name = "获取解密资源地址失败"
} else if (v.status == 4) {
status_name = "获取解密资源地址成功"
} else if (v.status == 5) {
status_name = "没有解密资源地址"
} else if (v.status == 6) {
status_name = "获取资源下载状态失败"
} else if (v.status == 7) {
status_name = "资源下载成功"
} else if (v.status == 8) {
status_name = "资源下载失败"
} else if (v.status == 9) {
status_name = "获取资源下载状态异常"
}
if (v.isliCode != "undefined" && v.isliCode != undefined && v.isliCode != null) {
v.isliCode = v.isliCode;
} else if (v.linkcode != "undefined" && v.linkcode != undefined && v.linkcode != null) {
v.isliCode = v.linkcode;
} else if (v.identifier != "undefined" && v.identifier != undefined && v.identifier != null) {
v.isliCode = v.identifier;
}
if (v.target_data != "undefined" && v.target_data != undefined) {
v.target_name = v.target_name
} else {
v.target_name = v.titleName
}
let tempArr = {}
tempArr.target_name = v.target_name
tempArr.metadataFileFormat = v.copyTarget_data.metadataFileFormat
tempArr.status_name = status_name
tempArr.metadataFileSize = FileSize(v.copyTarget_data.metadataFileSize)
if (v.status == 4 || v.status == 7) {
tempArr.isliCode = v.isliCode
tempArr.show_down = 1
} else {
tempArr.show_down = 0
}
app.downList.push(tempArr)
})
},
//
getTabValue() {
return this.tabs[this.curTab].value
@ -253,6 +403,9 @@
</script>
<style lang="scss" scoped>
.u-tabs {
font-weight: bold;
}
//
.order-item {
margin: 20rpx auto 20rpx auto;
@ -267,17 +420,18 @@
.item-top {
display: flex;
justify-content: space-between;
font-size: 26rpx;
font-size: 28rpx;
margin-bottom: 20rpx;
padding-bottom: 20rpx;
border-bottom: 1rpx #9F9F9F solid;
.order-time {
color: #777;
font-weight: 600;
}
.state-text {
color: $uni-text-color-active;
color: #26587b;
font-weight: 600;
}
}
@ -288,7 +442,9 @@
.goods-item {
display: flex;
flex-wrap: wrap;
margin-bottom: 40rpx;
margin-bottom: 20rpx;
margin-top: -20rpx;
border-top: 1rpx #e8e8e8 solid;
//
.goods-image {
@ -308,7 +464,7 @@
//
.goods-content {
padding-left: 16rpx;
padding-top: 16rpx;
padding-top: 10rpx;
flex-basis: calc(66.66% - 10rpx);
margin-right: 10rpx;
@ -317,18 +473,41 @@
max-height: 76rpx;
}
.twoline-hide-price{
font-size: 20rpx;
color: #979082;
.twoline-hide {
height: 70rpx;
}
.twoline-hide-icon{
color: #0b0b0b;
font-weight: bold;
}
.twoline-hide-sum{
color: red;
float: right;
margin-top: 5rpx;
.twoline-hide-name {
font-size: 28rpx;
font-weight: bold;
display: -webkit-box;
-webkit-line-clamp: 2; /* 控制显示的行数 */
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.twoline-hide-info {
margin-top: 10rpx;
position: absolute;
.twoline-hide-price{
display: block;
font-size: 24rpx;
color: #767285;
.twoline-hide-icon{
display: inline-block;
color: #0b0b0b;
font-weight: bold;
}
.twoline-hide-sum{
width: 250rpx;
color: #c1382d;
text-align: right;
font-weight: bold;
display: inline-block;
}
}
}
@ -337,15 +516,64 @@
//
.goods-props {
float: left;
height: 30rpx;
font-size: 20rpx;
margin-top: 10rpx;
flex-basis: 100%;
color: $uni-text-color-grey;
color: #767285;
.goods-props-item {
margin-top: 10rpx;
}
.goods-props-bt {
float: right;
width: 120rpx;
height: 50rpx;
margin-top: -50rpx;
background-color: #26587b;
color: white;
border-radius: 50rpx;
.goods-props-bt-down {
text-align: center;
margin-top: 14rpx;
}
}
}
}
.goods-sum {
border-top: 1rpx #e8e8e8 solid;
font-size: 20rpx;
color: #767285;
font-weight: 600;
.goods-sum-date {
margin-top: 20rpx;
}
.goods-sum-time {
margin-top: 5rpx;
}
.goods-sum-amount {
color: #c1382d;
font-size: 28rpx;
margin-top: 40rpx;
}
.goods-sum-bt {
float: right;
width: 120rpx;
height: 50rpx;
margin-top: -50rpx;
background-color: #26587b;
color: white;
border-radius: 50rpx;
.goods-sum-bt-pay {
text-align: center;
margin-top: 14rpx;
}
}
}

Loading…
Cancel
Save