Browse Source

نمایش صحیح لست سفارش ها در یک سبد

hgh 1 year ago
parent
commit
36061dc3b3

+ 26 - 7
src/components/Widgets/Store/Basket/AdminStoreBasketShow/AdminStoreBasketShow.vue

@@ -61,6 +61,18 @@
             <q-img :src="inputData.col.value"
                    width="100px" />
           </template>
+          <template v-else-if="inputData.col.name === 'download'">
+            <q-btn v-if="!inputData.col.value"
+                   color="primary"
+                   @click="openDownloadDialog(inputData.props.row)">
+              <q-icon name="download"
+                      class="q-mr-sm" />
+              دانلود
+            </q-btn>
+            <template v-else>
+              {{}}
+            </template>
+          </template>
           <template v-else-if="inputData.col.name === 'action'">
             <q-btn color="primary"
                    outline
@@ -83,7 +95,7 @@
 import { shallowRef } from 'vue'
 import { Basket } from 'src/models/Basket.js'
 import { Product } from 'src/models/Product.js'
-import { Package } from 'src/models/Package.js'
+// import { Package } from 'src/models/Package.js'
 import { mixinWidget } from 'src/mixin/Mixins.js'
 import { APIGateway } from 'src/api/APIGateway.js'
 import BtnControl from 'components/Control/btn.vue'
@@ -133,14 +145,14 @@ export default {
             required: true,
             label: 'شناسه',
             align: 'left',
-            field: row => row.id
+            field: row => row.product_info?.id ? row.product_info.id : row.package_info.id
           },
           {
             name: 'title',
             required: true,
             label: 'نام محصول',
             align: 'left',
-            field: row => (row.product_info || row.package_info).title
+            field: row => (row.product_info?.id ? row.product_info : row.package_info).title
           },
           {
             name: 'is_package_or_product',
@@ -154,14 +166,14 @@ export default {
             required: true,
             label: 'دسته فروشگاه',
             align: 'left',
-            field: row => ((row.product_info || row.package_info).store_category_info?.parent?.parent?.title || '-') + '، ' + ((row.product_info || row.package_info).store_category_info?.parent?.title || '-') + '، ' + ((row.product_info || row.package_info).store_category_info?.title || '-')
+            field: row => ((row.product_info?.id ? row.product_info : row.package_info).store_category_info?.parent?.parent?.title || '-') + '، ' + ((row.product_info || row.package_info).store_category_info?.parent?.title || '-') + '، ' + ((row.product_info || row.package_info).store_category_info?.title || '-')
           },
           {
             name: 'store_category1',
             required: true,
             label: 'دسته محتوا',
             align: 'left',
-            field: row => ((row.product_info || row.package_info).content_category_info?.parent?.parent?.title || '-') + '، ' + ((row.product_info || row.package_info).content_category_info?.parent?.title || '-') + '، ' + ((row.product_info || row.package_info).content_category_info?.title || '-')
+            field: row => ((row.product_info?.id ? row.product_info : row.package_info).content_category_info?.parent?.parent?.title || '-') + '، ' + ((row.product_info || row.package_info).content_category_info?.parent?.title || '-') + '، ' + ((row.product_info || row.package_info).content_category_info?.title || '-')
           },
           {
             name: 'count',
@@ -175,7 +187,7 @@ export default {
             required: true,
             label: 'نوع جنس',
             align: 'left',
-            field: row => row.product_info ? (new Product(row.product_info)).is_physical_info.label : (new Package(row.product_info)).is_physical_info.label
+            field: row => (row.product_info?.id ? row.product_info : row.package_info).is_physical_info.label
           },
           {
             name: 'physical_type_info',
@@ -189,7 +201,14 @@ export default {
             required: true,
             label: 'قیمت',
             align: 'left',
-            field: row => parseInt((row.product_info || row.package_info).unit_price.toString()).toLocaleString('fa')
+            field: row => parseInt((row.product_info?.id ? row.product_info : row.package_info).unit_price?.toString()).toLocaleString('fa')
+          },
+          {
+            name: 'download',
+            required: true,
+            label: 'دانلود',
+            align: 'left',
+            field: row => (row.product_info?.id ? row.product_info : row.package_info).is_physical
           },
           {
             name: 'action',