java-mall-app/hall/purchase/my.vue
2024-11-01 16:35:40 +08:00

868 lines
24 KiB
Vue

<template>
<view class="page">
<view :class="(show?'cover':'')">
</view>
<view class="m-product-all">
<view class="m-tab">
<view class="m-navbar">
<view :class="['m-navbar-item ellipsis', tapindex==1?'m-navbar-item-on':'']" @click="allOrders">
{{__('全部')}}
</view>
<view :class="['m-navbar-item ellipsis', tapindex==6?'m-navbar-item-on':'']" @click="getExamine">
{{__('审核中')}}
</view>
<view :class="['m-navbar-item ellipsis', tapindex==2?'m-navbar-item-on':'']" @click="getTender">
{{__('采购中')}}
</view>
<view :class="['m-navbar-item ellipsis', tapindex==3?'m-navbar-item-on':'']" @click="getWorking">
{{__('已完成')}}
</view>
<view :class="['m-navbar-item ellipsis', tapindex==4?'m-navbar-item-on':'']" @click="getFinished">
{{__('已停止')}}
</view>
<view :class="['m-navbar-item ellipsis', tapindex==5?'m-navbar-item-on':'']" @click="getReject">
{{__('被驳回')}}
</view>
</view>
</view>
<scroll-view v-if="(orderlist.length>0)" scroll-y="true" class="m-orderlist" @scrolltolower="scrollbottom">
<view v-for="(items, i) in orderlist" :key="i" class="m-panel m-panel-access">
<view class="m-panel-hd">
<view>
<text>{{__('编号:')}}{{items.purchase_order_id}}</text>
<label>{{items.purchase_order_time}}</label>
</view>
<view>
<text>{{__('商品名称:')}}{{items.purchase_order_title}}</text>
<!-- <label><navigator :url="'/hall/purchase/detail?order_id=' + (items.purchase_order_id)" class="">{{__('查看详情')}}</navigator></label> -->
<label style="padding-right: 10rpx;" v-if="items.purchase_order_state == StateCode.TASK_STATE_TENDER">{{__('采购中')}}</label>
<label style="padding-right: 10rpx;" v-if="items.purchase_order_state == StateCode.TASK_STATE_FINISH">{{__('已完成')}}</label>
<label style="padding-right: 10rpx;" v-if="items.purchase_order_state == StateCode.TASK_STATE_CANCEL">{{__('已取消')}}</label>
<label style="padding-right: 10rpx;" v-if="items.purchase_order_state == StateCode.TASK_STATE_REJECT">{{__('被驳回')}}</label>
<label style="padding-right: 10rpx;" v-if="items.purchase_order_state == StateCode.TASK_STATE_EXAMINE">{{__('审核中')}}</label>
</view>
<view>
<text>{{__('截至时间:')}}{{items.purchase_deadline}}</text>
</view>
<view>
<text>{{__('产品描述:')}}{{items.purchase_order_description}}</text>
</view>
</view>
<view class="m-product-list" v-if="(items.item.length > 0)">
<view v-for="(item, ii) in items.item" :key="ii" class="m-product-item" @click="showBox(item)">
<view class="m-product-img">
<image :src="(item.supply_user_avatar)" mode="aspectFill" />
</view>
<view class="m-product-info">
<view class="m-product-name" style="height:65rpx;">
<label>
{{item.supply_order_title}}
</label>
</view>
<view class="m-product-name" style="height:65rpx;" v-if="(item.supply_province && item.supply_city)">
<label>
{{item.supply_province}}/{{item.supply_city}}/{{item.supply_county}}
</label>
</view>
<view class="m-product-price">
<block>
<label>{{__('¥')}}{{item.product_unit_price}} </label> <label style="margin-left: 50rpx;">x{{item.supply_quantity}}</label>
</block>
<image src="https://static.lancerdt.com/xcxfile/appicon/images/select.png" style="width:40rpx;height:40rpx;float: right;margin-right: 60rpx;" @click.stop="selectWorker(item.supply_order_id, items.purchase_order_id)" v-if="(items.purchase_order_state == 1000 && !items.supply_user_id)">
<!-- <label style="float: right;margin-right: 60rpx;border:2rpx solid #09BB07;padding:10rpx;border-radius: 20rpx;" @click.stop="selectWorker(item.supply_order_id)" v-if="(items.purchase_order_state == 1000 && !items.supply_user_id)">选标</label> -->
<!-- <text style="float: right;margin-right: 60rpx;" v-if="(items.supply_user_id==item.supply_user_id && item.supply_is_selected)">中标者</text> -->
<image src="https://static.lancerdt.com/xcxfile/appicon/images/selectd.png" style="width:40rpx;height:40rpx;float: right;margin-right: 60rpx;" v-if="(items.supply_user_id==item.supply_user_id && item.supply_is_selected)">
</view>
</view>
</view>
</view>
<view style="padding: 40rpx;" v-else>
尚无参与人员
</view>
<view class="m-total-btn">
<view :data-on="(items.order_id)" v-if="(items.order_lock_status)" class="u-link-btn">{{__('退款/退货中...')}}</view>
<navigator :url="'/member/product/comment?od=' + (items.order_id)" v-if="(items.order_buyer_evaluation_status == 0 &&items.order_state_id == StateCode.ORDER_STATE_FINISH)"
class="u-link-btn">{{__('去评价')}}</navigator>
<navigator :url="'/member/product/comment?od=' + (items.order_id)" v-if="(items.order_buyer_evaluation_status == 1)"
class="u-link-btn">{{__('查看评价')}}</navigator>
<view :data-on="(items.purchase_order_id)" v-if="(items.kind_id==1202 && items.order_state_id == StateCode.ORDER_STATE_SHIPPED)" class="u-link-btn"
@click="writeOrder">{{__('确认服务')}}</view>
<view v-if="(items.purchase_order_state == StateCode.TASK_STATE_TENDER)" class="u-link-btn" @click="cancelOrder(items.purchase_order_id)">{{__('取消订单')}}</view>
<!-- <view v-if="(items.purchase_order_state == StateCode.TASK_STATE_WORKING)" class="u-link-btn"
@click="confirmReceipt(items.purchase_order_id)">{{__('确认验收')}}</view> -->
<navigator :url="'/hall/purchase/detail?order_id=' + (items.purchase_order_id)" class="u-link-btn">{{__('查看详情')}}</navigator>
</view>
</view>
<view class="m-loading-box">
<block v-if="(ispage)">
<view class="u-loadmore">
<label class="u-loading"></label>
<text class="u-loadmore-tips">{{__('正在加载')}}</text>
</view>
<view>
<text></text>
</view>
</block>
<block v-else>
<view class="u-loadmore u-loadmore-line">
<text class="u-loadmore-tips">{{__('没有更多数据啦!')}}</text>
</view>
</block>
</view>
</scroll-view>
<navigator url="/hall/purchase/lists" redirect="true" class="m-nullpage" v-else>
<view class="m-nullpage-middle">
<view class="m-null-tip">
<label style="font-size:32rpx;">{{__('亲~您还没有任务哦,')}}</label><label class="highlight-link">{{__('快去看看吧')}}</label>
</view>
</view>
</navigator>
<view class="alert" v-if="(show)">
<image style="width:50rpx;height:50rpx" src="https://static.lancerdt.com/xcxfile/appicon/images/true.png"></image>
<text style="margin-left:20rpx">{{Info}}</text>
</view>
</view>
<!-- 弹出层 -->
<uni-popup ref="popup" type="center" >
<view class="uni-banner" style="background:#FFFFFF;width:80%;margin:0 78rpx;">
<view class="m-cells m-cells-form">
<view class="m-cell">
<view class="m-cell-hd" style="width: 25%;"><label class="u-label">{{__('订单标题:')}}</label></view>
<view class="m-cell-bd">
<input class="u-input" disabled="true" style="width: 100%;" type="text" v-model="item.supply_order_title" :placeholder="__('订单标题')"/>
</view>
</view>
<view class="m-cell">
<view class="m-cell-hd" style="width: 25%;"><label class="u-label">{{__('货品单价:')}}</label></view>
<view class="m-cell-bd">
<input class="u-input" disabled="true" style="width: 100%;" type="number" v-model="item.product_unit_price" :placeholder="__('货品单价')"/>
</view>
</view>
<view class="m-cell">
<view class="m-cell-hd" style="width: 25%;"><label class="u-label">{{__('供应数量:')}}</label></view>
<view class="m-cell-bd">
<input class="u-input" disabled="true" style="width: 100%;" type="number" v-model="item.supply_quantity" :placeholder="__('供应数量')"/>
</view>
</view>
<view class="m-cell" v-if="(item.product_name)">
<view class="m-cell-hd" style="width: 25%;"><label class="u-label">{{__('商品名称:')}}</label></view>
<view class="m-cell-bd" @click.stop="onProduct(item.item_id)">
{{item.product_name}}
</view>
</view>
<view class="m-cells m-cells-form">
<view class="m-upImg">
<view class="m-upImg-item" v-for="(imglist, ii) in imageLists" :key="ii">
<image lazy-load mode="aspectFit" :src="(imglist)" :data-src="(imglist)" @click="ImgTap"></image>
</view>
</view>
</view>
<view class="m-cell" >
<view class="m-cell-hd" disabled="true" style="width: 25%;margin-right:20rpx;"><label class="u-label">{{__('货品所在地:')}}</label></view>
<view class="m-cell-bd">
<input class="u-input" disabled="true" style="width: 100%;" type="test" :value="item.supply_province + '/' + item.supply_city" :placeholder="__('货品所在地')"/>
</view>
</view>
<view class="m-cell">
<view class="m-cell-hd" style="width: 25%;"><label class="u-label">{{__('报价描述:')}}</label></view>
<view class="m-cell-bd" style="border: 2rpx solid #F5F5F5;padding:10rpx;">
<textarea class="textarea u-input" maxlength="500" v-model="item.supply_order_description" :placeholder="__('报价描述...')" style="height: 300rpx;width: 100%;"></textarea>
</view>
</view>
</view>
<view style="height:50px;text-align: center;">
</view>
</view>
</uni-popup>
<payment-box :paymentDataDefault="paymentData" :order_id="order_id" ref="paymentBox" @onCancel="onCancel" @onPaid="onPaid" @onFail="onFail"></payment-box>
</view>
</template>
<script>
import paymentBox from '../../components/payment-box.vue'
import uniPopup from "@/components/uni-popup/uni-popup.vue";
import {
mapState,
mapMutations
} from 'vuex'
export default {
data() {
return {
isdata: false,
tapindex: 1,
page: 1,
rows: 10,
ispage: true,
flag: true,
type: 0,
kind_id: 1201,
formId: "",
orderlist: [],
imgLogo: "",
show: false,
Info: "",
order_id: "",
paymentData:{},
item:{},
imageLists: []
}
},
components: {
paymentBox,
uniPopup,
},
computed: mapState(['Config', 'StateCode', 'notice', 'plantformInfo', 'shopInfo', 'userInfo', 'hasLogin']),
onLoad: function(options) {
uni.setNavigationBarTitle({
title:this.__('我的采购')
});
this.setData({
tapindex: options.sl ? options.sl : 1,
page: 1,
rows: 10,
orderlist: [],
});
var t = this;
this.notice.addNotification("RefreshMessage", t.RefreshMessage, t);
},
onShow: function() {
this.setData({
tapindex: this.tapindex,
page: this.page,
rows: this.rows,
orderlist: [],
});
this.getOrderlist()
},
onUnload: function() {
//移除通知
// 离开页面,注销事件
var that = this
this.notice.removeNotification("RefreshMessage", that);
if (this.$refs.paymentBox.showBoxView) {
this.$refs.paymentBox.cancel();
}
},
onBackPress() {
if (this.$refs.paymentBox.showBoxView) {
this.$refs.paymentBox.cancel();
return true;
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
this.getOrderlist();
},
methods: {
...mapMutations(['login', 'logout', 'getPlantformInfo', 'forceUserInfo', 'getUserInfo']),
RefreshMessage: function(e) {
this.setData({
tapindex: 1,
page: 1,
rows: 10,
orderlist: [],
ispage: true,
flag: true,
type: 0,
}), this.getOrderlist()
},
allOrders: function() {
this.setData({
tapindex: 1,
page: 1,
rows: 10,
orderlist: [],
ispage: true,
flag: true,
type: 0,
}), this.getOrderlist()
},
getTender: function() {
this.setData({
tapindex: 2,
page: 1,
rows: 10,
orderlist: [],
ispage: true,
flag: true,
type: 1000,
}), this.getOrderlist()
},
getExamine:function() {
this.setData({
tapindex: 6,
page: 1,
rows: 10,
orderlist: [],
ispage: true,
flag: true,
type: 1040,
}), this.getOrderlist()
},
getWorking: function() {
this.setData({
tapindex: 3,
page: 1,
rows: 10,
orderlist: [],
ispage: true,
flag: true,
type: 1010,
}), this.getOrderlist()
},
receiptOfGoods: function() {
this.setData({
tapindex: 3,
page: 1,
rows: 10,
ispage: true,
flag: true,
orderlist: [],
type: this.kind_id==1201 ? this.StateCode.ORDER_STATE_SHIPPED : this.StateCode.ORDER_STATE_WAIT_SHIPPING,
}), this.getOrderlist()
},
getFinished: function() {
this.setData({
tapindex: 4,
page: 1,
rows: 10,
ispage: true,
flag: true,
orderlist: [],
type: 1020,
}), this.getOrderlist()
},
getReject: function() {
this.setData({
tapindex: 5,
page: 1,
rows: 10,
ispage: true,
flag: true,
orderlist: [],
type: 1030,
}), this.getOrderlist()
},
scrollbottom: function() {
if (this.flag) {
var that = this;
that.setData({
flag: false
});
clearTimeout(t);
var t = setTimeout(function() {
that.setData({
state_type: that.type,
flag: false,
page: parseInt(that.page) + 1,
rows: 10
});
that.getOrderlist()
}, 100)
}
},
getOrderlist: function() {
var that = this;
var params = {
page: that.page,
rows: that.rows,
state_type: that.type,
sidx: 'purchase_order_time',
sord: 'DESC',
myPurchase:1
};
that.$.request({
url: this.Config.URL.hall.user_purchase_order_lists,
data: params,
success: function(data, status, msg, code) {
if (200 == status && data.items.length > 0) {
for (let i = 0; data.items.length > i; i++) {
data.items[i].purchase_order_time = that.$.dateFormat(data.items[i].purchase_order_time, "yyyy-MM-dd");
data.items[i].purchase_deadline = that.$.dateFormat(data.items[i].purchase_deadline, "yyyy-MM-dd");
}
if (data.page >= data.total) {
that.setData({
flag: false,
ispage: false,
orderlist: that.orderlist.concat(data.items)
})
} else {
that.setData({
flag: true,
ispage: true,
orderlist: that.orderlist.concat(data.items)
})
}
that.setData({
isdata: true
})
} else {
that.setData({
flag: false,
ispage: false,
isdata: false
})
}
}
});
},
onProduct(item_id) {
this.$.gotopage('/pages/product/detail?pid=' + item_id)
},
showBox: function(e,mode_id) {
var that =this;
this.setData({
item: e,
imageLists: e.supply_images?e.supply_images : []
})
console.log(that.item)
this.$refs.popup.open()
},
cancelOrder: function(purchase_order_id) {
var that = this,
params = {
purchase_order_id: purchase_order_id
};
that.$.confirm(that.__("是否取消订单"), function(e) {
if (e.confirm) {
that.$.request({
url: that.Config.URL.hall.remove_purchase_order,
data: params,
method: 'POST',
success: function(data, status, msg, code) {
if (status == 200) {
that.$.alert("取消成功!", function() {
that.setData({
orderlist: [],
page: 1
});
that.getOrderlist();
});
}
}
});
}
}, true)
},
writeOrder: function(e) {
var that = this,
params = {
order_id: e.currentTarget.dataset.on
};
that.$.confirm("是否核销订单?", function(e) {
if (e.confirm) {
that.$.request({
url: that.Config.URL.user.order_receive,
data: params,
success: function(data, status, msg, code) {
if (status == 200) {
that.$.alert("核销成功!", function() {
that.setData({
orderlist: [],
page: 1,
Info: msg
});
that.getOrderlist();
});
} else {
(that.setData({
show: true
}), setTimeout(function() {
that.setData({
show: false
})
}, 2e3)), that.getOrderlist()
}
}
});
}
}, true)
},
ImgTap: function(e) {
var that = this,
urls = [];
for (var i in this.imageLists) {
urls.push(this.imageLists[i]);
}
var s = e.target.dataset.src;
that.$.previewImage({ current: s, urls: urls });
},
confirmReceipt: function(service_order_id) {
var params = {
service_order_id: service_order_id
};
var that = this;
that.$.confirm("是否确认验收通过?", function(e) {
if (e.confirm) {
that.$.request({
url: that.Config.URL.hall.user_service_order_check_do,
data: params,
success: function(data, status, msg, code) {
if (status == 200) {
that.$.alert("验收成功!", function() {
that.setData({
orderlist: [],
page: 1
});
that.getOrderlist();
});
}
else
{
that.$.alert(msg)
}
}
});
}
}, true)
},
gotopay: function(e) {
var that = this;
that.setData({
order_id: e.currentTarget.dataset.on,
'paymentData': {
order_id: e.currentTarget.dataset.on,
orderSelMoneyAmount: e.currentTarget.dataset.wopa,
user_money: this.userInfo.user_money,
user_points:this.userInfo.user_points,
user_recharge_card:this.userInfo.user_recharge_card,
user_sp:this.userInfo.user_sp
}
});
this.$refs.paymentBox.show();
return true;
this.setData({
formId: e.detail.formId
});
var param = {
order_id: e.currentTarget.dataset.on,
openid: this.userInfo.openId,
typ: 'json',
payment_channel_code: 'wx_native',
prepay_flag: 1
};
that.$.request({
url: this.Config.URL.pay.pay,
data: param,
success: function(data, status, msg, code) {
if (status == 200) {
that.$.requestPayment({
timeStamp: data.timeStamp,
nonceStr: data.nonceStr,
"package": data.package,
signType: data.signType,
paySign: data.paySign,
success: function() {
that.sendMessage(e.currentTarget.dataset.on), that.$.alert(that.__("支付成功!"), function() {
that.setData({
orderlist: [],
page: 1
}), that.getOrderlist()
})
},
fail: function(e) {
// that.$.alert(that.__("支付成功!"), e)
}
})
} else {
that.$.alert(msg)
}
},
fail: function(err) {}
});
},
onCancel: function(e) {
return
},
onPaid: function(e) {
let that = this
that.$.alert(that.__('支付成功'), function(){that.$.gotopage("/hall/purchase/detail?order_id=" + e.order_id)}, 2000)
if (this.$refs.paymentBox.showBoxView) {
this.$refs.paymentBox.cancel();
}
},
onFail: function(e) {
},
sendMessage: function(order_id) {
let that = this;
var params = {
api: orderapi.OrderPaySuccessWXMessage,
pages: "/member/order/detail?on=" + order_id,
formId: this.formId,
WeiXinOpenId: this.userInfo.openId,
value: {
order_id: order_id
}
};
that.$.sendTpl(params)
},
selectWorker: function(supply_order_id, purchase_order_id) {
var params = {
supply_order_id: supply_order_id,
purchase_order_id: purchase_order_id
};
var that = this;
that.$.confirm("确认选择此报价方案吗?", function(e) {
if (e.confirm) {
that.$.request({
url: that.Config.URL.hall.user_purchase_select_supply,
data: params,
method: 'POST',
success: function(data, status, msg, code) {
if (status == 200) {
that.$.alert("提交成功!", function() {
that.$.navigateTo({
url:"/member/order/detail?on=" + data.order_id,
})
});
}
else
{
that.$.alert(msg)
}
}
});
}
}, true)
}
}
};
</script>
<style lang="scss">
@import "../../styles/_variables";
.m-navbar-item {
padding: 20rpx 0;
font-size: 24rpx;
}
.m-navbar-item:after {
border: none;
}
.m-navbar-item.m-navbar-item-on {
background-color: #fff;
color: $default-skin-bg;
}
.m-navbar-item.m-navbar-item-on::before {
content: " ";
position: absolute;
left: 0;
bottom: 0;
right: 0;
height:
6rpx;
border-bottom: 6rpx solid $default-skin-bg;
color: #CCCCCC;
-webkit-transform-origin: 0 100%;
transform-origin: 0 100%;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
z-index: 3;
}
.m-panel-hd label {
float: right;
color: $default-skin-bg;
font-size: 26rpx;
}
.m-total-info {
text-align: right;
padding: 10rpx;
font-size: 24rpx;
}
.m-total-info label {
font-size: 32rpx;
color: $default-skin-bg;
}
.m-total-btn {
text-align: right;
padding: 20rpx 20rpx 20rpx 20rpx;
position: relative;
}
.m-total-btn::before {
content: " ";
position: absolute;
left: 0;
top: 0;
right: 0;
height: 1px;
border-top: 1px solid #ebebe7;
color: #ebebe7;
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
-webkit-transform:
scaleY(0.5);
transform: scaleY(0.5);
}
.m-total-btn .u-link-btn {
margin: 0 10rpx;
vertical-align: middle;
display: inline-block;
line-height: 40rpx;
background-color: #fff;
}
.m-sort {
position: relative
}
.m-sort image {
width: 24rpx;
height: 24rpx;
position: absolute;
/*top: 50%;*/
margin-top: 10rpx;
margin-left: 2rpx;
}
.m-product-price text {
font-size: 24rpx;
color: #999999;
margin-left: 6rpx
}
.m-tab {
position: fixed;
width: 100%;
top: var(--window-top);
z-index: 2;
}
.m-orderlist {
padding-top: 70rpx;
position: absolute;
box-sizing: border-box;
width: 100%;
height: 100%;
}
.u-tuan-label {
padding: 5rpx;
background-color: $default-skin-bg;
border-radius: 4rpx;
font-size: 24rpx;
color:#fff;
margin-right: 5rpx;
}
.alert {
font-size: 32rpx;
width: 70%;
height: 200rpx;
padding: 0 40rpx;
position: absolute;
left: 10%;
top: 40%;
background: #fff;
border-radius: 10rpx;
justify-content: center;
display: flex;
align-items: center;
z-index: 999;
}
.cover {
position: fixed;
width: 100%;
height: 100%;
top: 0px;
background: rgba(0, 0, 0, 0.4);
overflow: hidden;
z-index: 998
}
.m-upImg {
box-sizing: border-box;
padding: 20rpx;
background-color: #fff;
}
.m-upImg-item {
width: 120rpx;
height: 120rpx;
border: 1px solid #eee;
display: inline-block;
margin: 9rpx;
border-radius: 4rpx;
vertical-align: middle;
position: relative;
}
.m-upImg-item image {
width: 100%;
height: 100%;
}
</style>