ColumnsTsx.tsx 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. import { useCountryInfoStore } from '/@/stores/countryInfo';
  2. import { getTagType } from '/@/utils/useTagColor';
  3. const countryInfoStore = useCountryInfoStore();
  4. export const productColumns = [
  5. { type: 'checkbox', width: 50, align: 'center', fixed: 'left' },
  6. { type: 'seq', title: 'No.', width: 60, align: 'center' },
  7. {
  8. field: 'product_info', title: '商品信息', minWidth: 'auto', align: 'center',
  9. slots: { default: 'product_info' }
  10. },
  11. {
  12. field: 'sku', title: 'SKU', minWidth: 'auto', align: 'center',
  13. slots: {
  14. default({ row }: any) {
  15. return <span class={ 'font-medium' }>{ row.goods.sku ? row.goods.sku : '--' }</span>;
  16. }
  17. }
  18. },
  19. {
  20. field: 'country_code', title: '国 家', minWidth: 'auto', align: 'center',
  21. slots: {
  22. default({ row }: any) {
  23. const country = countryInfoStore.countries.find(c => c.code === row.country_code);
  24. const color = country ? country.color : '#3875F6';
  25. return (
  26. <el-tag effect="plain" round
  27. style={ { color: color, borderColor: color } }>{ country ? country.name : '--' }
  28. </el-tag>
  29. );
  30. }
  31. }
  32. },
  33. {
  34. field: 'platform_number', title: '平台编号', minWidth: 'auto', align: 'center',
  35. slots: {
  36. default({ row }: any) {
  37. return <span class={ 'font-medium' }>{ row.goods.platform_number ? row.goods.platform_number : '--' }</span>;
  38. }
  39. }
  40. },
  41. {
  42. field: 'shop_name', title: '店 铺', minWidth: 'auto', align: 'center',
  43. slots: {
  44. default({ row }: any) {
  45. return (
  46. <el-tag type={ getTagType.value(row.shop_name) }>
  47. { row.shop_name ? row.shop_name : '--' }
  48. </el-tag>
  49. );
  50. }
  51. }
  52. },
  53. {
  54. field: 'tag', title: '分 组', minWidth: 'auto', align: 'center',
  55. slots: {
  56. default({ row }: any) {
  57. return (
  58. <el-tag type={ getTagType.value(row.goods.tag) }>
  59. { row.goods.tag ? row.goods.tag : '--' }
  60. </el-tag>
  61. );
  62. }
  63. }
  64. },
  65. {
  66. field: 'brand', title: '品 牌', minWidth: 'auto', align: 'center',
  67. slots: {
  68. default({ row }: any) {
  69. return (
  70. <el-tag type={ getTagType.value(row.goods.brand) } effect="plain" round>
  71. { row.goods.brand ? row.goods.brand : '--' }
  72. </el-tag>
  73. );
  74. }
  75. }
  76. },
  77. {
  78. field: 'price_info', title: '价 格', minWidth: 'auto', align: 'center',
  79. slots: {
  80. default({ row }: any) {
  81. return (
  82. <div v-if={ row.goods.price > 0 } class={ `font-medium text-left` }>
  83. <p>现 价:{ row.goods.currency_code + '‎' + row.goods.price }</p>
  84. <p>折 扣:{ row.goods.discount > 0 ? row.goods.discount + '%' : '-' }</p>
  85. <p>优惠劵:{ !row || row.goods.coupon <= 0 ? '-' : row.goods.currency_code + '‎' + row.goods.coupon }</p>
  86. </div>
  87. );
  88. }
  89. }
  90. },
  91. {
  92. field: 'show_price', title: '展示价格', minWidth: 'auto', align: 'center',
  93. slots: {
  94. default({ row }: any) {
  95. return <div class={ 'font-medium' }>{ row.goods.show_price ? row.goods.currency_code + row.goods.show_price : '--' }</div>;
  96. }
  97. }
  98. },
  99. {
  100. field: 'activity_price', title: '平时活动售价', minWidth: 'auto', align: 'center',
  101. slots: {
  102. default({ row }: any) {
  103. return <div
  104. class={ 'font-medium' }>{ row.goods.activity_price ? row.goods.currency_code + row.goods.activity_price : '--' }</div>;
  105. }
  106. }
  107. },
  108. {
  109. field: 'minimum_price', title: '最低活动售价', minWidth: 'auto', align: 'center',
  110. slots: {
  111. default({ row }: any) {
  112. return <div class={ 'font-medium' }>{ row.goods.minimum_price ? row.goods.currency_code + row.goods.minimum_price : '--' }</div>;
  113. }
  114. }
  115. },
  116. {
  117. field: 'ratings', title: '子ASIN评分人数', minWidth: 'auto', align: 'center',
  118. slots: {
  119. default({ row }: any) {
  120. return <div class={ 'font-medium' }>{ row.goods.ratings ? row.goods.ratings : '--' }</div>;
  121. }
  122. }
  123. },
  124. {
  125. field: 'all_ratings', title: '亚马逊显示评分人数', minWidth: 'auto', align: 'center',
  126. slots: {
  127. default({ row }: any) {
  128. return <div class={ 'font-medium' }>{ row.goods.all_ratings ? row.goods.all_ratings : '--' }</div>;
  129. }
  130. }
  131. },
  132. {
  133. field: 'reviews', title: '子ASIN评论人数', minWidth: 'auto', align: 'center',
  134. slots: {
  135. default({ row }: any) {
  136. return <div class={ 'font-medium' }>{ row.goods.reviews ? row.goods.reviews : '--' }</div>;
  137. }
  138. }
  139. },
  140. {
  141. field: 'all_reviews', title: '亚马逊显示评论人数', minWidth: 'auto', align: 'center',
  142. slots: {
  143. default({ row }: any) {
  144. return <div class={ 'font-medium' }>{ row.goods.all_reviews ? row.goods.all_reviews : '--' }</div>;
  145. }
  146. }
  147. },
  148. {
  149. field: 'score', title: '子ASIN计算评分', minWidth: 'auto', align: 'center',
  150. slots: {
  151. default({ row }: any) {
  152. return <div class={ 'font-medium' }>{ row.goods.score ? row.goods.score : '--' }</div>;
  153. }
  154. }
  155. },
  156. {
  157. field: 'all_score', title: '亚马逊显示评分', minWidth: 'auto', align: 'center',
  158. slots: {
  159. default({ row }: any) {
  160. return <div class={ 'font-medium' }>{ row.goods.all_score ? row.goods.all_score : '--' }</div>;
  161. }
  162. }
  163. },
  164. {
  165. field: 'launch_date', title: '上架日期', minWidth: 'auto', align: 'center', sortable: true,
  166. slots: {
  167. default({ row }: any) {
  168. return <div class={ 'font-medium' }>{ row.launch_date ? row.launch_date : '--' }</div>;
  169. }
  170. }
  171. },
  172. {
  173. field: 'category', title: '类 目', minWidth: 'auto', align: 'center',
  174. slots: {
  175. default({ row }: any) {
  176. return <div class={ 'font-medium' }>{ row.category ? row.category : '--' }</div>;
  177. }
  178. }
  179. },
  180. {
  181. field: 'status', title: '状 态', minWidth: 'auto', align: 'center',
  182. slots: {
  183. default({ row }: any) {
  184. const statusText = row.status === 1 ? '在售' : '停售';
  185. const statusType = row.status === 1 ? 'success' : 'info';
  186. return (
  187. <el-tag type={ statusType }>
  188. { statusText }
  189. </el-tag>
  190. );
  191. }
  192. }
  193. },
  194. {
  195. field: 'update_datetime', title: '更新时间', minWidth: 'auto', align: 'center',
  196. slots: {
  197. default({ row }: any) {
  198. return <div class={ 'font-medium' }>{ row.update_datetime ? row.update_datetime : '--' }</div>;
  199. }
  200. }
  201. },
  202. {
  203. field: 'create_datetime', title: '创建时间', minWidth: 'auto', align: 'center',
  204. slots: {
  205. default({ row }: any) {
  206. return <div class={ 'font-medium' }>{ row.create_datetime ? row.create_datetime : '--' }</div>;
  207. }
  208. }
  209. },
  210. {
  211. field: 'operate', title: '操 作', width: 100, align: 'center', fixed: 'right',
  212. slots: { default: 'operate' }
  213. }
  214. ];