"use strict"; const common_vendor = require("../../common/vendor.js"); require("../../store/index.js"); require("../../TUIKit/debug/lib-generate-test-usersig-es.min.js"); const api_durian = require("../../api/durian.js"); const _sfc_main = { __name: "trade", setup(__props) { const tabList = common_vendor.reactive([ { name: "全部" }, { name: "挂买" }, { name: "挂卖" } ]); const tabIndex = common_vendor.ref(0); const saleData = common_vendor.ref([]); getOrderList(); function handleTabIndex(index) { if (tabIndex.value === index) return; tabIndex.value = index; getOrderList(); } function getOrderList() { api_durian.durian.getOrderList({ query: { type: tabIndex.value, status: 1 } }).then((rs) => { saleData.value = rs.rows; console.log(rs); }); } function handleDeal(item) { api_durian.durian.orderSale({ query: { orderId: item.id } }).then((rs) => { if (rs.code === 200) { common_vendor.index.showToast({ title: "交易成功", icon: "success", duration: 1500 }); } else { common_vendor.index.showToast({ title: rs.msg, icon: "error", duration: 1500 }); } }); } return (_ctx, _cache) => { return { a: common_vendor.f(tabList, (item, index, i0) => { return { a: common_vendor.t(item.name), b: index, c: index === tabIndex.value ? 1 : "", d: common_vendor.o$1(($event) => handleTabIndex(index), index) }; }), b: common_vendor.f(saleData.value, (item, index, i0) => { return common_vendor.e({ a: common_vendor.t(item.sellNum), b: item.type == 1 }, item.type == 1 ? {} : {}, { c: common_vendor.t(item.totalPrice), d: common_vendor.o$1(($event) => handleDeal(item), index), e: index }); }) }; }; } }; wx.createPage(_sfc_main);