|
@@ -1,6 +1,7 @@
|
|
|
import { shallowRef } from 'vue'
|
|
import { shallowRef } from 'vue'
|
|
|
import { useDataTable } from '@/hooks/datatable'
|
|
import { useDataTable } from '@/hooks/datatable'
|
|
|
-import { queryTHJWrstandard, queryTHJWrstandardDetail } from '@/services/api/goods'
|
|
|
|
|
|
|
+import { queryTHJWrstandard, queryTHJWrstandardDetail, addUserFavoriteGoods, removeUserFavoriteGoods, queryTHJProduct, queryTHJTradeData, querySpotGoodsPrice } from '@/services/api/goods'
|
|
|
|
|
+import { useLoginStore } from '@/stores'
|
|
|
|
|
|
|
|
// 采购列表
|
|
// 采购列表
|
|
|
export function useWrstandardList() {
|
|
export function useWrstandardList() {
|
|
@@ -54,4 +55,146 @@ export function useWrstandardDetails(wrstandardid: number) {
|
|
|
details,
|
|
details,
|
|
|
getWrstandardDetails,
|
|
getWrstandardDetails,
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// 添加用户商品收藏信息
|
|
|
|
|
+export function useAddUserFavoriteGoods(goodsid: number) {
|
|
|
|
|
+ const { getUserId } = useLoginStore()
|
|
|
|
|
+
|
|
|
|
|
+ const getAddUserFavoriteGoods = () => {
|
|
|
|
|
+ return addUserFavoriteGoods({
|
|
|
|
|
+ data: {
|
|
|
|
|
+ userID: getUserId(),
|
|
|
|
|
+ goodsID: goodsid
|
|
|
|
|
+ },
|
|
|
|
|
+ success: (res) => { console.log(res) }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return { getAddUserFavoriteGoods }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// 移除用户商品收藏信息
|
|
|
|
|
+export function useRemoveUserFavoriteGoods(goodsid: number) {
|
|
|
|
|
+ const { getUserId } = useLoginStore()
|
|
|
|
|
+
|
|
|
|
|
+ const getRemoveUserFavoriteGoods = () => {
|
|
|
|
|
+ return removeUserFavoriteGoods({
|
|
|
|
|
+ data: {
|
|
|
|
|
+ userID: getUserId(),
|
|
|
|
|
+ goodsID: goodsid
|
|
|
|
|
+ },
|
|
|
|
|
+ success: (res) => { console.log(res) }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return { getRemoveUserFavoriteGoods }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 获取我的推广-交易数据
|
|
|
|
|
+export function useQueryTHJTradeDataList() {
|
|
|
|
|
+ const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.THJTradeDataRsp>()
|
|
|
|
|
+ const loading = shallowRef(false)
|
|
|
|
|
+ const { getUserId } = useLoginStore()
|
|
|
|
|
+
|
|
|
|
|
+ const getQueryTHJTradeDataList = (marketid: number) => {
|
|
|
|
|
+ loading.value = true
|
|
|
|
|
+ return queryTHJTradeData({
|
|
|
|
|
+ data: {
|
|
|
|
|
+ userid: getUserId(),
|
|
|
|
|
+ marketid: marketid,
|
|
|
|
|
+ page: pageIndex.value,
|
|
|
|
|
+ pagesize: pageSize.value,
|
|
|
|
|
+ },
|
|
|
|
|
+ success: (res) => {
|
|
|
|
|
+ total.value = res.total
|
|
|
|
|
+ dataList.value = res.data
|
|
|
|
|
+ },
|
|
|
|
|
+ complete: () => {
|
|
|
|
|
+ loading.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ loading,
|
|
|
|
|
+ dataList,
|
|
|
|
|
+ total,
|
|
|
|
|
+ pageIndex,
|
|
|
|
|
+ pageSize,
|
|
|
|
|
+ pageCount,
|
|
|
|
|
+ getQueryTHJTradeDataList,
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 获取产品介绍列表
|
|
|
|
|
+// 关注标志 true-已关注 false-未关注
|
|
|
|
|
+export function useQueryTHJProductLists() {
|
|
|
|
|
+ const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.THJProductRsp>()
|
|
|
|
|
+ const loading = shallowRef(false)
|
|
|
|
|
+ const { getUserId } = useLoginStore()
|
|
|
|
|
+
|
|
|
|
|
+ const getQueryTHJProductLists = (flag: boolean) => {
|
|
|
|
|
+ loading.value = true
|
|
|
|
|
+ return queryTHJProduct({
|
|
|
|
|
+ data: {
|
|
|
|
|
+ userid: getUserId(),
|
|
|
|
|
+ favoriteflag: flag,
|
|
|
|
|
+ page: pageIndex.value,
|
|
|
|
|
+ pagesize: pageSize.value,
|
|
|
|
|
+ },
|
|
|
|
|
+ success: (res) => {
|
|
|
|
|
+ total.value = res.total
|
|
|
|
|
+ dataList.value = res.data
|
|
|
|
|
+ },
|
|
|
|
|
+ complete: () => {
|
|
|
|
|
+ loading.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ loading,
|
|
|
|
|
+ dataList,
|
|
|
|
|
+ total,
|
|
|
|
|
+ pageIndex,
|
|
|
|
|
+ pageSize,
|
|
|
|
|
+ pageCount,
|
|
|
|
|
+ getQueryTHJProductLists,
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 获取现货行情
|
|
|
|
|
+export function useQuerySpotGoodsPriceLists() {
|
|
|
|
|
+ const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.SpotGoodsPriceRsp>()
|
|
|
|
|
+ const loading = shallowRef(false)
|
|
|
|
|
+
|
|
|
|
|
+ const getQuerySpotGoodsPriceLists = () => {
|
|
|
|
|
+ loading.value = true
|
|
|
|
|
+ return querySpotGoodsPrice({
|
|
|
|
|
+ data: {
|
|
|
|
|
+ page: pageIndex.value,
|
|
|
|
|
+ pagesize: pageSize.value,
|
|
|
|
|
+ },
|
|
|
|
|
+ success: (res) => {
|
|
|
|
|
+ total.value = res.total
|
|
|
|
|
+ dataList.value = res.data
|
|
|
|
|
+ },
|
|
|
|
|
+ complete: () => {
|
|
|
|
|
+ loading.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ loading,
|
|
|
|
|
+ dataList,
|
|
|
|
|
+ total,
|
|
|
|
|
+ pageIndex,
|
|
|
|
|
+ pageSize,
|
|
|
|
|
+ pageCount,
|
|
|
|
|
+ getQuerySpotGoodsPriceLists,
|
|
|
|
|
+ }
|
|
|
|
|
+}
|