123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- <template>
- <view class="center">
- <view class="introduce-section">
- <view class="informations " v-for="(item , index) in procurementPlanInfos" :Key="index">
- <view @click="details(item)">
- <view class="flex">
- <view class="logo flex" v-if="item.type == '买粮'">{{item.type}}</view>
- <view class="logo1 flex" v-if="item.type == '卖粮'">{{item.type}}</view>
- <!-- <view class="logo flex" >买粮{{item.planType}}</view> -->
- <text class="grain">{{item.goodsName}}</text>
- <view class="status">
- <view v-if='item.status=="已驳回"' class='put2'>未通过</view>
- <view v-if='item.status=="待审核"' class='put1'>审核中</view>
- <view v-if='item.status=="已通过"' class='put'>已通过</view>
- </view>
- </view>
- <view class="address">{{item.privates}}{{item.city}}{{item.Area}}</view>
- <view class="flex ">
- <view class="weight">{{item.plannedVolume > 0 ? item.plannedVolume : 0}}吨</view>
- <view v-if='item.planType=="期货"'>
- <!-- <text class="unitPrice">{{item.basisPrice}} <text class="amount">元/吨</text></text> -->
- </view>
- <view v-if='item.planType=="现货"'>
- <text class="unitPrice">{{item.unitPrice}} <text class="amount">元/吨</text></text>
- </view>
- </view>
- </view>
- <hr style="margin: 16px 0; color: #EEEEEE;">
- <view class="flex" style="right: 10px;">
- <view @click='edit(item)' v-if='item.status!="待审核"' class='anniu'>编辑</view>
- <!-- <view class='anniu' @click="switch1(item)" v-if='item.showFlag == 0&&item.status!="待审核"'>显示</view> -->
- <!-- <view class='anniu' @click="switch1(item)" v-if='item.showFlag == 1&&item.status!="待审核"'>隐藏</view> -->
- <view class='anniu' @click="deleteRelease(item)">删除</view>
- </view>
- </view>
- </view>
- <picker style='display:inline-block;width: 100%;' @change="releaseChange" :value="releases"
- :range="releaseType">
- <button type="primary" class="btn">发布</button>
- <view class="picker">
- {{releases>-1?releaseType[releases]:''}}
- </view>
- </picker>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- releaseType: ["我要卖粮", "我要买粮"],
- release: '',
- releases: '',
- receivePrivate: '',
- procurementPlanInfo: {
- pageSize: 10,
- currentPage: 1
- },
- releaseIndex: "",
- pageSize: 10,
- currentPage: 1,
- procurementPlanInfos: [],
- }
- },
- onLoad() {
- this.getList()
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo'])
- },
- methods: {
- switch1(item) {
- if (item.type == "买粮") {
- var that = this
- var tips
- if (item.showFlag == 1) {
- tips = "隐藏后该信息不再展示给其他用户,是否确定隐藏?"
- } else if (item.showFlag == 0) {
- tips = "确定显示该信息?"
- }
- uni.showModal({
- content: tips,
- showCancel: true,
- confirmText: '确定',
- success: function(res) {
- if (res.confirm) {
- that.$api.doRequest('post', '/procurementPlanInfo/api/editStatus', {
- id: item.id,
- flag: 0
- }).then(res => {
- // this.procurementPlanInfos = res.data.data.records
- if (res.data.message == "Success") {
- if (item.showFlag == 1) {
- that.$api.msg('隐藏成功!')
- } else if (item.showFlag == 0) {
- that.$api.msg('显示成功!')
- }
- that.getList()
- return
- }
- })
- .catch(res => {
- uni.showToast({
- title: res.errmsg,
- icon: 'none',
- duration: 2000
- })
- });
- } else if (res.cancel) {
- // console.log('用户点击取消');
- }
- },
- })
- } else if (item.type == "卖粮") {
- var that = this
- var tips
- if (item.showFlag == 1) {
- tips = "隐藏后该信息不再展示给其他用户,是否确定隐藏?"
- } else if (item.showFlag == 0) {
- tips = "确定显示该信息?"
- }
- uni.showModal({
- content: tips,
- showCancel: true,
- confirmText: '确定',
- success: function(res) {
- if (res.confirm) {
- that.$api.doRequest('post', '/salePlanInfo/api/editStatus', {
- id: item.id,
- flag: 0
- }).then(res => {
- // this.procurementPlanInfos = res.data.data.records
- if (res.data.message == "Success") {
- if (item.showFlag == 1) {
- that.$api.msg('隐藏成功!')
- } else if (item.showFlag == 0) {
- that.$api.msg('显示成功!')
- }
- that.getList()
- return
- }
- })
- .catch(res => {
- uni.showToast({
- title: res.errmsg,
- icon: 'none',
- duration: 2000
- })
- });
- } else if (res.cancel) {
- }
- },
- })
- }
- },
- edit(item) {
- if (item.type == "买粮") {
- uni.navigateTo({
- url: `/pageD/myRelease/buyEdit?id=${item.id}`
- })
- } else if (item.type == "卖粮") {
- uni.navigateTo({
- url: `/pageD/myRelease/sellEdit?id=${item.id}`
- })
- }
- },
- deleteRelease(item) {
- var that = this
- if (item.type == "买粮") {
- var that = this
- uni.showModal({
- // title: '提示',
- content: '确定删除该信息?',
- showCancel: true,
- confirmText: '确定',
- success: function(res) {
- if (res.confirm) {
- that.$api.doRequest('post', '/procurementPlanInfo/api/deleteProcurementPlan', {
- id: item.id
- }).then(res => {
- if (res.data.message == "Success") {
- that.$api.msg('删除成功!')
- that.getList()
- return
- }
- })
- .catch(res => {
- uni.showToast({
- title: res.errmsg,
- icon: 'none',
- duration: 2000
- })
- });
- } else if (res.cancel) {
- // console.log('用户点击取消');
- }
- },
- fail: () => {},
- complete: () => {}
- })
- } else if (item.type == "卖粮") {
- uni.showModal({
- // title: '提示',
- content: '确定删除该信息?',
- showCancel: true,
- confirmText: '确定',
- success: function(res) {
- if (res.confirm) {
- that.$api.doRequest('post', '/salePlanInfo/api/deleteSalePlanInfo', {
- id: item.id
- }).then(res => {
- if (res.data.message == "Success") {
- that.$api.msg('删除成功!')
- that.getList()
- return
- }
- })
- .catch(res => {
- uni.showToast({
- title: res.errmsg,
- icon: 'none',
- duration: 2000
- })
- });
- } else if (res.cancel) {
- // console.log('用户点击取消');
- }
- },
- fail: () => {},
- complete: () => {}
- })
- }
- },
- releaseChange(e) {
- this.receivePrivate = e.detail.value
- this.release = this.releaseType[this.receivePrivate];
- this.pageSize = 1
- if (this.release == "我要卖粮") {
- uni.navigateTo({
- url: `/pageD/myRelease/sellGrain`
- })
- } else if (this.release == "我要买粮") {
- uni.navigateTo({
- url: `/pageD/myRelease/buyGrain`
- })
- }
- },
- details(item) {
- if (item.type == "买粮") {
- uni.navigateTo({
- url: `/pageD/myRelease/buyDetails?id=${item.id}`
- })
- } else if (item.type == "卖粮") {
- uni.navigateTo({
- url: `/pageD/myRelease/sellDetails?id=${item.id}`
- })
- }
- },
- getList() {
- // this.procurementPlanInfo.pcFlag = "1"
- this.procurementPlanInfo.commonId = this.userInfo.id
- this.$api.doRequest('get', '/procurementPlanInfo/selectProcurementPlanInfoAPP', this.procurementPlanInfo)
- .then(res => {
- this.procurementPlanInfos = res.data.data.records
- })
- .catch(res => {
- uni.showToast({
- title: res.errmsg,
- icon: 'none',
- duration: 2000
- })
- });
- }
- }
- }
- </script>
- <style>
- .center {
- padding: 10px 20px 150rpx 20px;
- background-color: #F5F6FA;
- }
- .informations {
- background-color: #FFFFFF;
- margin-top: 20px;
- border-radius: 16px;
- padding: 10px;
- }
- .labels {
- display: inline-flex;
- line-height: 20px;
- margin-right: 40px;
- }
- .fabuBut {
- margin-bottom: 0px;
- }
- .logo {
- width: 36px;
- height: 24px;
- background-color: #FEECE6;
- color: #FE6430;
- border-radius: 8px;
- padding: 3px;
- margin-top: 2px;
- }
- .logo1 {
- width: 36px;
- height: 24px;
- background-color: #E9F8F0;
- color: #22C572;
- border-radius: 8px;
- padding: 3px;
- margin-top: 2px;
- }
- .grain {
- font-size: 18px;
- color: #333333;
- font-weight: 600;
- margin-left: 20px;
- }
- .address {
- margin-left: 56px;
- font-size: 14px;
- color: #333333;
- }
- .weight {
- margin-left: 56px;
- font-size: 14px;
- color: #878C9C;
- }
- .unitPrice {
- font-size: 22px;
- font-weight: 600;
- /* margin-left: 200px; */
- position: absolute;
- /* text-align: right; */
- right: 40px;
- }
- /* .amount{
- width: 100%;
- } */
- .amount {
- margin-left: 10px;
- font-size: 12px;
- }
- .status {
- position: absolute;
- right: 40px;
- }
- .put {
- color: #22C572;
- font-size: 14px;
- }
- .put1 {
- color: #FE6430;
- font-size: 14px;
- }
- .put2 {
- color: #FB1E1E;
- font-size: 14px;
- }
- .anniu {
- width: 60px;
- height: 30px;
- border: 1px solid #CDCDCD;
- border-radius: 16px;
- text-align: center;
- line-height: 30px;
- margin-left: 10px;
- }
- .btn {
- width: 100%;
- border-radius: 20px;
- background-color: #22C572;
- /* margin-top: 10px; */
- position: fixed;
- bottom: 30rpx;
- width: 90%;
- }
- </style>
|