somewhere

This commit is contained in:
Swift
2023-08-17 13:05:51 +03:30
parent 30c7eb0e7b
commit 53843207cc
429 changed files with 117489 additions and 1 deletions
+140
View File
@@ -0,0 +1,140 @@
<template>
<user-dashboard-container page-class="post" panel-title="افزودن تیکت">
<form class="form form_3" @submit.prevent="post">
<div class="formRow" :class="validation.title ? 'err' : null">
<label for="title">:عنوان تیکت</label>
<input id="title" v-model="ticket.title" type="text" />
<p v-if="validation.title">{{ validation.title.msg }}</p>
</div>
<div class="formRow">
<label>کد پذیرش:</label>
<el-select v-model="ticket.transaction_id" filterable :placeholder="tnPlaceholder" :loading="fetching">
<el-option-group :key="0" label="پذیرش موقت ها">
<el-option
v-for="(item, index) in ttns"
:key="index + '_getAll_tempTransactions_for_new_ticket'"
:value="item"
></el-option>
</el-option-group>
<el-option-group :key="1" label="پذیرش دائم ها">
<el-option
v-for="(item, index) in atns"
:key="index + '_getAll_transactions_for_new_ticket'"
:value="item"
></el-option>
</el-option-group>
</el-select>
</div>
<div class="btnRow">
<button class="btn btn-primary" type="submit">
<span>افزودن</span>
<i class="far fa-plus-circle"></i>
</button>
</div>
</form>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAddTicket',
layout: 'user',
data() {
return {
verityTransactions: [],
panatechTransactions: [],
agentsTransactions: [],
fetching: false,
ticket: {
title: '',
transaction_id: '',
user_id: this.$auth.user._id
},
validation: {}
}
},
computed: {
transactions() {
return [...this.verityTransactions, ...this.panatechTransactions, ...this.agentsTransactions]
},
ttns() {
const array = []
this.transactions.forEach(item => {
if (!item.ItemReceptionTransNumber) array.push(item.TempReceiptTransNumber)
})
return array
},
atns() {
const array = []
this.transactions.forEach(item => {
if (item.ItemReceptionTransNumber) array.push(item.ItemReceptionTransNumber)
})
return array
},
tnPlaceholder() {
if (this.fetching) return 'در حال بارگیری...'
else return 'اختیاری'
}
},
async mounted() {
try {
this.fetching = true
const user = this.$auth.user
const verityData = {
url: `/api/GetItemReceptionInfo?BusinessCode=${user.verity_businessCode}`,
db: 'verity'
}
const panatechData = {
url: `/api/GetItemReceptionInfo?BusinessCode=${user.panatech_businessCode}`,
db: 'panatech'
}
const allData = await Promise.all([
// fetch verityTransactions
this.$axios.post('/api/cross/getRouteManager', verityData),
// fetch panatechTransactions
this.$axios.post('/api/cross/getRouteManager', panatechData),
// fetch agentstransactions
this.$axios.get('/api/user/transactions')
])
const verityTransactions = allData[0]
const panatechTransactions = allData[1]
const agentsTransactions = allData[2]
this.verityTransactions = verityTransactions.data.data
this.panatechTransactions = panatechTransactions.data.data
this.agentsTransactions = agentsTransactions.data
this.fetching = false
} catch (e) {
this.$arpaError()
}
},
methods: {
post() {
this.validation = {}
this.$axios
.post('/api/user/addTicketConversation', this.ticket)
.then(res => {
this.$message({
type: 'success',
message: 'تیکت با موفقیت ثبت شد، پیام خودرا بنویسید.'
})
this.$router.push({ name: 'account-tickets-ticket', params: { ticket: res.data._id } })
})
.catch(err => {
if (err.response.data.status === 401) {
return this.$message({
type: 'warning',
message: 'لطفا دوباره وارد حساب خود شوید'
})
}
if (err.response.status === 422) this.validation = err.response.data.validation
else console.log(err)
})
}
}
}
</script>
@@ -0,0 +1,39 @@
<template>
<user-dashboard-container page-class="announcements" panel-title="اطلاعیه های نمایندگان">
<div v-for="item in agentAnnouncements" :key="item._id" class="item" :class="!item.seen && 'unread'">
<el-collapse :key="item._id + 'co_parent'" accordion @change="seeAnnouncement">
<el-collapse-item :key="item._id + 'co_item'" :name="item._id">
<template slot="title">
<h3>{{ item.title }}</h3>
</template>
<div>
<p>{{ item.caption }}</p>
</div>
</el-collapse-item>
</el-collapse>
</div>
<h3 v-if="!agentAnnouncements.length" style="text-align: center; margin-top: 50px">هیچ اطلاعیه ای موجود نیست</h3>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAgentAnnouncements',
layout: 'user',
data() {
return {}
},
computed: {
agentAnnouncements() {
return this.$store.state.front.agentAnnouncements
}
},
methods: {
seeAnnouncement(id) {
if (!id) return
const item = this.agentAnnouncements.find(item => item._id === id)
if (!item.seen) this.$agentSocket.emit('agent:updateAnnouncement', id)
}
}
}
</script>
+297
View File
@@ -0,0 +1,297 @@
<template>
<user-dashboard-container page-class="post agent-requests-details" panel-title="فرم درخواست کالای بافر">
<el-alert v-if="bufferRequest.status === 'temp'" :title="alertMsg" class="mb-3" type="warning"> </el-alert>
<form class="form form_3">
<div class="userInfo">
<div class="formRow">
<label for="customer_name">نام و نام خانوادگی:</label>
<input id="customer_name" type="text" :value="bufferRequest.agent_id.full_name" disabled />
</div>
<div class="formRow">
<label for="customer_code">کد نمایندگی:</label>
<input id="customer_code" type="text" :value="bufferRequest.agent_id.agent_code" disabled />
</div>
<div class="formRow">
<label for="mobile">شماره موبایل:</label>
<input id="mobile" type="text" :value="bufferRequest.agent_id.mobile_number" disabled />
</div>
<div class="formRow">
<label for="fax">شماره فکس:</label>
<input id="fax" type="text" :value="bufferRequest.agent_id.fax_number" disabled />
</div>
<div class="formRow">
<label for="province">استان:</label>
<input id="province" type="text" :value="bufferRequest.agent_id.province_name" disabled />
</div>
<div class="formRow">
<label for="city">شهر:</label>
<input id="city" type="text" :value="bufferRequest.agent_id.city_name" disabled />
</div>
</div>
<div class="formRow">
<label>آدرس:</label>
<textarea name="description" cols="30" rows="5" disabled :value="bufferRequest.agent_id.address"></textarea>
</div>
<hr />
<div class="formRow">
<label v-if="bufferRequest.status === 'temp'" for="description">توضیحات فرم (اختیاری):</label>
<label v-else for="description">توضیحات فرم:</label>
<el-tooltip
v-model="descriptionTooltip"
class="item"
effect="dark"
content="میتوانید توضیحات را در هر زمان تغییر دهید"
placement="top-start"
:disabled="bufferRequest.status !== 'temp'"
>
<textarea
id="description"
v-model="bufferRequest.description"
name="description"
:disabled="bufferRequest.status !== 'temp'"
:placeholder="descriptionPlaceHolder"
cols="30"
rows="10"
@blur="updateDescription"
></textarea>
</el-tooltip>
</div>
</form>
<div class="add-list">
<h2>لیست کالاهای بافر درخواستی:</h2>
<div class="tableBox">
<table class="pieces-items">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="itemName">نام کالا</th>
<th class="quantity">تعداد</th>
<th v-if="bufferRequest.status === 'temp'" class="removeBtn">حذف</th>
</tr>
</thead>
<tbody>
<tr
v-for="(item, index) in bufferRequest.items"
:key="item.ItemID + index + '_br_buffers'"
:title="item.ItemName"
>
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="itemName">
<span class="singleLineTxt">{{ item.ItemName }}</span>
</td>
<td class="quantity">
<span>{{ item.bufferQuantity }}</span>
</td>
<td v-if="bufferRequest.status === 'temp'" class="removeBtn">
<button class="trashIcon-btn" title="حذف پیشنویس" @click="removeItemFromList(item._id)">
<i class="fal fa-trash-alt"></i>
</button>
</td>
</tr>
<tr v-if="!bufferRequest.items.length" class="odd">
<td class="noItem" colspan="5">
<p style="color: #000">هنوز هیچ آیتمی اضافه نکردید.</p>
</td>
</tr>
<tr v-if="bufferRequest.status === 'temp'" class="addStuffBtn" @click="bufferModal = true">
<td colspan="5">
<button>
<span>افزودن قطعه</span>
<i class="far fa-plus"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
<hr />
<div v-if="bufferRequest.status === 'temp'" class="btnRow">
<button class="btn btn-primary" @click="sendForm">ارسال به آسان سرویس</button>
<button class="btn btn-danger" @click="removeBR">حذف این فرم</button>
</div>
</div>
<template #body>
<AddBuffersToBufferRequest
:key="buffersModalKey"
:show="bufferModal"
:br-id="bufferRequest._id"
@closeModal="closeBuffersModal"
/>
</template>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAgentBufferDetails',
layout: 'user',
async asyncData({ $axios, params, error }) {
try {
const bufferRequest = await $axios.get(`/api/agent/br/${params.br}`)
return {
bufferRequest: bufferRequest.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
bufferRequest: null,
validation: {},
bufferModal: false,
buffersModalKey: 0,
descriptionTooltip: false,
alertMsg:
'این درخواست در پیشنویس ها ذخیره شده و هنوز در پایگاه داده شرکت آسان سرویس ثبت نگردیده. شما میتوانید قطعات را در هر زمان به این فرم اضافه یا از فرم حذف کنید سپس نسبت به ارسال نهایی اقدام کنید.'
}
},
computed: {
brId() {
return this.$route.params.br
},
descriptionPlaceHolder() {
if (this.bufferRequest.status === 'temp') return 'توضیحات راجع به کالای بافر را میتوانید اینجا بنویسید'
else return 'بدون توضیحات'
}
},
mounted() {
setTimeout(() => {
if (this.bufferRequest.status === 'temp') this.descriptionTooltip = true
}, 1000)
},
methods: {
closeBuffersModal() {
this.bufferModal = false
this.buffersModalKey = Math.random()
},
removeItemFromList(id) {
if (this.bufferRequest.status !== 'temp') return
this.$confirm('این مورد حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/removeBrItems/${id}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در انجام عملیات پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
},
updateDescription() {
if (this.bufferRequest.status !== 'temp') return
const data = { description: this.bufferRequest.description }
this.$axios
.put(`/api/agent/brDescription/${this.brId}`, data)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در ثبت اطلاعات پیش آمده'
})
})
},
sendForm() {
this.$confirm('فرم درخواست کالای بافر به آسان سرویس ارسال شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.post(`/api/agent/sendBr/${this.brId}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$router.push({ name: 'account-agents-buffer', query: { type: 'sent' } })
})
.catch(err => {
let msg = 'مشکلی در ارسال درخواست پیش آمده'
if (err.response.status === 406) msg = err.response.data.message
this.$message({
type: 'error',
message: msg
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
},
removeBR() {
this.$confirm('این فرم از پیشنویس ها حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/br/${this.brId}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$router.push({ name: 'account-agents-buffer', query: { type: 'temp' } })
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در حذف پیشنویس پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
+232
View File
@@ -0,0 +1,232 @@
<template>
<user-dashboard-container page-class="agent-requests" panel-title="لیست درخواست های کالای بافر">
<div class="filter mb-5">
<h4 style="display: inline-block; margin-left: 15px">مشاهده لیست:</h4>
<button class="switchBtns btn" :class="type === 'temp' && 'btn-primary'" @click="type = 'temp'">
پیشنویس ها
</button>
<button class="switchBtns btn" :class="type === 'sent' && 'btn-primary'" @click="type = 'sent'">
ارسال شده ها
</button>
<button class="switchBtns btn" :class="type === 'delivered' && 'btn-primary'" @click="type = 'delivered'">
انجام شده ها
</button>
<div v-if="type !== 'temp'" class="search mt-3" :class="serachBoxClass">
<el-input v-model="searchInput" clearable placeholder="جستجو در لیست با کد پیگیری" />
</div>
</div>
<div class="tableBox">
<table class="agent-requests" :class="type !== 'temp' && 'extended'">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="description">توضیحات</th>
<th class="createDate">تاریخ ایجاد</th>
<template v-if="type === 'sent' || type === 'delivered'">
<th class="sendDate">تاریخ ارسال</th>
<th class="trackingCode">کد پیگیری</th>
<th class="status">وضعیت</th>
</template>
<th v-if="type === 'delivered'" class="deliveryCode">کد ارسال مرسوله</th>
<th class="quantity">تعداد کالا</th>
<th class="details">جزئیات</th>
</tr>
</thead>
<tbody>
<template v-if="filteredList.length">
<tr v-for="(item, index) in filteredList" :key="item._id" :title="item.description">
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="description">
<span v-if="item.description" class="singleLineTxt">{{ item.description }}</span>
<span v-else style="color: gray">بدون توضیحات</span>
</td>
<td class="createDate">
<span> {{ $jDate(item.createDate) }} </span>
</td>
<template v-if="type === 'sent' || type === 'delivered'">
<td class="sendDate">
<span>{{ $jDate(item.sendDate) }}</span>
</td>
<td class="trackingCode">
<span>{{ item.trackingCode }}</span>
</td>
<td class="status">
<span v-if="item.status === 'sent'">ارسال شده</span>
<span v-if="item.status === 'ongoing'">در دست اقدام</span>
<span v-if="item.status === 'waiting'">در انتظار قطعه</span>
<span v-if="item.status === 'delivered'">تحویل شده</span>
</td>
</template>
<td v-if="type === 'delivered'" class="deliveryCode">
<span>{{ item.deliveryCode || '-' }}</span>
</td>
<td class="quantity">
<span>{{ totalItemsCount(item.items) }}</span>
</td>
<td class="details">
<template v-if="item.status === 'temp'">
<button class="trashIcon-btn" title="حذف پیشنویس" @click="removePR(item._id)">
<i class="fal fa-trash-alt"></i>
</button>
<nuxt-link
:to="{
name: 'account-agents-buffer-br',
params: {
br: item._id
}
}"
class="btn btn-primary"
>
تکمیل فرم
</nuxt-link>
</template>
<nuxt-link
v-else
:to="{
name: 'account-agents-buffer-br',
params: {
br: item._id
}
}"
class="btn btn-primary"
>
مشاهده
</nuxt-link>
</td>
</tr>
</template>
<tr v-else>
<td class="noItem">
<span>هیچ اطلاعاتی وجود ندارد</span>
</td>
</tr>
<tr v-if="type === 'temp'" class="addStuffBtn" @click="addBufferRequest">
<td colspan="5">
<button>
<span>افزودن درخواست</span>
<i class="far fa-plus"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAgentBufferList',
layout: 'user',
async asyncData({ $axios, $auth, error }) {
try {
const bufferRequests = await $axios.get('/api/agent/brList')
return {
bufferRequests: bufferRequests.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
bufferRequests: null,
searchInput: ''
}
},
computed: {
type: {
get() {
return this.$route.query.type
},
set(val) {
this.$router.push({ name: 'account-agents-buffer', query: { type: val } })
}
},
serachBoxClass() {
if (this.searchInput && this.filteredList.length) return 'success'
if (this.searchInput && !this.filteredList.length) return 'error'
return null
},
filteredList() {
let filteredBySearch
if (!this.searchInput || this.type === 'temp') filteredBySearch = this.bufferRequests
else {
filteredBySearch = this.bufferRequests.filter(item =>
item.trackingCode?.toLowerCase().includes(this.searchInput.toLowerCase())
)
}
return filteredBySearch.filter(item => {
if (this.type === 'temp') return item.status === 'temp'
if (this.type === 'sent') return item.status !== 'temp' && item.status !== 'delivered'
if (this.type === 'delivered') return item.status === 'delivered'
return false
})
}
},
methods: {
addBufferRequest() {
this.$axios
.post('/api/agent/br')
.then(res => {
this.$message({
type: 'success',
message: 'درخواست جدید افزوده شد'
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در افزودن درخواست پیش آمده'
})
})
},
totalItemsCount(items) {
let count = 0
items.forEach(item => (count += item.bufferQuantity))
return count
},
removePR(id) {
this.$confirm('این درخواست از پیشنویس ها حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/br/${id}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در حذف درخواست پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
+53
View File
@@ -0,0 +1,53 @@
<template>
<user-dashboard-container page-class="agent-requests" panel-title="ویرایش اطلاعات نمایندگی">
<div class="upload-assets">
<el-skeleton v-if="loading" class="mt-5" :rows="6" />
<template v-else>
<template v-if="lastRepresentation.editAccess">
<EnrollRepresentationForm :data="lastRepresentation"/>
</template>
<div v-else class="mt-5" style="text-align: center; color: red">
<h3>شما دسترسی ویرایش اطلاعات ندارید</h3>
</div>
</template>
</div>
</user-dashboard-container>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'AgentEditInfo',
layout: 'user',
data() {
return {
lastRepresentation: {},
loading: true
}
},
head() {
return {
title: 'آسان سرویس | ویرایش اطلاعات'
}
},
computed: {
...mapGetters({
agentAssetCategories: 'front/agentAssetCategories'
}),
user() {
return this.$auth.user
}
},
async mounted() {
try {
const lastRep = await this.$axios.$get(`/api/user/representation/${this.user.representation_id}`)
this.lastRepresentation = lastRep
} catch (err) {
console.log('err', err)
}
this.loading = false
}
}
</script>
@@ -0,0 +1,81 @@
<template>
<user-dashboard-container page-class="agent-requests" panel-title="ویرایش مدارک نمایندگی">
<div class="upload-assets">
<el-skeleton v-if="loading" class="mt-5" :rows="6" />
<template v-else>
<template v-if="lastRepresentation.upload">
<div class="upload-description mt-0">
<h3>نکاتی درباره بارگذاری مدارک:</h3>
<ul>
<li>
<span>در هر بخش تصاویر مدارک مربوطه را بارگذاری نمایید.</span>
</li>
<li>
<span>فیلدهای بارگذاری عکس در این صفحه هیچ کدام اجباری نیست.</span>
</li>
<li>
<span>فرمت مجاز تصاور jpeg میباشد.</span>
</li>
<li>
<span>نهایت حجم مجاز برای هر تصویر 2 مگابایت میباشد.</span>
</li>
</ul>
</div>
<div class="upload">
<section v-for="item in agentAssetCategories" :key="item.title">
<h3>{{ item.title }}</h3>
<p>{{ item.description }}</p>
<RepresentationImageUploader
:name="item.fieldName"
:files-list="lastRepresentation[item.fieldName] || []"
:representation_code="lastRepresentation.representation_code"
/>
</section>
</div>
</template>
<div v-else class="mt-5" style="text-align: center; color: red">
<h3>شما دسترسی ویرایش مدارک ندارید</h3>
</div>
</template>
</div>
</user-dashboard-container>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'AgentAssetsEdit',
layout: 'user',
data() {
return {
lastRepresentation: {},
loading: true
}
},
head() {
return {
title: 'آسان سرویس | ویرایش مدارک'
}
},
computed: {
...mapGetters({
agentAssetCategories: 'front/agentAssetCategories'
}),
user() {
return this.$auth.user
}
},
async mounted() {
try {
const lastRep = await this.$axios.$get(`/api/user/representation/${this.user.representation_id}`)
this.lastRepresentation = lastRep
} catch (err) {
console.log('err', err)
}
this.loading = false
}
}
</script>
@@ -0,0 +1,341 @@
<template>
<user-dashboard-container page-class="post agent-requests-details" panel-title="فرم گزارش عملکرد گارانتی">
<el-alert v-if="guaranteeReport.status === 'temp'" :title="alertMsg" class="mb-3" type="warning"> </el-alert>
<form class="form form_3">
<div class="userInfo">
<div class="formRow">
<label for="customer_name">نام و نام خانوادگی:</label>
<input id="customer_name" type="text" :value="guaranteeReport.agent_id.full_name" disabled />
</div>
<div class="formRow">
<label for="customer_code">کد نمایندگی:</label>
<input id="customer_code" type="text" :value="guaranteeReport.agent_id.agent_code" disabled />
</div>
<div class="formRow">
<label for="mobile">شماره موبایل:</label>
<input id="mobile" type="text" :value="guaranteeReport.agent_id.mobile_number" disabled />
</div>
<div class="formRow">
<label for="fax">شماره فکس:</label>
<input id="fax" type="text" :value="guaranteeReport.agent_id.fax_number" disabled />
</div>
<div class="formRow">
<label for="province">استان:</label>
<input id="province" type="text" :value="guaranteeReport.agent_id.province_name" disabled />
</div>
<div class="formRow">
<label for="city">شهر:</label>
<input id="city" type="text" :value="guaranteeReport.agent_id.city_name" disabled />
</div>
</div>
<div class="formRow">
<label>آدرس:</label>
<textarea name="description" cols="30" rows="5" disabled :value="guaranteeReport.agent_id.address"></textarea>
</div>
<hr />
<div class="formRow">
<label v-if="guaranteeReport.status === 'temp'" for="description">توضیحات فرم (اختیاری):</label>
<label v-else for="description">توضیحات فرم:</label>
<el-tooltip
v-model="descriptionTooltip"
class="item"
effect="dark"
content="میتوانید توضیحات را در هر زمان تغییر دهید"
placement="top-start"
:disabled="guaranteeReport.status !== 'temp'"
>
<textarea
id="description"
v-model="guaranteeReport.description"
name="description"
:disabled="guaranteeReport.status !== 'temp'"
:placeholder="descriptionPlaceHolder"
cols="30"
rows="10"
@blur="updateDescription"
></textarea>
</el-tooltip>
</div>
</form>
<div class="notes">
<h3>توجه:</h3>
<ul>
<li>
<p>مدارک گارانتی فقط تا سه ماه بعد از تاریخ پذیرش دستگاه اعتبار دارد.</p>
</li>
<li>
<p>هر سه ماه یک بار مدارک گارانتی خود را جهت تسویه حساب به همراه داغی قطعات ارسال نمایید.</p>
</li>
</ul>
</div>
<div class="add-list">
<h2>لیست قطعات درخواستی:</h2>
<div class="tableBox">
<table class="report-items">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="customerName">نام مشتری</th>
<th class="customerTel">تلفن مشتری</th>
<th class="itemName">نام کالا</th>
<th class="itemSerial">سریال گارانتی</th>
<th class="productIssue">ایراد کالا</th>
<th class="usedPieces">قطعات مصرفی</th>
<th class="recieveDate">تاریخ دریافت</th>
<th class="deliverDate">تاریخ تحویل</th>
<th v-if="guaranteeReport.status === 'temp'" class="removeBtn">حذف</th>
</tr>
</thead>
<tbody>
<tr
v-for="(item, index) in guaranteeReport.items"
:key="item.ItemID + index + '_gr_reports'"
:title="item.ItemName + ' - ' + item.pieceName"
>
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="customerName">
<span>{{ item.customerName }}</span>
</td>
<td class="customerTel">
<span>{{ item.customerTel }}</span>
</td>
<td class="itemName">
<span>{{ item.ItemName }}</span>
</td>
<td class="itemSerial">
<span>{{ item.SerialNo1 || '-' }}</span>
</td>
<td class="productIssue">
<span> {{ item.productIssue }} </span>
</td>
<td class="usedPieces">
<span> {{ item.usedPieces }} </span>
</td>
<td class="recieveDate">
<span> {{ $jDate(item.recieveDate) }} </span>
</td>
<td class="deliverDate">
<span> {{ $jDate(item.deliverDate) }} </span>
</td>
<td v-if="guaranteeReport.status === 'temp'" class="removeBtn">
<button class="trashIcon-btn" title="حذف پیشنویس" @click="removeItemFromList(item._id)">
<i class="fal fa-trash-alt"></i>
</button>
</td>
</tr>
<tr v-if="!guaranteeReport.items.length" class="odd">
<td class="noItem" colspan="5">
<p style="color: #000">هنوز هیچ آیتمی اضافه نکردید.</p>
</td>
</tr>
<tr v-if="guaranteeReport.status === 'temp'" class="addStuffBtn" @click="reportModal = true">
<td colspan="5">
<button>
<span>افزودن گزارش</span>
<i class="far fa-plus"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
<hr />
<div v-if="guaranteeReport.status === 'temp'" class="btnRow">
<button class="btn btn-primary" @click="sendForm">ارسال به آسان سرویس</button>
<button class="btn btn-danger" @click="removeGR">حذف این فرم</button>
</div>
</div>
<template #body>
<AddReportToGuaranteeReportForm
:key="reportModalKey"
:show="reportModal"
:gr-id="guaranteeReport._id"
@closeModal="closeReportModal"
/>
</template>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAgentGrDetails',
layout: 'user',
async asyncData({ $axios, params, error }) {
try {
const guaranteeReport = await $axios.get(`/api/agent/gr/${params.gr}`)
return {
guaranteeReport: guaranteeReport.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
guaranteeReport: null,
validation: {},
reportModal: false,
reportModalKey: 0,
descriptionTooltip: false,
alertMsg:
'این فرم گزارش عملکرد در پیشنویس ها ذخیره شده و هنوز در پایگاه داده شرکت آسان سرویس ثبت نگردیده. شما میتوانید گزارش ها را در هر زمان به این فرم اضافه یا از فرم حذف کنید سپس نسبت به ارسال نهایی اقدام کنید.'
}
},
computed: {
grId() {
return this.$route.params.gr
},
descriptionPlaceHolder() {
if (this.guaranteeReport.status === 'temp') return 'توضیحات راجع به فرم گزارش را میتوانید اینجا بنویسید'
else return 'بدون توضیحات'
}
},
mounted() {
setTimeout(() => {
if (this.guaranteeReport.status === 'temp') this.descriptionTooltip = true
}, 1000)
},
methods: {
closeReportModal() {
this.reportModal = false
this.reportModalKey = Math.random()
},
removeItemFromList(id) {
if (this.guaranteeReport.status !== 'temp') return
this.$confirm('این مورد حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/removeGrItems/${id}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در انجام عملیات پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
},
updateDescription() {
if (this.guaranteeReport.status !== 'temp') return
const data = { description: this.guaranteeReport.description }
this.$axios
.put(`/api/agent/grDescription/${this.grId}`, data)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در ثبت اطلاعات پیش آمده'
})
})
},
sendForm() {
this.$confirm('فرم گزارش عملکرد گارانتی به آسان سرویس ارسال شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.post(`/api/agent/sendGr/${this.grId}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$router.push({ name: 'account-agents-guaranteeReports', query: { type: 'sent' } })
})
.catch(err => {
let msg = 'مشکلی در ارسال گزارش پیش آمده'
if (err.response.status === 406) msg = err.response.data.message
this.$message({
type: 'error',
message: msg
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
},
removeGR() {
this.$confirm('این فرم از پیشنویس ها حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/gr/${this.grId}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$router.push({ name: 'account-agents-guaranteeReports', query: { type: 'temp' } })
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در حذف پیشنویس پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
@@ -0,0 +1,220 @@
<template>
<user-dashboard-container page-class="agent-requests" panel-title="لیست گزارش عملکرد گارانتی">
<div class="filter mb-5">
<h4 style="display: inline-block; margin-left: 15px">مشاهده لیست:</h4>
<button class="switchBtns btn" :class="type === 'temp' && 'btn-primary'" @click="type = 'temp'">
پیشنویس ها
</button>
<button class="switchBtns btn" :class="type === 'sent' && 'btn-primary'" @click="type = 'sent'">
ارسال شده ها
</button>
<div v-if="type === 'sent'" class="search mt-3" :class="serachBoxClass">
<el-input v-model="searchInput" clearable placeholder="جستجو در لیست با کد پیگیری" />
</div>
</div>
<div class="tableBox">
<table class="agent-requests" :class="type !== 'temp' && 'extended'">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="description">توضیحات</th>
<th class="createDate">تاریخ ایجاد</th>
<template v-if="type === 'sent' || type === 'delivered'">
<th class="sendDate">تاریخ ارسال</th>
<th class="trackingCode">کد پیگیری</th>
<th class="status">وضعیت</th>
</template>
<th class="quantity">تعداد گزارش</th>
<th class="details">جزئیات</th>
</tr>
</thead>
<tbody>
<template v-if="filteredList.length">
<tr v-for="(item, index) in filteredList" :key="item._id" :title="item.description">
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="description">
<span v-if="item.description" class="singleLineTxt">{{ item.description }}</span>
<span v-else style="color: gray">بدون توضیحات</span>
</td>
<td class="createDate">
<span> {{ $jDate(item.createDate) }} </span>
</td>
<template v-if="type === 'sent' || type === 'delivered'">
<td class="sendDate">
<span>{{ $jDate(item.sendDate) }}</span>
</td>
<td class="trackingCode">
<span>{{ item.trackingCode }}</span>
</td>
<td class="status">
<span v-if="item.status === 'sent'">ارسال شده</span>
<!-- <span v-if="item.status === 'ongoing'">در دست اقدام</span>
<span v-if="item.status === 'waiting'">در انتظار قطعه</span>
<span v-if="item.status === 'delivered'">تحویل شده</span> -->
</td>
</template>
<td class="quantity">
<span>{{ totalItemsCount(item.items) }}</span>
</td>
<td class="details">
<template v-if="item.status === 'temp'">
<button class="trashIcon-btn" title="حذف پیشنویس" @click="removeGR(item._id)">
<i class="fal fa-trash-alt"></i>
</button>
<nuxt-link
:to="{
name: 'account-agents-guaranteeReports-gr',
params: {
gr: item._id
}
}"
class="btn btn-primary"
>
تکمیل فرم
</nuxt-link>
</template>
<nuxt-link
v-else
:to="{
name: 'account-agents-guaranteeReports-gr',
params: {
gr: item._id
}
}"
class="btn btn-primary"
>
مشاهده
</nuxt-link>
</td>
</tr>
</template>
<tr v-else>
<td class="noItem">
<span>هیچ اطلاعاتی وجود ندارد</span>
</td>
</tr>
<tr v-if="type === 'temp'" class="addStuffBtn" @click="addGuaranteeReport">
<td colspan="5">
<button>
<span>افزودن فرم گزارش</span>
<i class="far fa-plus"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAgentGrList',
layout: 'user',
async asyncData({ $axios, $auth, error }) {
try {
const guaranteeReports = await $axios.get('/api/agent/grList')
return {
guaranteeReports: guaranteeReports.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
guaranteeReports: null,
searchInput: ''
}
},
computed: {
type: {
get() {
return this.$route.query.type
},
set(val) {
this.$router.push({ name: 'account-agents-guaranteeReports', query: { type: val } })
}
},
serachBoxClass() {
if (this.searchInput && this.filteredList.length) return 'success'
if (this.searchInput && !this.filteredList.length) return 'error'
return null
},
filteredList() {
let filteredBySearch
if (!this.searchInput || this.type === 'temp') filteredBySearch = this.guaranteeReports
else {
filteredBySearch = this.guaranteeReports.filter(item =>
item.trackingCode?.toLowerCase().includes(this.searchInput.toLowerCase())
)
}
return filteredBySearch.filter(item => {
if (this.type === 'temp') return item.status === 'temp'
if (this.type === 'sent') return item.status !== 'temp'
return false
})
}
},
methods: {
addGuaranteeReport() {
this.$axios
.post('/api/agent/gr')
.then(res => {
this.$message({
type: 'success',
message: 'فرم گزارش جدید افزوده شد'
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در افزودن گزارش پیش آمده'
})
})
},
totalItemsCount(items) {
return items.length
},
removeGR(id) {
this.$confirm('این گزارش از پیشنویس ها حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/gr/${id}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در حذف گزارش پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
+159
View File
@@ -0,0 +1,159 @@
<template>
<user-dashboard-container page-class="guarantee" panel-title="صندوق ورودی نماینده">
<div class="filter mb-5">
<h4 style="display: inline-block; margin-left: 15px">مشاهده لیست:</h4>
<button class="switchBtns btn" :class="type === 'ttl' && 'btn-primary'" @click="type = 'ttl'">دریافتی ها</button>
<button class="switchBtns btn" :class="type === 'atl' && 'btn-primary'" @click="type = 'atl'">
پذیرش شده ها
</button>
<div class="search mt-3" :class="serachBoxClass">
<el-input v-model="searchInput" clearable placeholder="جستجو در لیست با کد پذیرش موقت یا دائم" />
</div>
</div>
<div class="tableBox">
<table class="qaurantee">
<thead>
<tr>
<th>ردیف</th>
<th>شماره پذیرش موقت</th>
<th>تاریخ ارسال فرم</th>
<template v-if="type === 'atl'">
<th>شماره پذیرش دائم</th>
<th>تاریخ پذیرش</th>
<th>وضعیت</th>
</template>
<th class="brand">برند</th>
<th>جزئیات</th>
</tr>
</thead>
<tbody>
<template v-if="filteredList.length">
<tr v-for="(item, index) in filteredList" :key="item._id" :class="!item.seen && 'unread'">
<td>
<span>{{ index + 1 }}</span>
</td>
<td>
<span>{{ item.TempReceiptTransNumber }}</span>
</td>
<td>
<span>{{ $jDate(item.TempReceiptTransDate) }}</span>
</td>
<template v-if="type === 'atl'">
<td>
<span>{{ item.ItemReceptionTransNumber }}</span>
</td>
<td>
<span>{{ $jDate(item.ItemReceptionTransDate) }}</span>
</td>
<td>
<span v-if="item.status === 'recieved'">پذیرش شده</span>
<span v-if="item.status === 'ongoing'">در دست اقدام</span>
<span v-if="item.status === 'waiting'">در انتظار قطعه</span>
<span v-if="item.status === 'delivered'">تحویل شده</span>
</td>
</template>
<td class="brand">
<!-- <img
v-if="item.db_name === 'verity'"
src="/assets/img/verity-small.png"
alt="verity"
style="width: 80px;"
/>
<img
v-if="item.db_name === 'panatech'"
src="/assets/img/panatech-small.png"
alt="panatech"
style="width: 80px;"
/> -->
<i
v-if="item.db_name === 'verity'"
class="fas fa-phone-laptop"
title="لوازم جانبی کامپیوتر و موبایل"
></i>
<i v-if="item.db_name === 'panatech'" class="fas fa-photo-video" title="لوازم صوتی و تصویری خودرو"></i>
</td>
<td>
<nuxt-link
:to="{
name: 'account-agents-inbox-view',
query: {
tid: item._id,
ttn: item.TempReceiptTransNumber,
atn: item.ItemReceptionTransNumber || undefined,
db_name: item.db_name
}
}"
class="btn btn-primary"
>
مشاهده
</nuxt-link>
</td>
</tr>
</template>
<tr v-else>
<td class="noItem">
<span>هیچ اطلاعاتی وجود ندارد</span>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAgentInbox',
layout: 'user',
async asyncData({ $axios, error }) {
try {
const transactions = await $axios.get('/api/agent/inbox')
return {
transactions: transactions.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
transactions: null,
searchInput: ''
}
},
computed: {
type: {
get() {
return this.$route.query.type
},
set(val) {
this.$router.push({ name: 'account-agents-inbox', query: { type: val } })
}
},
serachBoxClass() {
if (this.searchInput && this.filteredList.length) return 'success'
if (this.searchInput && !this.filteredList.length) return 'error'
return null
},
filteredList() {
let filteredByTC
if (!this.searchInput) filteredByTC = this.transactions
else {
filteredByTC = this.transactions.filter(
item =>
item.TempReceiptTransNumber?.toLowerCase().includes(this.searchInput.toLowerCase()) ||
item.ItemReceptionTransNumber?.toLowerCase().includes(this.searchInput.toLowerCase())
)
}
const transactions = filteredByTC.filter(item => {
if (this.type === 'ttl') return !item.ItemReceptionTransNumber
else if (this.type === 'atl') return item.ItemReceptionTransNumber
return false
})
if (this.type === 'ttl') return transactions.reverse()
else return transactions
}
}
}
</script>
+340
View File
@@ -0,0 +1,340 @@
<template>
<user-dashboard-container page-class="guarantee-details agent-guarantee-details" panel-title="جزئیات">
<div class="agentActions">
<div class="row">
<div class="col-12 col-lg-6">
<div class="statuses">
<h3>تغییر وضعیت فرم:</h3>
<div class="btns">
<!--------------- recieved status btn --------------->
<button
class="btn btn-primary"
:disabled="transaction.status !== 'saved'"
@click="changeStatus('recieved')"
>
{{ getStatusName('recieved') }}
</button>
<!--------------- ongoing status btn --------------->
<button
class="btn btn-primary"
:disabled="transaction.status !== 'recieved'"
@click="changeStatus('ongoing')"
>
{{ getStatusName('ongoing') }}
</button>
<!--------------- waiting status btn --------------->
<button
class="btn btn-primary"
:disabled="
transaction.status === 'saved' ||
transaction.status === 'recieved' ||
transaction.status === 'delivered' ||
transaction.status === 'waiting'
"
@click="changeStatus('waiting')"
>
{{ getStatusName('waiting') }}
</button>
<!--------------- delivered status btn --------------->
<el-popover v-model="deliverPopover" placement="bottom" width="160" @click="deliveryPopover = true">
<el-input v-model="deliveryCode" placeholder="کد ارسال مرسوله"></el-input>
<div class="mt-1" style="text-align: center">
<el-button
size="mini"
type="text"
class="agentsStatus-popover-insideBtn"
@click="changeStatus('delivered')"
>ارسال</el-button
>
</div>
<button
slot="reference"
class="btn btn-primary"
:disabled="
transaction.status === 'saved' ||
transaction.status === 'recieved' ||
transaction.status === 'delivered'
"
>
{{ getStatusName('delivered') }}
</button>
</el-popover>
</div>
</div>
</div>
<div class="col-12 col-lg-6 mt-4 mt-lg-0">
<div class="timeLine">
<h3>تاریخچه وضعیت های فرم:</h3>
<ul>
<li v-for="item in statusHistory" :key="item._id" :class="item.status">
<span> {{ getStatusName(item.status) }} </span>
<span> {{ $jDateTime(item.date) }} </span>
</li>
</ul>
</div>
</div>
</div>
</div>
<form action="" class="form form_3">
<div class="userInfo">
<div class="formRow">
<label>کد مشتری:</label>
<input type="text" disabled :value="transaction.BusinessID" />
</div>
<div class="formRow">
<label>نام و نام خانوادگی:</label>
<input type="text" disabled :value="transaction.TransCCustom1" />
</div>
<div class="formRow">
<label>شماره تماس:</label>
<input type="text" disabled :value="transaction.cTel1" />
</div>
<div class="formRow">
<label>شماره پذیرش موقت:</label>
<input type="text" disabled :value="transaction.TempReceiptTransNumber" />
</div>
<div class="formRow">
<label>شماره پذیرش دائم:</label>
<input type="text" disabled :value="transaction.ItemReceptionTransNumber || '-'" />
</div>
<div class="formRow">
<label>تاریخ ارسال فرم:</label>
<input type="text" disabled :value="$jDate(transaction.TempReceiptTransDate)" />
</div>
</div>
<div class="formRow">
<label>آدرس:</label>
<textarea name="" rows="3" disabled :value="transaction.cAddress1"></textarea>
</div>
<div class="formRow">
<label>توضیحات فرم:</label>
<textarea name="" rows="3" disabled :value="transaction.Description"></textarea>
</div>
</form>
<hr />
<div class="formDB">
<template v-if="transaction.db_name === 'verity'">
<i class="fas fa-phone-laptop"></i>
<span>لوازم جانبی کامپیوتر و موبایل</span>
</template>
<template v-if="transaction.db_name === 'panatech'">
<i class="fas fa-photo-video"></i>
<span>لوازم صوتی و تصویری خودرو</span>
</template>
</div>
<div class="tableBox">
<table class="formItems">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="itemName">نام کالا</th>
<th class="quantity">تعداد</th>
<th class="itemSerial">سریال گارانتی</th>
<th class="date">تاریخ اتمام گارانتی</th>
<th v-if="selectorAvailable" class="selector">
<el-checkbox :value="allItemsAreinDraftsItems" @change="addAllItemsToAgentsDraftItems" />
</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in transaction.items" :key="index + '_guaranteeItemsList'" :title="item.ItemName">
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="itemName">
<span class="singleLineTxt">{{ getItemName(item.ItemID) || 'درحال بارگیری ...' }}</span>
</td>
<td class="quantity">
<span>{{ item.MjQty }}</span>
</td>
<td class="itemSerial">
<span>{{ item.SerialNo1 || '-' }}</span>
</td>
<td class="date">
<span>{{ item.GEndDate || '-' }}</span>
</td>
<td v-if="selectorAvailable" class="selector">
<el-checkbox
:value="isInAgentDraftsItem(item.ItemID, item.SerialNo1)"
@change="addSelectedItemsToAgentDraftItems(item.ItemID, item.SerialNo1)"
/>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
<div class="addToDraftsBtn">
<button v-if="agentDraftItems.length" class="btn btn-primary" @click="showDraftsModal = true">
<span>افزودن موارد انتخاب شده به پیشنویس ها</span>
<i class="fas fa-link"></i>
</button>
</div>
<template #body>
<AddUserItemsToAgentDraft
:key="addItemsToDraftModalKey"
:show="showDraftsModal"
:db_name="transaction.db_name"
:items="agentDraftItems"
@closeModal="closeAddItemToDraftModal"
/>
</template>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAgentInboxItemView',
layout: 'user',
async asyncData({ $axios, $auth, query, error }) {
try {
const tid = query?.tid
// fetch data from asan-service
const transaction = await $axios.get(`/api/agent/inbox/${tid}`)
return {
transaction: transaction.data
}
} catch (e) {
error({ status: 404, message: 'Page not found' })
}
},
data() {
return {
transaction: null,
factor: null,
paymentFactor: null,
deliverPopover: false,
deliveryCode: '',
showDraftsModal: false,
addItemsToDraftModalKey: 0,
agentDraftItems: []
}
},
computed: {
selectorAvailable() {
return this.transaction.status === 'ongoing' || this.transaction.status === 'waiting'
},
products() {
if (this.$route.query.db_name === 'verity') return this.$store.state.front.verityProducts
else if (this.$route.query.db_name === 'panatech') return this.$store.state.front.panatechProducts
else return []
},
host() {
return this.$route.query?.host
},
statusHistory() {
const statusHistory = this.transaction.statusHistory
return statusHistory.reverse()
},
allItemsAreinDraftsItems() {
return this.agentDraftItems.length === this.transaction.items.length
}
},
methods: {
closeAddItemToDraftModal() {
this.showDraftsModal = false
this.agentDraftItems = []
this.addItemsToDraftModalKey = Math.random()
},
addAllItemsToAgentsDraftItems(val) {
if (val) this.agentDraftItems = this.transaction.items
else this.agentDraftItems = []
},
addSelectedItemsToAgentDraftItems(id, serial) {
if (this.isInAgentDraftsItem(id, serial)) {
this.agentDraftItems = this.agentDraftItems.filter(item => {
if (serial) return item.SerialNo1 !== serial
else return item.ItemID !== id
})
} else {
const thisItem = this.transaction.items.find(item => {
if (serial) return item.SerialNo1 === serial
else return item.ItemID === id
})
this.agentDraftItems.push(thisItem)
}
},
isInAgentDraftsItem(id, serial) {
return Boolean(
this.agentDraftItems.find(item => {
if (serial) return item.SerialNo1 === serial
else return item.ItemID === id
})
)
},
getItemName(ItemID) {
return this.products.find(item => item.ItemID === ItemID)?.ItemName
},
getStatusName(status) {
if (status === 'saved') return 'ثبت شده'
else if (status === 'recieved') return 'پذیرش'
else if (status === 'ongoing') return 'در دست اقدام'
else if (status === 'waiting') return 'در انتظار قطعه'
else if (status === 'delivered') return 'تحویل شد'
else return 'invalid status'
},
changeStatus(status) {
const deliveryCode = this.deliveryCode
const alertTitle = 'هشدار'
function alertMsg() {
if (status === 'recieved')
return 'نماینده گرامی تنها در صورتی که تمام کالاها به دست شما رسیده فرم را پذیرش کنید. در غیر اینصورت هرگونه مسئولیتی در قبال مفقودی کالاها بر عهده شما میباشد.'
else if (status === 'ongoing') return 'وضعیت فرم را به در دست اقدام تغییر میدهید'
else if (status === 'waiting') return 'وضعیت فرم را به در انتظار قطعه تغییر میدهید'
else if (status === 'delivered' && deliveryCode.length)
return (
`تغییر وضعیت فرم به ارسال شده با کد ارسال مرسوله "${deliveryCode}".` +
' در آینده قادر به تغییر این وضعیت یا تغییر کد مرسوله نخواهید بود، ادمه میدهید؟ '
)
else if (status === 'delivered')
return (
'تغییر وضعیت فرم به ارسال شدوه بدون کد ارسال مرسوله.' +
' در آینده قادر به تغییر این وضعیت یا افزودن کد مرسوله نخواهید بود، ادامه میدهید؟ '
)
}
this.$confirm(alertMsg(), alertTitle, {
confirmButtonText: 'ادامه',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.put(`/api/agent/changeTStatus/${this.transaction._id}`, { status, deliveryCode })
.then(res => {
this.$message({
type: 'success',
message: 'وضعیت فرم با موفقیت تغییر کرد و پیامک اطلاع رسانی برای کاربر ارسال شد'
})
this.deliveryCode = ''
this.$nuxt.refresh()
})
.catch(err => {
this.$message({
type: 'error',
message: err.response.data.message
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
+312
View File
@@ -0,0 +1,312 @@
<template>
<user-dashboard-container page-class="post agent-requests-details" panel-title="فرم درخواست قطعه داغی">
<el-alert v-if="oldPieceRequest.status === 'temp'" :title="alertMsg" class="mb-3" type="warning"> </el-alert>
<form class="form form_3">
<div class="userInfo">
<div class="formRow">
<label for="customer_name">نام و نام خانوادگی:</label>
<input id="customer_name" type="text" :value="oldPieceRequest.agent_id.full_name" disabled />
</div>
<div class="formRow">
<label for="customer_code">کد نمایندگی:</label>
<input id="customer_code" type="text" :value="oldPieceRequest.agent_id.agent_code" disabled />
</div>
<div class="formRow">
<label for="mobile">شماره موبایل:</label>
<input id="mobile" type="text" :value="oldPieceRequest.agent_id.mobile_number" disabled />
</div>
<div class="formRow">
<label for="fax">شماره فکس:</label>
<input id="fax" type="text" :value="oldPieceRequest.agent_id.fax_number" disabled />
</div>
<div class="formRow">
<label for="province">استان:</label>
<input id="province" type="text" :value="oldPieceRequest.agent_id.province_name" disabled />
</div>
<div class="formRow">
<label for="city">شهر:</label>
<input id="city" type="text" :value="oldPieceRequest.agent_id.city_name" disabled />
</div>
</div>
<div class="formRow">
<label>آدرس:</label>
<textarea name="description" cols="30" rows="5" disabled :value="oldPieceRequest.agent_id.address"></textarea>
</div>
<hr />
<div class="formRow">
<label v-if="oldPieceRequest.status === 'temp'" for="description">توضیحات فرم (اختیاری):</label>
<label v-else for="description">توضیحات فرم:</label>
<el-tooltip
v-model="descriptionTooltip"
class="item"
effect="dark"
content="میتوانید توضیحات را در هر زمان تغییر دهید"
placement="top-start"
:disabled="oldPieceRequest.status !== 'temp'"
>
<textarea
id="description"
v-model="oldPieceRequest.description"
name="description"
:disabled="oldPieceRequest.status !== 'temp'"
:placeholder="descriptionPlaceHolder"
cols="30"
rows="10"
@blur="updateDescription"
></textarea>
</el-tooltip>
</div>
</form>
<div class="add-list">
<h2>لیست قطعات درخواستی:</h2>
<div class="tableBox">
<table class="pieces-items">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="recieptDate">تاریخ پذیرش</th>
<th class="itemName">نام کالا</th>
<th class="itemSerial">سریال گارانتی</th>
<th class="pieceName">نام قطعه</th>
<th class="pieceCode">کد قطعه</th>
<th v-if="oldPieceRequest.status === 'temp'" class="removeBtn">حذف</th>
</tr>
</thead>
<tbody>
<tr
v-for="(item, index) in oldPieceRequest.items"
:key="item.ItemID + index + '_opr_oldPieces'"
:title="item.ItemName + ' - ' + item.pieceName"
>
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="recieptDate">
<span> {{ $jDate(item.ItemReceptionTransDate) }} </span>
</td>
<td class="itemName">
<span class="singleLineTxt">{{ item.ItemName }}</span>
</td>
<td class="itemSerial">
<span>{{ item.SerialNo1 || '-' }}</span>
</td>
<td class="pieceName">
<span> {{ item.pieceName }} </span>
</td>
<td class="pieceCode">
<span> {{ item.pieceCode }} </span>
</td>
<td v-if="oldPieceRequest.status === 'temp'" class="removeBtn">
<button class="trashIcon-btn" title="حذف پیشنویس" @click="removeItemFromList(item._id)">
<i class="fal fa-trash-alt"></i>
</button>
</td>
</tr>
<tr v-if="!oldPieceRequest.items.length" class="odd">
<td class="noItem" colspan="5">
<p style="color: #000">هنوز هیچ آیتمی اضافه نکردید.</p>
</td>
</tr>
<tr v-if="oldPieceRequest.status === 'temp'" class="addStuffBtn" @click="oldPiecesModal = true">
<td colspan="5">
<button>
<span>افزودن قطعه</span>
<i class="far fa-plus"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
<hr />
<div v-if="oldPieceRequest.status === 'temp'" class="btnRow">
<button class="btn btn-primary" @click="sendForm">ارسال به آسان سرویس</button>
<button class="btn btn-danger" @click="removeOPR">حذف این فرم</button>
</div>
</div>
<template #body>
<AddOldPiecesToOldPieceRequest
:key="oldPiecesModalKey"
:show="oldPiecesModal"
:opr-id="oldPieceRequest._id"
@closeModal="closePiecesModal"
/>
</template>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAgentOpsDetails',
layout: 'user',
async asyncData({ $axios, params, error }) {
try {
const oldPieceRequest = await $axios.get(`/api/agent/opr/${params.op}`)
return {
oldPieceRequest: oldPieceRequest.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
oldPieceRequest: null,
validation: {},
oldPiecesModal: false,
oldPiecesModalKey: 0,
descriptionTooltip: false,
alertMsg:
'این درخواست در پیشنویس ها ذخیره شده و هنوز در پایگاه داده شرکت آسان سرویس ثبت نگردیده. شما میتوانید قطعات را در هر زمان به این فرم اضافه یا از فرم حذف کنید سپس نسبت به ارسال نهایی اقدام کنید.'
}
},
computed: {
oprId() {
return this.$route.params.op
},
descriptionPlaceHolder() {
if (this.oldPieceRequest.status === 'temp') return 'توضیحات راجع به قطعات داغی را میتوانید اینجا بنویسید'
else return 'بدون توضیحات'
}
},
mounted() {
setTimeout(() => {
if (this.oldPieceRequest.status === 'temp') this.descriptionTooltip = true
}, 1000)
},
methods: {
closePiecesModal() {
this.oldPiecesModal = false
this.oldPiecesModalKey = Math.random()
},
removeItemFromList(id) {
if (this.oldPieceRequest.status !== 'temp') return
this.$confirm('این مورد حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/removeOprItems/${id}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در انجام عملیات پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
},
updateDescription() {
if (this.oldPieceRequest.status !== 'temp') return
const data = { description: this.oldPieceRequest.description }
this.$axios
.put(`/api/agent/oprDescription/${this.oprId}`, data)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در ثبت اطلاعات پیش آمده'
})
})
},
sendForm() {
this.$confirm('فرم درخواست قطعه داغی به آسان سرویس ارسال شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.post(`/api/agent/sendOpr/${this.oprId}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$router.push({ name: 'account-agents-ops', query: { type: 'sent' } })
})
.catch(err => {
let msg = 'مشکلی در ارسال درخواست پیش آمده'
if (err.response.status === 406) msg = err.response.data.message
this.$message({
type: 'error',
message: msg
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
},
removeOPR() {
this.$confirm('این فرم از پیشنویس ها حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/opr/${this.oprId}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$router.push({ name: 'account-agents-ops', query: { type: 'temp' } })
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در حذف پیشنویس پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
+230
View File
@@ -0,0 +1,230 @@
<template>
<user-dashboard-container page-class="agent-requests" panel-title="لیست درخواست های قطعه داغی">
<div class="filter mb-5">
<h4 style="display: inline-block; margin-left: 15px">مشاهده لیست:</h4>
<button class="switchBtns btn" :class="type === 'temp' && 'btn-primary'" @click="type = 'temp'">
پیشنویس ها
</button>
<button class="switchBtns btn" :class="type === 'sent' && 'btn-primary'" @click="type = 'sent'">
ارسال شده ها
</button>
<button class="switchBtns btn" :class="type === 'delivered' && 'btn-primary'" @click="type = 'delivered'">
انجام شده ها
</button>
<div v-if="type !== 'temp'" class="search mt-3" :class="serachBoxClass">
<el-input v-model="searchInput" clearable placeholder="جستجو در لیست با کد پیگیری" />
</div>
</div>
<div class="tableBox">
<table class="agent-requests" :class="type !== 'temp' && 'extended'">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="description">توضیحات</th>
<th class="createDate">تاریخ ایجاد</th>
<template v-if="type === 'sent' || type === 'delivered'">
<th class="sendDate">تاریخ ارسال</th>
<th class="trackingCode">کد پیگیری</th>
<th class="status">وضعیت</th>
</template>
<th v-if="type === 'delivered'" class="deliveryCode">کد ارسال مرسوله</th>
<th class="quantity">تعداد قطعه</th>
<th class="details">جزئیات</th>
</tr>
</thead>
<tbody>
<template v-if="filteredList.length">
<tr v-for="(item, index) in filteredList" :key="item._id" :title="item.description">
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="description">
<span v-if="item.description" class="singleLineTxt">{{ item.description }}</span>
<span v-else style="color: gray">بدون توضیحات</span>
</td>
<td class="createDate">
<span> {{ $jDate(item.createDate) }} </span>
</td>
<template v-if="type === 'sent' || type === 'delivered'">
<td class="sendDate">
<span>{{ $jDate(item.sendDate) }}</span>
</td>
<td class="trackingCode">
<span>{{ item.trackingCode }}</span>
</td>
<td class="status">
<span v-if="item.status === 'sent'">ارسال شده</span>
<span v-if="item.status === 'ongoing'">در دست اقدام</span>
<span v-if="item.status === 'waiting'">در انتظار قطعه</span>
<span v-if="item.status === 'delivered'">تحویل شده</span>
</td>
</template>
<td v-if="type === 'delivered'" class="deliveryCode">
<span>{{ item.deliveryCode || '-' }}</span>
</td>
<td class="quantity">
<span>{{ totalItemsCount(item.items) }}</span>
</td>
<td class="details">
<template v-if="item.status === 'temp'">
<button class="trashIcon-btn" title="حذف پیشنویس" @click="removeOPR(item._id)">
<i class="fal fa-trash-alt"></i>
</button>
<nuxt-link
:to="{
name: 'account-agents-ops-op',
params: {
op: item._id
}
}"
class="btn btn-primary"
>
تکمیل فرم
</nuxt-link>
</template>
<nuxt-link
v-else
:to="{
name: 'account-agents-ops-op',
params: {
op: item._id
}
}"
class="btn btn-primary"
>
مشاهده
</nuxt-link>
</td>
</tr>
</template>
<tr v-else>
<td class="noItem">
<span>هیچ اطلاعاتی وجود ندارد</span>
</td>
</tr>
<tr v-if="type === 'temp'" class="addStuffBtn" @click="addOldPieceRequest">
<td colspan="5">
<button>
<span>افزودن درخواست</span>
<i class="far fa-plus"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAgentOpsList',
layout: 'user',
async asyncData({ $axios, error }) {
try {
const oldPieceRequests = await $axios.get('/api/agent/oprList')
return {
oldPieceRequests: oldPieceRequests.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
oldPieceRequests: null,
searchInput: ''
}
},
computed: {
type: {
get() {
return this.$route.query.type
},
set(val) {
this.$router.push({ name: 'account-agents-ops', query: { type: val } })
}
},
serachBoxClass() {
if (this.searchInput && this.filteredList.length) return 'success'
if (this.searchInput && !this.filteredList.length) return 'error'
return null
},
filteredList() {
let filteredBySearch
if (!this.searchInput || this.type === 'temp') filteredBySearch = this.oldPieceRequests
else {
filteredBySearch = this.oldPieceRequests.filter(item =>
item.trackingCode?.toLowerCase().includes(this.searchInput.toLowerCase())
)
}
return filteredBySearch.filter(item => {
if (this.type === 'temp') return item.status === 'temp'
if (this.type === 'sent') return item.status !== 'temp' && item.status !== 'delivered'
if (this.type === 'delivered') return item.status === 'delivered'
return false
})
}
},
methods: {
addOldPieceRequest() {
this.$axios
.post('/api/agent/opr')
.then(res => {
this.$message({
type: 'success',
message: 'درخواست جدید افزوده شد'
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در افزودن درخواست پیش آمده'
})
})
},
totalItemsCount(items) {
return items.length
},
removeOPR(id) {
this.$confirm('این درخواست از پیشنویس ها حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/opr/${id}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در حذف درخواست پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
+340
View File
@@ -0,0 +1,340 @@
<template>
<user-dashboard-container page-class="post agent-requests-details" panel-title="فرم درخواست قطعه">
<el-alert v-if="pieceRequest.status === 'temp'" :title="alertMsg" class="mb-3" type="warning"> </el-alert>
<form class="form form_3">
<div class="userInfo">
<div class="formRow">
<label for="customer_name">نام و نام خانوادگی:</label>
<input id="customer_name" type="text" :value="pieceRequest.agent_id.full_name" disabled />
</div>
<div class="formRow">
<label for="customer_code">کد نمایندگی:</label>
<input id="customer_code" type="text" :value="pieceRequest.agent_id.agent_code" disabled />
</div>
<div class="formRow">
<label for="mobile">شماره موبایل:</label>
<input id="mobile" type="text" :value="pieceRequest.agent_id.mobile_number" disabled />
</div>
<div class="formRow">
<label for="fax">شماره فکس:</label>
<input id="fax" type="text" :value="pieceRequest.agent_id.fax_number" disabled />
</div>
<div class="formRow">
<label for="province">استان:</label>
<input id="province" type="text" :value="pieceRequest.agent_id.province_name" disabled />
</div>
<div class="formRow">
<label for="city">شهر:</label>
<input id="city" type="text" :value="pieceRequest.agent_id.city_name" disabled />
</div>
</div>
<div class="formRow">
<label>آدرس:</label>
<textarea name="description" cols="30" rows="5" disabled :value="pieceRequest.agent_id.address"></textarea>
</div>
<hr />
<div class="formRow">
<label v-if="pieceRequest.status === 'temp'" for="description">توضیحات فرم (اختیاری):</label>
<label v-else for="description">توضیحات فرم:</label>
<el-tooltip
v-model="descriptionTooltip"
class="item"
effect="dark"
content="میتوانید توضیحات را در هر زمان تغییر دهید"
placement="top-start"
:disabled="pieceRequest.status !== 'temp'"
>
<textarea
id="description"
v-model="pieceRequest.description"
name="description"
:disabled="pieceRequest.status !== 'temp'"
:placeholder="descriptionPlaceHolder"
cols="30"
rows="10"
@blur="updateDescription"
></textarea>
</el-tooltip>
</div>
</form>
<div class="notes">
<h3>توجه:</h3>
<ul>
<li>
<p>
قطعات غیرگارانتی درخواستی، در صورت موجود بودن، پس از اعلام و دریافت هزینه مربوطه برای نمایندگان محترم ارسال
خواهد شد.
</p>
</li>
<li>
<p>
تمامی قطعات موردنیاز گارانتی برای نمایندگان محترم فاکتور خواهد شد و پس از ارسال داغی قطعات بهمراه کپی کارت
گارانتی مربوطه، از حساب ایشان کسر می گردد.
</p>
</li>
</ul>
</div>
<div class="add-list">
<h2>لیست قطعات درخواستی:</h2>
<div class="tableBox">
<table class="pieces-items">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="recieptDate">تاریخ پذیرش</th>
<th class="itemName">نام کالا</th>
<th class="itemSerial">سریال گارانتی</th>
<th class="guaranteeStatus">وضعیت گارانتی</th>
<th class="pieceName">نام قطعه</th>
<th class="pieceCode">کد قطعه</th>
<th class="quantity">تعداد</th>
<th v-if="pieceRequest.status === 'temp'" class="removeBtn">حذف</th>
</tr>
</thead>
<tbody>
<tr
v-for="(item, index) in pieceRequest.items"
:key="item.ItemID + index + '_pr_pieces'"
:title="item.ItemName + ' - ' + item.pieceName"
>
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="recieptDate">
<span> {{ $jDate(item.ItemReceptionTransDate) }} </span>
</td>
<td class="itemName">
<span class="singleLineTxt">{{ item.ItemName }}</span>
</td>
<td class="itemSerial">
<span>{{ item.SerialNo1 || '-' }}</span>
</td>
<td class="guaranteeStatus">
<span v-if="item.gStatus">دارد</span>
<span v-else>ندارد</span>
</td>
<td class="pieceName">
<span> {{ item.pieceName }} </span>
</td>
<td class="pieceCode">
<span> {{ item.pieceCode }} </span>
</td>
<td class="quantity">
<span>{{ item.pieceQuantity }}</span>
</td>
<td v-if="pieceRequest.status === 'temp'" class="removeBtn">
<button class="trashIcon-btn" title="حذف پیشنویس" @click="removeItemFromList(item._id)">
<i class="fal fa-trash-alt"></i>
</button>
</td>
</tr>
<tr v-if="!pieceRequest.items.length" class="odd">
<td class="noItem" colspan="5">
<p style="color: #000">هنوز هیچ آیتمی اضافه نکردید.</p>
</td>
</tr>
<tr v-if="pieceRequest.status === 'temp'" class="addStuffBtn" @click="piecesModal = true">
<td colspan="5">
<button>
<span>افزودن قطعه</span>
<i class="far fa-plus"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
<hr />
<div v-if="pieceRequest.status === 'temp'" class="btnRow">
<button class="btn btn-primary" @click="sendForm">ارسال به آسان سرویس</button>
<button class="btn btn-danger" @click="removePR">حذف این فرم</button>
</div>
</div>
<template #body>
<AddPiecesToPieceRequest
:key="piecesModalKey"
:show="piecesModal"
:pr-id="pieceRequest._id"
@closeModal="closePiecesModal"
/>
</template>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAgentPrDetails',
layout: 'user',
async asyncData({ $axios, params, error }) {
try {
const pieceRequest = await $axios.get(`/api/agent/pr/${params.pr}`)
return {
pieceRequest: pieceRequest.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
pieceRequest: null,
validation: {},
piecesModal: false,
piecesModalKey: 0,
descriptionTooltip: false,
alertMsg:
'این درخواست در پیشنویس ها ذخیره شده و هنوز در پایگاه داده شرکت آسان سرویس ثبت نگردیده. شما میتوانید قطعات را در هر زمان به این فرم اضافه یا از فرم حذف کنید سپس نسبت به ارسال نهایی اقدام کنید.'
}
},
computed: {
prId() {
return this.$route.params.pr
},
descriptionPlaceHolder() {
if (this.pieceRequest.status === 'temp') return 'توضیحات راجع به قطعات را میتوانید اینجا بنویسید'
else return 'بدون توضیحات'
}
},
mounted() {
setTimeout(() => {
if (this.pieceRequest.status === 'temp') this.descriptionTooltip = true
}, 1000)
},
methods: {
closePiecesModal() {
this.piecesModal = false
this.piecesModalKey = Math.random()
},
removeItemFromList(id) {
if (this.pieceRequest.status !== 'temp') return
this.$confirm('این مورد حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/removePrItems/${id}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در انجام عملیات پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
},
updateDescription() {
if (this.pieceRequest.status !== 'temp') return
const data = { description: this.pieceRequest.description }
this.$axios
.put(`/api/agent/prDescription/${this.prId}`, data)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در ثبت اطلاعات پیش آمده'
})
})
},
sendForm() {
this.$confirm('فرم درخواست قطعه به آسان سرویس ارسال شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.post(`/api/agent/sendPr/${this.prId}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$router.push({ name: 'account-agents-pieces', query: { type: 'sent' } })
})
.catch(err => {
let msg = 'مشکلی در ارسال درخواست پیش آمده'
if (err.response.status === 406) msg = err.response.data.message
this.$message({
type: 'error',
message: msg
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
},
removePR() {
this.$confirm('این فرم از پیشنویس ها حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/pr/${this.prId}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$router.push({ name: 'account-agents-pieces', query: { type: 'temp' } })
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در حذف پیشنویس پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
+232
View File
@@ -0,0 +1,232 @@
<template>
<user-dashboard-container page-class="agent-requests" panel-title="لیست درخواست های قطعه">
<div class="filter mb-5">
<h4 style="display: inline-block; margin-left: 15px">مشاهده لیست:</h4>
<button class="switchBtns btn" :class="type === 'temp' && 'btn-primary'" @click="type = 'temp'">
پیشنویس ها
</button>
<button class="switchBtns btn" :class="type === 'sent' && 'btn-primary'" @click="type = 'sent'">
ارسال شده ها
</button>
<button class="switchBtns btn" :class="type === 'delivered' && 'btn-primary'" @click="type = 'delivered'">
انجام شده ها
</button>
<div v-if="type !== 'temp'" class="search mt-3" :class="serachBoxClass">
<el-input v-model="searchInput" clearable placeholder="جستجو در لیست با کد پیگیری" />
</div>
</div>
<div class="tableBox">
<table class="agent-requests" :class="type !== 'temp' && 'extended'">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="description">توضیحات</th>
<th class="createDate">تاریخ ایجاد</th>
<template v-if="type === 'sent' || type === 'delivered'">
<th class="sendDate">تاریخ ارسال</th>
<th class="trackingCode">کد پیگیری</th>
<th class="status">وضعیت</th>
</template>
<th v-if="type === 'delivered'" class="deliveryCode">کد ارسال مرسوله</th>
<th class="quantity">تعداد قطعه</th>
<th class="details">جزئیات</th>
</tr>
</thead>
<tbody>
<template v-if="filteredList.length">
<tr v-for="(item, index) in filteredList" :key="item._id" :title="item.description">
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="description">
<span v-if="item.description" class="singleLineTxt">{{ item.description }}</span>
<span v-else style="color: gray">بدون توضیحات</span>
</td>
<td class="createDate">
<span> {{ $jDate(item.createDate) }} </span>
</td>
<template v-if="type === 'sent' || type === 'delivered'">
<td class="sendDate">
<span>{{ $jDate(item.sendDate) }}</span>
</td>
<td class="trackingCode">
<span>{{ item.trackingCode }}</span>
</td>
<td class="status">
<span v-if="item.status === 'sent'">ارسال شده</span>
<span v-if="item.status === 'ongoing'">در دست اقدام</span>
<span v-if="item.status === 'waiting'">در انتظار قطعه</span>
<span v-if="item.status === 'delivered'">تحویل شده</span>
</td>
</template>
<td v-if="type === 'delivered'" class="deliveryCode">
<span>{{ item.deliveryCode || '-' }}</span>
</td>
<td class="quantity">
<span>{{ totalItemsCount(item.items) }}</span>
</td>
<td class="details">
<template v-if="item.status === 'temp'">
<button class="trashIcon-btn" title="حذف پیشنویس" @click="removePR(item._id)">
<i class="fal fa-trash-alt"></i>
</button>
<nuxt-link
:to="{
name: 'account-agents-pieces-pr',
params: {
pr: item._id
}
}"
class="btn btn-primary"
>
تکمیل فرم
</nuxt-link>
</template>
<nuxt-link
v-else
:to="{
name: 'account-agents-pieces-pr',
params: {
pr: item._id
}
}"
class="btn btn-primary"
>
مشاهده
</nuxt-link>
</td>
</tr>
</template>
<tr v-else>
<td class="noItem">
<span>هیچ اطلاعاتی وجود ندارد</span>
</td>
</tr>
<tr v-if="type === 'temp'" class="addStuffBtn" @click="addPieceRequest">
<td colspan="5">
<button>
<span>افزودن درخواست</span>
<i class="far fa-plus"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountAgentPrList',
layout: 'user',
async asyncData({ $axios, error }) {
try {
const pieceRequests = await $axios.get('/api/agent/prList')
return {
pieceRequests: pieceRequests.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
pieceRequests: null,
searchInput: ''
}
},
computed: {
type: {
get() {
return this.$route.query.type
},
set(val) {
this.$router.push({ name: 'account-agents-pieces', query: { type: val } })
}
},
serachBoxClass() {
if (this.searchInput && this.filteredList.length) return 'success'
if (this.searchInput && !this.filteredList.length) return 'error'
return null
},
filteredList() {
let filteredBySearch
if (!this.searchInput || this.type === 'temp') filteredBySearch = this.pieceRequests
else {
filteredBySearch = this.pieceRequests.filter(item =>
item.trackingCode?.toLowerCase().includes(this.searchInput.toLowerCase())
)
}
return filteredBySearch.filter(item => {
if (this.type === 'temp') return item.status === 'temp'
if (this.type === 'sent') return item.status !== 'temp' && item.status !== 'delivered'
if (this.type === 'delivered') return item.status === 'delivered'
return false
})
}
},
methods: {
addPieceRequest() {
this.$axios
.post('/api/agent/pr')
.then(res => {
this.$message({
type: 'success',
message: 'درخواست جدید افزوده شد'
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در افزودن درخواست پیش آمده'
})
})
},
totalItemsCount(items) {
let count = 0
items.forEach(item => (count += item.pieceQuantity))
return count
},
removePR(id) {
this.$confirm('این درخواست از پیشنویس ها حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/agent/pr/${id}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در حذف درخواست پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
File diff suppressed because it is too large Load Diff
+39
View File
@@ -0,0 +1,39 @@
<template>
<user-dashboard-container page-class="announcements" panel-title="اعلانات">
<div v-for="item in userAnnouncements" :key="item._id" class="item" :class="!item.seen && 'unread'">
<el-collapse :key="item._id + 'co_parent'" accordion @change="seeAnnouncement">
<el-collapse-item :key="item._id + 'co_item'" :name="item._id">
<template slot="title">
<h3>{{ item.title }}</h3>
</template>
<div>
<p>{{ item.caption }}</p>
</div>
</el-collapse-item>
</el-collapse>
</div>
<h3 v-if="!userAnnouncements.length" style="text-align: center; margin-top: 50px">هیچ اعلانی موجود نیست</h3>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountUserAnnouncements',
layout: 'user',
data() {
return {}
},
computed: {
userAnnouncements() {
return this.$store.state.front.userAnnouncements
}
},
methods: {
seeAnnouncement(id) {
if (!id) return
const item = this.userAnnouncements.find(item => item._id === id)
if (!item.seen) this.$userSocket.emit('user:updateAnnouncement', id)
}
}
}
</script>
+286
View File
@@ -0,0 +1,286 @@
<template>
<user-dashboard-container page-class="post" panel-title="ارسال برای گارانتی">
<el-alert :title="alertMsg" class="mb-3" type="warning"> </el-alert>
<form class="form form_3">
<div class="formDB">
<!-- <img v-if="transactionDraft.db_name === 'panatech'" src="/assets/img/panatech-small.png" alt="panatech" />
<img v-if="transactionDraft.db_name === 'verity'" src="/assets/img/verity-small.png" alt="verity" /> -->
<template v-if="transactionDraft.db_name === 'verity'">
<i class="fas fa-phone-laptop"></i>
<span>لوازم جانبی کامپیوتر و موبایل</span>
</template>
<template v-if="transactionDraft.db_name === 'panatech'">
<i class="fas fa-photo-video"></i>
<span>لوازم صوتی و تصویری خودرو</span>
</template>
<!-- <hr /> -->
</div>
<div class="userInfo">
<div class="formRow">
<label for="customer_name">نام مشتری:</label>
<input id="customer_name" type="text" :value="user.first_name + ' ' + user.last_name" disabled />
</div>
<div class="formRow">
<label for="customer_code">کد مشتری:</label>
<input id="customer_code" type="text" :value="businessCode" disabled />
</div>
<div class="formRow">
<label for="mobile">شماره موبایل:</label>
<input id="mobile" type="text" :value="user.mobile_number" disabled />
</div>
</div>
<div class="formRow">
<label>آدرس:</label>
<textarea name="address" rows="5" disabled :value="userAddress"></textarea>
</div>
<hr />
<div class="formRow">
<label for="description">توضیحات فرم (اختیاری):</label>
<el-tooltip
v-model="descriptionTooltip"
class="item"
effect="dark"
content="میتوانید توضیحات را در هر زمان تغییر دهید"
placement="top-start"
>
<textarea
id="description"
v-model="transactionDraft.description"
name="description"
placeholder="توضیحات راجع به کالاها را میتوانید اینجا بنویسید"
cols="30"
rows="10"
@blur="updateDescription"
></textarea>
</el-tooltip>
</div>
</form>
<div class="add-list">
<h2>لیست کالاهای افزوده شده:</h2>
<div class="tableBox">
<table class="formItems">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="itemName">نام کالا</th>
<th class="quantity">تعداد</th>
<th class="itemSerial">سریال گارانتی</th>
<th class="removeBtn">حذف</th>
</tr>
</thead>
<tbody>
<tr
v-for="(item, index) in transactionDraft.items"
:key="item.ItemID + index + '_addListItemKey'"
:title="getItemName(item.ItemID)"
>
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="itemName">
<span class="singleLineTxt">{{ getItemName(item.ItemID) }}</span>
</td>
<td class="quantity">
<span>{{ item.MjQty }}</span>
</td>
<td class="itemSerial">
<span>{{ item.SerialNo1 || '-' }}</span>
</td>
<td class="removeBtn">
<button class="trashIcon-btn" title="حذف کالا" @click="removeItemFromList(item.SerialNo1, item.ItemID)">
<i class="fal fa-trash-alt"></i>
</button>
</td>
</tr>
<tr v-if="!transactionDraft.items.length" class="odd">
<td class="noItem" colspan="5">
<p style="color: #000">هنوز هیچ آیتمی اضافه نکردید.</p>
</td>
</tr>
<tr class="addStuffBtn" @click="stuffModal = true">
<td colspan="5">
<button>
<span>افزودن کالا</span>
<i class="far fa-plus"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
<hr />
<div class="btnRow">
<button class="btn btn-primary" @click="agentsModal = true">ارسال به آسان سرویس</button>
<button class="btn btn-danger" @click="removeDraft">حذف این فرم</button>
</div>
</div>
<template #body>
<AddStuffModal
:key="addStuffKey"
:show="stuffModal"
:db_name="transactionDraft.db_name"
@closeModal="closeAddStuff"
/>
<SelectAgentModal :key="agentsKey" :draft="transactionDraft" :show="agentsModal" @closeModal="closeAgents" />
</template>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountDraftDetails',
layout: 'user',
async asyncData({ $axios, params, error }) {
try {
const transactionDraft = await $axios.get(`/api/user/transactionDraft/${params.draftID}`)
return {
transactionDraft: transactionDraft.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
transactionDraft: null,
validation: {},
stuffModal: false,
agentsModal: false,
addStuffKey: 0,
agentsKey: 1,
descriptionTooltip: false,
alertMsg:
'این فرم در پیشنویس ها ذخیره شده و هنوز در پایگاه داده شرکت آسان سرویس ثبت نگردیده. شما میتوانید کالاها را در هر زمان به این فرم اضافه یا از فرم حذف کنید سپس نسبت به ارسال نهایی اقدام کنید.'
}
},
computed: {
user() {
return this.$auth.user
},
userAddress() {
const user = this.user
return user.province_name + '، ' + user.city_name + '، ' + user.address + '،کد پستی: ' + user.postal_code
},
products() {
if (this.transactionDraft.db_name === 'panatech') return this.$store.state.front.panatechProducts
else if (this.transactionDraft.db_name === 'verity') return this.$store.state.front.verityProducts
else return []
},
draftID() {
return this.$route.params.draftID
},
businessCode() {
const errMsg = 'عدم ثبت در پایگاه داده'
if (this.transactionDraft.db_name === 'panatech') return this.user.panatech_businessCode || errMsg
if (this.transactionDraft.db_name === 'verity') return this.user.verity_businessCode || errMsg
return errMsg
}
},
mounted() {
setTimeout(() => (this.descriptionTooltip = true), 1000)
},
methods: {
closeAddStuff() {
this.stuffModal = false
this.addStuffKey = Math.random()
},
closeAgents() {
this.agentsModal = false
this.agentsKey = Math.random() + 1
},
getItemName(id) {
return this.products?.filter(item => item.ItemID === id)[0]?.ItemName || 'درحال بارگیری'
},
removeItemFromList(itemSerial, itemId) {
this.$confirm('این مورد حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.put(`/api/user/transactionDraftItemRemove/${this.draftID}`, { itemId, itemSerial })
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$nuxt.refresh()
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در انجام عملیات پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
},
updateDescription() {
const data = { description: this.transactionDraft.description }
this.$axios
.put(`/api/user/transactionDraft/${this.draftID}`, data)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در ثبت اطلاعات پیش آمده'
})
})
},
removeDraft() {
this.$confirm('این فرم از پیشنویس ها حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/user/transactionDraft/${this.draftID}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
this.$router.push({ name: 'account-drafts' })
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در حذف پیشنویس پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
+129
View File
@@ -0,0 +1,129 @@
<template>
<user-dashboard-container page-class="drafts" panel-title="لیست پیشنویس ها">
<div class="tableBox">
<table class="drafts">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="description">توضیحات</th>
<th class="brand">نوع</th>
<th class="quantity">تعداد کالاها</th>
<th class="details">جزئیات</th>
</tr>
</thead>
<tbody>
<template v-if="transactionDrafts.length">
<tr v-for="(item, index) in transactionDrafts" :key="item._id" :title="item.description">
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="description">
<span v-if="item.description" class="singleLineTxt">{{ item.description }}</span>
<span v-else style="color: gray">بدون توضیحات</span>
</td>
<td class="brand">
<!-- <img src="/assets/img/verity-small.png" alt="verity" v-if="item.db_name === 'verity'" />
<img src="/assets/img/panatech-small.png" alt="panatech" v-if="item.db_name === 'panatech'" /> -->
<i
v-if="item.db_name === 'verity'"
class="fas fa-phone-laptop"
title="لوازم جانبی کامپیوتر و موبایل"
></i>
<i v-if="item.db_name === 'panatech'" class="fas fa-photo-video" title="لوازم صوتی و تصویری خودرو"></i>
</td>
<td class="quantity">
<span>{{ totalItemsCount(item) }}</span>
</td>
<td class="details">
<button class="trashIcon-btn" title="حذف پیشنویس" @click="removeDraft(item._id)">
<i class="fal fa-trash-alt"></i>
</button>
<nuxt-link
:to="{
name: 'account-drafts-draftID',
params: {
draftID: item._id
}
}"
class="btn btn-primary"
>
تکمیل فرم
</nuxt-link>
</td>
</tr>
</template>
<tr v-else>
<td class="noItem">
<span>هیچ اطلاعاتی وجود ندارد</span>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountDraftList',
layout: 'user',
async asyncData({ $axios, $auth, error }) {
try {
const transactionDrafts = await $axios.get('/api/user/transactionDrafts')
return {
transactionDrafts: transactionDrafts.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
transactionDrafts: null
}
},
methods: {
totalItemsCount(draft) {
const items = draft.items
let count = 0
items.forEach(item => (count += item.MjQty))
return count
},
removeDraft(id) {
this.$confirm('این فرم از پیشنویس ها حذف شود؟', 'هشدار', {
confirmButtonText: 'بله',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
this.$axios
.delete(`/api/user/transactionDraft/${id}`)
.then(res => {
this.$message({
type: 'success',
message: res.data.message
})
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در حذف پیشنویس پیش آمده'
})
})
})
.catch(() => {
this.$message({
type: 'warning',
message: 'عملیات لغو شد'
})
})
}
}
}
</script>
+203
View File
@@ -0,0 +1,203 @@
<template>
<user-dashboard-container page-class="factor" panel-title="فاکتور">
<div id="factor-layout">
<div class="pageHeader">
<div class="row1">
<h2>
<span>سیستم جاری</span>
<br />
<span>فاکتور گارانتی</span>
</h2>
</div>
<div class="row2">
<p>
<span>شماره حواله: </span>
<span>{{ factorInfo.TransNumber }}</span>
</p>
<p>
<span>تاریخ حواله: </span>
<span>{{ $jDate(factorInfo.TransDate) }}</span>
</p>
</div>
</div>
<div class="factor">
<div class="factorInfo">
<div class="row1">
<p>
<span>کد شخص: </span>
<span>{{ userBusinessCode }}</span>
</p>
<p>
<span>طرف حساب: </span>
<span>{{ user.first_name + ' ' + user.last_name }}</span>
</p>
<p>
<span>شماره پذیرش: </span>
<span>{{ $route.query.atn }}</span>
</p>
</div>
<div class="row2">
<p>
<span>آدرس: </span>
<span>{{ factorInfo.cAddress1 }}</span>
</p>
</div>
<div class="row3">
<p>
<span>شماره تماس: </span>
<span>{{ factorInfo.cTel1 }}</span>
</p>
</div>
<div class="row4">
<p>
<span>شرح حواله: </span>
<span>{{ factorInfo.Description || '---' }}</span>
</p>
</div>
</div>
<div class="table">
<table>
<thead>
<tr>
<th>ردیف</th>
<th>نام کالا</th>
<th>تعداد کل</th>
<th>مرجوع از فروش</th>
<th>مرجوعی/آسیب فیزیکی</th>
<th>مرجوعی/سالم</th>
<th>تعویض</th>
<th>تعمير با هزينه شخصی</th>
<th>تعمير با هزينه شرکت</th>
<th>مانده</th>
<th>توضیحات</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in factor" :key="index + '_tableItems_q_ar'">
<td>{{ index + 1 }}</td>
<td>{{ item.ItemName }}</td>
<td>{{ item.ItemReceptionNQty }}</td>
<td>{{ item.SaleReturn || '-' }}</td>
<td>{{ item.Return_Damaged || '-' }}</td>
<td>{{ item.Return_Healthy || '-' }}</td>
<td>{{ item.Replacement || '-' }}</td>
<td>{{ item.Repair_Self || '-' }}</td>
<td>{{ item.Repair_Company || '-' }}</td>
<td>{{ residual(item) }}</td>
<td>{{ item.ItemReplacementNames || '-' }}</td>
</tr>
<!-- table footer -->
<tr>
<td colspan="2">جمع</td>
<td>{{ sum('ItemReceptionNQty') }}</td>
<td>{{ sum('SaleReturn') }}</td>
<td>{{ sum('Return_Damaged') }}</td>
<td>{{ sum('Return_Healthy') }}</td>
<td>{{ sum('Replacement') }}</td>
<td>{{ sum('Repair_Self') }}</td>
<td>{{ sum('Repair_Company') }}</td>
<td>{{ residualSum() }}</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<table-notice />
<button class="btn btn-primary mt-3" @click="print('factor-layout')">چاپ فاکتور</button>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountGuaranteeFactor',
layout: 'user',
async asyncData({ $axios, $auth, query, error }) {
try {
const acceptedTN = query.atn
const host = query.host
const db_name = query.db_name
const user = $auth.user
function businessCode() {
if (db_name === 'verity') return user.verity_businessCode
else if (db_name === 'panatech') return user.panatech_businessCode
else return null
}
if (host === 'ar') {
const factorData = {
url: `/api/GetItemReceptionDetails?BusinessCode=${businessCode()}&ItemReceptionTransNumber=${acceptedTN}`,
db: db_name
}
const factor = await $axios.post('/api/cross/getRouteManager', factorData)
if (factor.data.error || !factor.data.data.length) throw new Error('invalid params')
return {
factor: factor.data.data
}
} else if (host === 'as') {
/// fuctions go here
} else throw new Error('invalid params')
} catch (e) {
error({ status: 404, message: 'Page not found' })
}
},
data() {
return {
transactionItems: null,
factor: null
}
},
computed: {
user() {
return this.$auth.user
},
userBusinessCode() {
const db_name = this.$route.query.db_name
if (db_name === 'verity') return this.user.verity_businessCode
else if (db_name === 'panatech') return this.user.panatech_businessCode
else return '-'
},
factorInfo() {
return this.factor[0]
}
},
methods: {
print(id) {
$(`#${id}`).print()
},
residual(item) {
return (
Number(item.ItemReceptionNQty) -
Number(item.SaleReturn) -
Number(item.Return_Damaged) -
Number(item.Return_Healthy) -
Number(item.Replacement) -
Number(item.Repair_Self) -
Number(item.Repair_Company)
)
},
sum(param) {
let sum = 0
let index = -1
for (const item of this.factor) {
index++
sum += Number(item[param])
if (index === this.factor.length - 1) return sum
}
},
residualSum() {
let sum = 0
let index = -1
for (const item of this.factor) {
index++
sum += Number(this.residual(item))
if (index === this.factor.length - 1) return sum
}
}
}
}
</script>
+191
View File
@@ -0,0 +1,191 @@
<template>
<user-dashboard-container page-class="guarantee" panel-title="لیست گارانتی">
<div class="filter mb-5">
<h4 style="display: inline-block; margin-left: 15px">مشاهده لیست:</h4>
<button class="switchBtns btn" :class="type === 'ttl' && 'btn-primary'" @click="type = 'ttl'">
ارسال شده ها
</button>
<button class="switchBtns btn" :class="type === 'atl' && 'btn-primary'" @click="type = 'atl'">
پذیرش شده ها
</button>
</div>
<div v-loading="fetching" class="tableBox">
<table class="qaurantee" :class="type === 'atl' && 'atl'">
<thead>
<tr>
<th class="index-atl">ردیف</th>
<th>شماره پذیرش موقت</th>
<th>تاریخ ارسال فرم</th>
<template v-if="type === 'atl'">
<th>شماره پذیرش دائم</th>
<th>تاریخ پذیرش</th>
<th>شماره بیجک</th>
<th>نظر سنجی</th>
</template>
<th class="brand">نوع</th>
<th>جزئیات</th>
</tr>
</thead>
<tbody>
<template v-if="filteredList.length">
<tr v-for="(item, index) in filteredList" :key="item._id">
<td class="index-atl">
<span>{{ index + 1 }}</span>
</td>
<td>
<span>{{ item.TempReceiptTransNumber }}</span>
</td>
<td>
<span>{{ $jDate(item.TempReceiptTransDate) }}</span>
</td>
<template v-if="type === 'atl'">
<td>
<span>{{ item.ItemReceptionTransNumber }}</span>
</td>
<td>
<span>{{ $jDate(item.ItemReceptionTransDate) }}</span>
</td>
<td>
<span>{{ item.deliveryCode || '-' }}</span>
</td>
<td>
<span v-if="checkSurveys(item.ItemReceptionTransNumber)" style="color: green">نظر ثبت شده</span>
<span v-else>
<nuxt-link
:to="{ name: 'account-survey', query: { code: item.ItemReceptionTransNumber } }"
style="color: #065495; cursor: pointer"
>
ثبت نظر
</nuxt-link>
</span>
</td>
</template>
<td class="brand">
<i
v-if="item.db_name === 'verity'"
class="fas fa-phone-laptop"
title="لوازم جانبی کامپیوتر و موبایل"
></i>
<i v-if="item.db_name === 'panatech'" class="fas fa-photo-video" title="لوازم صوتی و تصویری خودرو"></i>
</td>
<td>
<nuxt-link
:to="{
name: 'account-guarantee-view',
query: {
ttn: item.TempReceiptTransNumber,
atn: item.ItemReceptionTransNumber || undefined,
host: item.host,
db_name: item.db_name
}
}"
class="btn btn-primary"
>
مشاهده
</nuxt-link>
</td>
</tr>
</template>
<tr v-else>
<td class="noItem">
<span>هیچ اطلاعاتی وجود ندارد</span>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountGuaranteeList',
layout: 'user',
data() {
return {
verityTransactions: [],
panatechTransactions: [],
agentsTransactions: [],
surveys: [],
fetching: false
}
},
computed: {
type: {
get() {
return this.$route.query.type
},
set(val) {
this.$router.push({ name: 'account-guarantee', query: { type: val } })
}
},
totalItems() {
const totalArray = []
for (const item of this.verityTransactions) {
totalArray.push({ ...item, host: 'ar', db_name: 'verity' })
}
for (const item of this.panatechTransactions) {
totalArray.push({ ...item, host: 'ar', db_name: 'panatech' })
}
for (const item of this.agentsTransactions) {
totalArray.push({ ...item, host: 'as' })
}
return totalArray
},
filteredList() {
return this.totalItems
.filter(item => {
if (this.type === 'ttl') return !item.ItemReceptionTransNumber
else if (this.type === 'atl') return item.ItemReceptionTransNumber
return false
})
.reverse()
}
},
async mounted() {
try {
this.fetching = true
const user = this.$auth.user
const verityData = {
url: `/api/GetItemReceptionInfo?BusinessCode=${user.verity_businessCode}`,
db: 'verity'
}
const panatechData = {
url: `/api/GetItemReceptionInfo?BusinessCode=${user.panatech_businessCode}`,
db: 'panatech'
}
const allData = await Promise.all([
// fetch verityTransactions
this.$axios.post('/api/cross/getRouteManager', verityData),
// fetch panatechTransactions
this.$axios.post('/api/cross/getRouteManager', panatechData),
// fetch agentsTransactions
this.$axios.get('/api/user/transactions'),
// fetch all surveys
this.$axios.get('/api/user/surveys')
])
const verityTransactions = allData[0]
const panatechTransactions = allData[1]
const agentsTransactions = allData[2]
const surveys = allData[3]
this.verityTransactions = verityTransactions.data.data
this.panatechTransactions = panatechTransactions.data.data
this.agentsTransactions = agentsTransactions.data
this.surveys = surveys.data
this.fetching = false
} catch (e) {
this.$arpaError()
}
},
methods: {
checkSurveys(code) {
return this.surveys.find(item => item.code === code)
}
}
}
</script>
@@ -0,0 +1,202 @@
<template>
<user-dashboard-container page-class="factor" panel-title="فاکتور">
<div id="factor-layout">
<div class="pageHeader">
<div class="row1">
<h2>
<span>سیستم جاری</span>
<br />
<span>فاکتور تعمیرات</span>
</h2>
</div>
<div class="row2">
<p>
<span>شماره حواله: </span>
<span>{{ factorInfo.TransNumber }}</span>
</p>
<p>
<span>تاریخ حواله: </span>
<span>{{ $jDate(factorInfo.TransDate) }}</span>
</p>
</div>
</div>
<div class="factor">
<div class="factorInfo">
<div class="row1">
<p>
<span>کد شخص: </span>
<span>{{ userBusinessCode }}</span>
</p>
<p>
<span>طرف حساب: </span>
<span>{{ user.first_name + ' ' + user.last_name }}</span>
</p>
<p>
<span>شماره پذیرش: </span>
<span>{{ $route.query.atn }}</span>
</p>
</div>
<div class="row2">
<p>
<span>آدرس: </span>
<span>{{ factorInfo.cAddress1 }}</span>
</p>
</div>
<div class="row3">
<p>
<span>شماره تماس: </span>
<span>{{ factorInfo.cTel1 }}</span>
</p>
</div>
<div class="row4">
<p>
<span>شرح حواله: </span>
<span>{{ factorInfo.Description || '---' }}</span>
</p>
</div>
</div>
<div class="table">
<table>
<thead>
<tr>
<th>ردیف</th>
<th>کد کالا</th>
<th>نام کالا</th>
<th>تعداد کالا</th>
<th>مبلغ اجرت (ريال)</th>
<th>مبلغ کل (ريال)</th>
<th>معایب</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in factor" :key="index + '_tableItem_g_ar_f'">
<td>{{ index + 1 }}</td>
<td>{{ item.ItemCode }}</td>
<td>{{ item.ItemName }}</td>
<td>{{ item.Repair_Self }}</td>
<td>{{ item.TASPrice.toLocaleString() || '-' }}</td>
<td>{{ totalPrice(item).toLocaleString() }}</td>
<td>{{ item.Note || '-' }}</td>
</tr>
<!-- table footer -->
<tr>
<td colspan="3">جمع</td>
<td>{{ sum('Repair_Self') }}</td>
<!-- <td>{{ sum('TASPrice').toLocaleString() }}</td>-->
<td>-</td>
<td>{{ totalPriceSum().toLocaleString() }}</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<table-notice />
<button class="btn btn-primary mt-3" @click="print('factor-layout')">چاپ فاکتور</button>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountGuaranteePaymentFactor',
layout: 'user',
async asyncData({ $axios, $auth, query, error }) {
try {
const acceptedTN = query.atn
const host = query.host
const db_name = query.db_name
const user = $auth.user
function businessCode() {
if (db_name === 'verity') return user.verity_businessCode
else if (db_name === 'panatech') return user.panatech_businessCode
else return null
}
if (host === 'ar') {
const guaranteeFactorData = {
url: `/api/GetItemReceptionDetails?BusinessCode=${businessCode()}&ItemReceptionTransNumber=${acceptedTN}`,
db: db_name
}
const factorData = {
url: `/api/GetCustomizedRepairInfo?BusinessCode=${businessCode()}&TransNumber=${acceptedTN}`,
db: db_name
}
const allData = await Promise.all([
// fetch guaranteeFactor
$axios.post('/api/cross/getRouteManager', guaranteeFactorData),
// fetch factor
$axios.post('/api/cross/getRouteManager', factorData)
])
const guaranteeFactor = allData[0]
const factor = allData[1]
// validate data
if (guaranteeFactor.data.error || !guaranteeFactor.data.data.length) throw new Error('invalid params')
if (factor.data.error || !factor.data.data.length) throw new Error('invalid params')
return {
factor: factor.data.data,
guaranteeFactor: guaranteeFactor.data.data
}
} else if (host === 'as') {
/// functions go here
} else throw new Error('invalid params')
} catch (e) {
error({ status: 404, message: 'Page not found' })
}
},
data() {
return {
transactionItems: null,
factor: null,
guaranteeFactor: null
}
},
computed: {
user() {
return this.$auth.user
},
userBusinessCode() {
const db_name = this.$route.query.db_name
if (db_name === 'verity') return this.user.verity_businessCode
else if (db_name === 'panatech') return this.user.panatech_businessCode
else return '-'
},
factorInfo() {
return this.guaranteeFactor[0]
}
},
methods: {
print(id) {
$(`#${id}`).print()
},
totalPrice(item) {
return Number(item.TASPrice) * Number(item.Repair_Self)
},
sum(param) {
let sum = 0
let index = -1
for (const item of this.factor) {
index++
sum += Number(item[param])
if (index === this.factor.length - 1) return sum
}
},
totalPriceSum() {
let sum = 0
let index = -1
for (const item of this.factor) {
index++
sum += Number(this.totalPrice(item))
if (index === this.factor.length - 1) return sum
}
}
}
}
</script>
+252
View File
@@ -0,0 +1,252 @@
<template>
<user-dashboard-container page-class="post-receipt" panel-title="رسید ارسال برای گارانتی">
<div class="note">
<h2 class="mb-2">توجه:</h2>
<p>
*این رسید به منزله ی دریافت کالا توسط واحد خدمات پس از فروش نمیباشد و در صورت دریافت کالاهای مندرج در این رسید
توسط واحد پذیرش، رسید پذیرش قطعی صادر میگردد.
</p>
</div>
<div class="box-face-receipt">
<div class="receipt">
<div class="receipt-head">
<logo />
<p>بیجک چاپی</p>
</div>
<div class="title">
<p>برای ارسال این بیجک چاپی را روی بسته ارسال بچسبانید.</p>
</div>
<div id="box-face-receipt">
<div class="receipt-body">
<div class="senderInfo">
<div class="row">
<div class="col-12 col-lg-8 order-1 order-lg-0">
<h2>فرستنده:</h2>
<div class="infoRow">
<p>
نام و نام خانوادگی:
{{ user.first_name + ' ' + user.last_name }}
</p>
</div>
<div class="infoRow">
<p>آدرس: {{ transactionInfo.cAddress1 }}</p>
</div>
<div class="infoRow">
<p>شماره تماس: {{ transactionInfo.cTel1 }}</p>
</div>
</div>
<div class="col-12 col-lg-4 order-0 order-lg-1 d-flex justify-content-end flex-wrap align-items-start">
<div class="topLeft">
<b v-if="host === 'ar'">تاریخ صدور: {{ $jDate(transactionInfo.TransDate) }}</b>
<b v-if="host === 'as'">تاریخ صدور: {{ $jDate(transactionInfo.TempReceiptTransDate) }}</b>
</div>
<div class="topLeft">
<b>شماره پذیرش موقت: {{ $route.query.ttn }}</b>
</div>
</div>
</div>
</div>
<hr />
<div class="receiverInfo">
<div class="row">
<div class="col-12 col-lg-8 order-1 order-lg-0">
<h2>گیرنده:</h2>
<div class="infoRow">
<p>نام: {{ receiverInfo.name }}</p>
</div>
<div class="infoRow">
<p>آدرس: {{ receiverInfo.address }}</p>
</div>
<div class="infoRow">
<p>کدپستی: {{ receiverInfo.postalCode }}</p>
</div>
<div class="infoRow">
<p>شماره تماس: {{ receiverInfo.phone }}</p>
</div>
</div>
<div class="col-12 col-lg-4 order-0 order-lg-1 d-flex justify-content-end">
<div class="topLeft" :class="host">
<div>
<logo />
</div>
<dir v-if="host === 'ar'">
<img src="/assets/img/tipaxQR.jpg" alt="tipaxQR Code" />
<p>
<b>1111642</b>
</p>
</dir>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="print-btn">
<button class="btn btn-primary" @click="print('box-face-receipt')">چاپ</button>
</div>
</div>
<div class="box-inner-receipt">
<div class="receipt">
<div class="receipt-head">
<logo />
<p>فهرست اقلام پذیرش موقت شده</p>
</div>
<div class="title">
<p>این فرم را داخل بسته ارسالی برای گارانتی قرار دهید.</p>
</div>
<div id="box-inner-receipt">
<div class="receipt-body">
<div class="topBar row">
<div class="col-12 col-lg-6 logo-side">
<logo />
</div>
<div class="col-12 col-lg-6 d-flex justify-content-end align-items-center">
<div class="topLeft">
<b v-if="host === 'ar'">تاریخ صدور: {{ $jDate(transactionInfo.TransDate) }}</b>
<b v-if="host === 'as'">تاریخ صدور: {{ $jDate(transactionInfo.TempReceiptTransDate) }}</b>
</div>
<div class="topLeft">
<b>شماره پذیرش موقت: {{ $route.query.ttn }}</b>
</div>
</div>
</div>
<hr />
<div class="stuff-list">
<div class="tableBox">
<table>
<thead>
<tr>
<th>ردیف</th>
<th style="min-width: 250px">نام کالا</th>
<th style="">تعداد</th>
<th style="min-width: 150px">سریال گارانتی</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in items" :key="index + '_RecieptItem'">
<td>{{ index + 1 }}</td>
<td v-if="host === 'ar'">{{ item.ItemName }}</td>
<td v-if="host === 'as'">{{ getItemName(item.ItemID) || 'درحال بارگیری ...' }}</td>
<td v-if="host === 'ar'">{{ item.NQty }}</td>
<td v-if="host === 'as'">{{ item.MjQty }}</td>
<td>{{ item.SerialNo1 || '-' }}</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
</div>
</div>
</div>
</div>
<div class="print-btn">
<button class="btn btn-primary" @click="print('box-inner-receipt')">چاپ</button>
</div>
</div>
</user-dashboard-container>
</template>
<script>
if (process.client) require('static/assets/js/jQuery.print.min')
export default {
name: 'AccountGuaranteePostReciept',
layout: 'user',
async asyncData({ $axios, $auth, query, error }) {
try {
const tempTN = query?.ttn
const host = query?.host
const db_name = query?.db_name
const user = $auth.user
function businessCode() {
if (db_name === 'verity') return user.verity_businessCode
else if (db_name === 'panatech') return user.panatech_businessCode
else return null
}
if (host === 'ar') {
const transactionItemsData = {
url: `/api/GetTransactionDetails?BusinessCode=${businessCode()}&TransNumber=${tempTN}&DocAliasID=144&WithSerials=1`,
db: db_name
}
const transactionItems = await $axios.post('/api/cross/getRouteManager', transactionItemsData)
if (transactionItems.data.error || !transactionItems.data.data.length) throw new Error('invalid values')
return {
transactionItems: transactionItems.data.data
}
} else if (host === 'as') {
const transaction = await $axios.get(`/api/user/transaction/${tempTN}`)
return {
transaction: transaction.data
}
} else throw new Error('invalid values')
} catch (e) {
error({ status: 404, message: 'Page not found' })
}
},
data() {
return {
transactionItems: null,
transaction: null
}
},
computed: {
user() {
return this.$auth.user
},
receiverInfo() {
const host = this.host
const main = {
name: this.$config.recieverName,
address: this.$config.recieverAddress,
postalCode: this.$config.recieverPostalCode,
phone: this.$config.recieverPhone
}
if (host === 'ar') return main
else {
const agent = this.transaction.agent_id
return {
name: agent?.full_name + ' (نمایندگی ' + agent.city_name + ')',
address: agent?.province_name + '، ' + agent?.city_name + '، ' + agent?.address,
postalCode: agent?.postal_code,
phone: agent?.tel_number + ' - ' + agent?.mobile_number
}
}
},
products() {
if (this.$route.query.db_name === 'verity') return this.$store.state.front.verityProducts
else if (this.$route.query.db_name === 'panatech') return this.$store.state.front.panatechProducts
else return []
},
host() {
return this.$route.query?.host
},
items() {
if (this.host === 'ar') return this.transactionItems
else if (this.host === 'as') return this.transaction.items
else return []
},
transactionInfo() {
if (this.host === 'ar') return this.transactionItems[0]
else if (this.host === 'as') return this.transaction
else return {}
}
},
methods: {
getItemName(ItemID) {
return this.products.find(item => item.ItemID === ItemID)?.ItemName
},
print(id) {
$(`#${id}`).print()
}
}
}
</script>
+240
View File
@@ -0,0 +1,240 @@
<template>
<user-dashboard-container page-class="guarantee-details" panel-title="جزئیات">
<form action="" class="form form_3">
<div class="userInfo">
<div class="formRow">
<label v-if="$route.query.atn">کد پذیرش دائم:</label>
<label v-else>کد پذیرش موقت:</label>
<input type="text" disabled :value="$route.query.atn || $route.query.ttn" />
</div>
<div class="formRow">
<label>شماره تماس:</label>
<input type="text" disabled :value="transactionInfo.cTel1" />
</div>
<div class="formRow">
<label>تاریخ ارسال فرم:</label>
<input
type="text"
disabled
:value="$jDate(host === 'ar' ? transactionInfo.TransDate : transactionInfo.TempReceiptTransDate)"
/>
</div>
</div>
<div class="formRow">
<label>آدرس:</label>
<textarea name="" rows="3" disabled :value="transactionInfo.cAddress1"></textarea>
</div>
<div class="formRow">
<label>توضیحات فرم:</label>
<textarea name="" rows="3" disabled :value="transactionInfo.Description"></textarea>
</div>
</form>
<hr />
<div class="tableBox">
<table class="formItems">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="itemName">نام کالا</th>
<th class="quantity">تعداد</th>
<th class="itemSerial">سریال گارانتی</th>
<th class="date">تاریخ اتمام گارانتی</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in items" :key="index + '_guaranteeItemsList'" :title="item.ItemName">
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="itemName">
<span v-if="host === 'ar'" class="singleLineTxt">{{ item.ItemName }}</span>
<span v-if="host === 'as'" class="singleLineTxt">{{
getItemName(item.ItemID) || 'درحال بارگیری ...'
}}</span>
</td>
<td class="quantity">
<span v-if="host === 'ar'">{{ item.NQty }}</span>
<span v-if="host === 'as'">{{ item.MjQty }}</span>
</td>
<td class="itemSerial">
<span>{{ item.SerialNo1 || '-' }}</span>
</td>
<td class="date">
<span>{{ item.GEndDate || '-' }}</span>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
<hr />
<div class="buttons">
<nuxt-link
:to="{
name: 'account-guarantee-receipt',
query: { ttn: $route.query.ttn, host: host, db_name: $route.query.db_name }
}"
class="btn btn-primary"
>مشاهده رسید ها</nuxt-link
>
<nuxt-link
v-if="factor && factor.length"
:to="{
name: 'account-guarantee-factor',
query: { atn: $route.query.atn, host: host, db_name: $route.query.db_name }
}"
class="btn btn-primary"
style="margin-right: 5px"
>
مشاهده فاکتور
</nuxt-link>
</div>
<template v-if="paymentFactor && paymentFactor.length">
<hr />
<div class="paymentFactorBtn mb-5">
<strong
>*در موارد ارسالی شما کالا بدون گارانتی وجود دارد و تعمیرات شامل هزینه میشود.برای مشاهده فاکتور هزینه ها روی
دکمه زیر کلیک کنید و پس از پرداخت هزینه عکس فیش پرداختی را در تیکت برای ادمین بفرستید.(شماره پذیرش مربوطه را
در تیکت مشخص کنید)</strong
>
<nuxt-link
:to="{
name: 'account-guarantee-paymentFactor',
query: { atn: $route.query.atn, host: host, db_name: $route.query.db_name }
}"
class="btn btn-primary"
>مشاهده فاکتور تعمیرات
</nuxt-link>
</div>
</template>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountGuaranteeDetails',
layout: 'user',
async asyncData({ $axios, $auth, query, error }) {
try {
const tempTN = query?.ttn
const acceptedTN = query?.atn
const host = query?.host
const db_name = query?.db_name
const user = $auth.user
function businessCode() {
if (db_name === 'verity') return user.verity_businessCode
else if (db_name === 'panatech') return user.panatech_businessCode
else return null
}
if (host === 'ar') {
// fetch data from arpa
const transactionItemsData = {
url: `/api/GetTransactionDetails?BusinessCode=${businessCode()}&TransNumber=${
acceptedTN || tempTN
}&DocAliasID=${acceptedTN ? 63 : 144}&WithSerials=1`,
db: db_name
}
const transactionItems = await $axios.post('/api/cross/getRouteManager', transactionItemsData)
if (transactionItems.data.error || !transactionItems.data.data.length) throw new Error('invalid params')
return {
transactionItems: transactionItems.data.data
}
} else if (host === 'as') {
// fetch data from asan-service
const transaction = await $axios.get(`/api/user/transaction/${tempTN}`)
return {
transaction: transaction.data
}
} else throw new Error('invalid params')
} catch (e) {
error({ status: 404, message: 'Page not found' })
}
},
data() {
return {
transactionItems: null,
transaction: null,
factor: null,
paymentFactor: null
}
},
computed: {
products() {
if (this.$route.query.db_name === 'verity') return this.$store.state.front.verityProducts
else if (this.$route.query.db_name === 'panatech') return this.$store.state.front.panatechProducts
else return []
},
host() {
return this.$route.query?.host
},
items() {
if (this.host === 'ar') return this.transactionItems
else if (this.host === 'as') return this.transaction.items
else return []
},
transactionInfo() {
if (this.host === 'ar') return this.transactionItems[0]
else if (this.host === 'as') return this.transaction
else return {}
}
},
mounted() {
const host = this.host
const user = this.$auth.user
const db_name = this.$route.query?.db_name
const acceptedTN = this.$route.query?.atn
if (host === 'ar') {
// fetch data from arpa
const paymentData = {
url: `/api/GetCustomizedRepairInfo?BusinessCode=${
db_name === 'verity' ? user.verity_businessCode : db_name === 'panatech' ? user.panatech_businessCode : ''
}&TransNumber=${acceptedTN}`,
db: db_name
}
const factorData = {
url: `/api/GetItemReceptionDetails?BusinessCode=${
db_name === 'verity' ? user.verity_businessCode : db_name === 'panatech' ? user.panatech_businessCode : ''
}&ItemReceptionTransNumber=${acceptedTN}`,
db: db_name
}
if (acceptedTN) {
this.$axios
.post('/api/cross/getRouteManager', factorData)
.then(res => {
this.factor = res.data.data
})
.catch(err => {
console.log(err)
})
this.$axios
.post('/api/cross/getRouteManager', paymentData)
.then(res => {
this.paymentFactor = res.data.data
})
.catch(err => {
console.log(err)
})
}
} else if (host === 'as') {
// fetch data from asan-service
}
},
methods: {
getItemName(ItemID) {
return this.products.find(item => item.ItemID === ItemID)?.ItemName
}
}
}
</script>
+121
View File
@@ -0,0 +1,121 @@
<template>
<user-dashboard-container page-class="guarantee" panel-title="مانده معین مشتری">
<div v-loading="fetching" class="tableBox">
<table class="history">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="date">تاریخ برگه پذیرش</th>
<th class="transID">شناسه برگه پذیرش</th>
<th class="itemID">شناسه کالا</th>
<th class="itemCode">کد کالا</th>
<th class="itemName">نام کالا</th>
<th class="quantity">تعداد پذیرش</th>
<th class="repairCount">تعداد تعمیرات</th>
<th class="remainCount">مانده</th>
</tr>
</thead>
<tbody>
<template v-if="history.length">
<tr v-for="(item, index) in history" :key="item._id" :title="item.ItemName">
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="date">
<span>{{ $jDate(item.TransDate_63) }}</span>
</td>
<td class="transID">
<span>{{ item.TransactionID_63 }}</span>
</td>
<td class="itemID">
<span>{{ item.ItemID }}</span>
</td>
<td class="itemCode">
<span>{{ item.ItemCode }}</span>
</td>
<td class="itemName">
<span class="singleLineTxt">{{ item.ItemName }}</span>
</td>
<td class="quantity">
<span>{{ item.NQty_63 }}</span>
</td>
<td class="repairCount">
<span>{{ item.NQty_115 }}</span>
</td>
<td class="remainCount">
<span>{{ item.RemainQty }}</span>
</td>
</tr>
</template>
<tr v-else>
<td class="noItem">
<span>هیچ اطلاعاتی وجود ندارد</span>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountUserGuaranteeRemainHistory',
layout: 'user',
data() {
return {
verityHistory: [],
panatechHistory: [],
fetching: false
}
},
computed: {
history() {
return [...this.verityHistory, ...this.panatechHistory]
}
},
async mounted() {
try {
this.fetching = true
const user = this.$auth.user
const verityData = {
url: `/api/GetRemainingReceptionItems?FromBusinessCode=${user.verity_businessCode}&ToBusinessCode=${user.verity_businessCode}`,
db: 'verity'
// url: `/api/GetRemainingReceptionItems?ToBusinessCode=${user.arpa_businessCode}`
}
const panatechData = {
url: `/api/GetRemainingReceptionItems?FromBusinessCode=${user.panatech_businessCode}&ToBusinessCode=${user.panatech_businessCode}`,
db: 'panatech'
// url: `/api/GetRemainingReceptionItems?ToBusinessCode=${user.arpa_businessCode}`
}
const allData = await Promise.all([
// fetch verity data
this.$axios.post('/api/cross/getRouteManager', verityData),
// fetch panatech data
this.$axios.post('/api/cross/getRouteManager', panatechData)
])
const verityHistory = allData[0]
const panatechHistory = allData[1]
this.verityHistory = verityHistory.data.data
this.panatechHistory = panatechHistory.data.data
this.fetching = false
} catch (e) {
this.$arpaError()
}
}
}
</script>
+15
View File
@@ -0,0 +1,15 @@
<template>
<user-dashboard-container page-class="home" panel-title="پنل کاربری">
<h1>
<span> {{ $auth.user.first_name + ' ' + $auth.user.last_name }} </span>
<span>به پنل کاربری خوش آمدید.</span>
</h1>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountIndex',
layout: 'user'
}
</script>
+121
View File
@@ -0,0 +1,121 @@
<template>
<user-dashboard-container page-class="post" panel-title="ارسال برای گارانتی">
<div class="chooseDataBase">
<el-alert type="warning" class="mb-5">
کاربر گرامی توجه داشته باشید نمیتوانید لوازم جانبی کامپیوتر و لوازم صوتی تصویری رو همزمان باهم در یک فرم ارسال
کنید. لذا اگر از هر دو نوع محصول دارید دو فرم جداگانه برای هرکدام پر کنید.
</el-alert>
<h2>نوع محصول را انتخاب کنید:</h2>
<div class="brandsList">
<div class="brand" :class="db_name === 'verity' && 'selected'">
<button @click="db_name = 'verity'">
<i class="fas fa-phone-laptop"></i>
<span>لوازم جانبی کامپیوتر و موبایل</span>
</button>
</div>
<div class="brand" :class="db_name === 'panatech' && 'selected'">
<button @click="db_name = 'panatech'">
<i class="fas fa-photo-video"></i>
<span>لوازم صوتی و تصویری خودرو</span>
</button>
</div>
</div>
</div>
<form v-if="db_name !== ''" class="form form_3" @submit.prevent="postDraft">
<div class="userInfo">
<div class="formRow">
<label for="customer_name">نام مشتری</label>
<input id="customer_name" type="text" :value="user.first_name + ' ' + user.last_name" disabled />
</div>
<div class="formRow">
<label for="customer_code">کد مشتری</label>
<input id="customer_code" type="text" :value="businessCode" disabled />
</div>
<div class="formRow">
<label for="mobile">شماره موبایل</label>
<input id="mobile" type="text" :value="user.mobile_number" disabled />
</div>
</div>
<div class="formRow">
<label>آدرس</label>
<textarea name="description" cols="30" rows="5" disabled :value="userAddress"></textarea>
</div>
<hr />
<div class="formRow">
<label for="description">توضیحات فرم (اختیاری)</label>
<textarea
id="description"
v-model="description"
name="description"
placeholder="توضیحات راجع به کالاها را میتوانید اینجا بنویسید"
cols="30"
rows="10"
></textarea>
</div>
<div class="btnRow">
<button class="btn btn-primary postPageBtn">
<span>مرحله بعد افزودن کالا</span>
<i v-if="db_name === 'panatech'" class="fas fa-photo-video"></i>
<i v-if="db_name === 'verity'" class="fas fa-phone-laptop"></i>
</button>
</div>
</form>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountPost',
layout: 'user',
data() {
return {
db_name: '',
description: ''
}
},
computed: {
user() {
return this.$auth.user
},
userAddress() {
const user = this.user
return user.province_name + '، ' + user.city_name + '، ' + user.address + '،کد پستی: ' + user.postal_code
},
businessCode() {
const errMsg = 'عدم ثبت در پایگاه داده'
if (this.db_name === 'panatech') return this.user.panatech_businessCode || errMsg
if (this.db_name === 'verity') return this.user.verity_businessCode || errMsg
return errMsg
}
},
methods: {
postDraft() {
if (this.db_name === '') {
return this.$message({
type: 'warning',
message: 'برند محصول را انتخاب کنید'
})
}
const data = {
db_name: this.db_name,
description: this.description
}
this.$axios
.post('/api/user/transactionDraft', data)
.then(res => {
this.$router.push({ name: 'account-drafts-draftID', params: { draftID: res.data.draftId } })
})
.catch(() => {
this.$message({
type: 'error',
message: 'مشکلی در ثبت فرم پیش آمده'
})
})
}
}
}
</script>
+327
View File
@@ -0,0 +1,327 @@
<template>
<user-dashboard-container page-class="profile" panel-title="ویرایش پروفایل">
<div class="row">
<div class="col-12 col-lg-6">
<form class="form form_3" @submit.prevent="upload">
<div class="formRow" :class="validation.first_name ? 'err' : null">
<label for="verity_businessCode">کد مشتری (وریتی):</label>
<input
id="verity_businessCode"
type="text"
:value="user.verity_businessCode"
disabled
name="verity_businessCode"
placeholder="..."
/>
<p v-if="validation.verity_businessCode">{{ validation.verity_businessCode.msg }}</p>
</div>
<div class="formRow" :class="validation.first_name ? 'err' : null">
<label for="panatech_businessCode">کد مشتری (پاناتک):</label>
<input
id="panatech_businessCode"
type="text"
:value="user.panatech_businessCode"
disabled
name="panatech_businessCode"
placeholder="..."
/>
<p v-if="validation.panatech_businessCode">{{ validation.panatech_businessCode.msg }}</p>
</div>
<div class="formRow" :class="validation.first_name ? 'err' : null">
<label for="first_name">نام:</label>
<input id="first_name" v-model="user.first_name" type="text" name="first_name" placeholder="نام" />
<p v-if="validation.first_name">{{ validation.first_name.msg }}</p>
</div>
<div class="formRow" :class="validation.last_name ? 'err' : null">
<label for="last_name">نام خانوادگی:</label>
<input id="last_name" v-model="user.last_name" type="text" name="last_name" placeholder="نام خانوادگی" />
<p v-if="validation.last_name">{{ validation.last_name.msg }}</p>
</div>
<div class="formRow" :class="validation.national_code ? 'err' : null">
<label for="national_code">کد ملی:</label>
<input
id="national_code"
v-model="user.national_code"
type="text"
name="national_code"
placeholder="کد ملی"
/>
<p v-if="validation.national_code">{{ validation.national_code.msg }}</p>
</div>
<div class="formRow" :class="validation.mobile_number ? 'err' : null">
<label for="mobile">
<i>شماره موبایل:</i>
<span v-if="user.mobile_confirmed" class="cs confirmed">(تایید شده)</span>
<span v-else class="cs">(تایید نشده)</span>
</label>
<input id="mobile" v-model="user.mobile_number" type="text" name="mobile" placeholder="شماره موبایل" />
<p v-if="validation.mobile_number">{{ validation.mobile_number.msg }}</p>
</div>
<div class="formRow" :class="validation.email ? 'err' : null">
<label for="email">
<i>ایمیل:</i>
<span v-if="user.email_confirmed" class="cs confirmed">(تایید شده)</span>
<span v-else class="cs">(تایید نشده)</span>
</label>
<input id="email" v-model="user.email" type="text" name="email" placeholder="ایمیل" />
<p v-if="validation.email">{{ validation.email.msg }}</p>
</div>
<div class="formRow" :class="validation.tel_number ? 'err' : null">
<label for="tel_number">شماره تلفن ثابت:</label>
<input
id="tel_number"
v-model="user.tel_number"
type="text"
name="tel_number"
placeholder="شماره تلفن ثابت:"
/>
<p v-if="validation.tel_number">{{ validation.tel_number.msg }}</p>
</div>
<div class="formRow" :class="validation.province_id ? 'err' : null">
<label>استان:</label>
<el-select v-model="user.province_id" filterable placeholder="استان را انتخاب کنید" style="width: 100%">
<el-option
v-for="item in iranProvinces"
:key="item.ProvinceID"
:label="item.ProvinceName"
:value="item.ProvinceID"
>
</el-option>
</el-select>
<p v-if="validation.province_id">{{ validation.province_id.msg }}</p>
</div>
<div class="formRow" :class="validation.city_id ? 'err' : null">
<label>شهر:</label>
<el-select
v-model="user.city_id"
filterable
:placeholder="provinceCities ? 'شهر را انتخاب کنید' : 'ابتدا استان را انتخاب کنید'"
style="width: 100%"
>
<el-option v-for="item in provinceCities" :key="item.CityID" :label="item.CityName" :value="item.CityID">
</el-option>
</el-select>
<p v-if="validation.city_id">{{ validation.city_id.msg }}</p>
</div>
<div class="formRow" :class="validation.address ? 'err' : null">
<label for="address">آدرس:</label>
<textarea id="address" v-model="user.address" name="address" rows="5"></textarea>
<p v-if="validation.address">{{ validation.address.msg }}</p>
</div>
<div class="formRow" :class="validation.postal_code ? 'err' : null">
<label for="postal_code">کد پستی:</label>
<input id="postal_code" v-model="user.postal_code" type="text" name="postal_code" placeholder="کد پستی" />
<p v-if="validation.postal_code">{{ validation.postal_code.msg }}</p>
</div>
<div class="formRow" :class="validation.store_name ? 'err' : null">
<label for="store_name">نام فروشگاه (اختیاری):</label>
<input
id="store_name"
v-model="user.store_name"
type="text"
name="store_name"
placeholder="نام فروشگاه (اختیاری)"
/>
<p v-if="validation.store_name">{{ validation.store_name.msg }}</p>
</div>
<div class="btnRow">
<el-button
class="btn btn-primary custom-el-button"
type="primary"
native-type="submit"
:loading="postingProfile"
>
بروزرسانی
</el-button>
</div>
</form>
</div>
<div class="col-12 col-lg-6">
<form class="form form_3" style="margin-bottom: 50px" @submit.prevent="changePass">
<div class="formRow" :class="validation.password ? 'err' : null">
<label for="password">کلمه عبور:</label>
<input id="password" v-model="newPass.password" type="password" name="password" placeholder="کلمه عبور" />
<p v-if="validation.password">{{ validation.password.msg }}</p>
</div>
<div class="formRow" :class="validation.password_confirmation ? 'err' : null">
<label for="password_confirmation">تکرار کلمه عبور:</label>
<input
id="password_confirmation"
v-model="newPass.password_confirmation"
type="password"
name="password_confirmation"
placeholder="تکرار کلمه عبور"
/>
<p v-if="validation.password_confirmation">{{ validation.password_confirmation.msg }}</p>
</div>
<div class="btnRow">
<el-button
class="btn btn-primary custom-el-button"
type="primary"
native-type="submit"
:loading="postingPassword"
>
تغییر کلمه عبور
</el-button>
</div>
</form>
</div>
</div>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountEditProfile',
layout: 'user',
async asyncData({ $axios, $auth, error }) {
try {
const iranProvinces = await $axios.post('/api/cross/getRouteManager', {
url: '/api/GetProvince',
db: 'verity'
})
const iranCities = await $axios.post('/api/cross/getRouteManager', {
url: '/api/GetCity',
db: 'verity'
})
return {
iranCities: iranCities.data.data,
iranProvinces: iranProvinces.data.data
}
} catch (e) {
error({ status: 404, message: 'There is a problem here' })
}
},
data() {
return {
user: JSON.parse(JSON.stringify(this.$auth.user)),
iranCities: null,
iranProvinces: null,
newPass: {
password: '',
password_confirmation: ''
},
postingPassword: false,
postingProfile: false,
currentEmail: this.$auth.user.email,
currentMobile: this.$auth.user.mobile_number,
validation: {}
}
},
computed: {
selectedProvince() {
return this.user.province_id
},
selectedCity() {
return this.user.city_id
},
provinceCities() {
return this.iranCities?.filter(item => item.ProvinceID === this.user.province_id)
}
},
watch: {
selectedProvince(newVal, oldVal) {
// step 1
this.user.city_id = ''
// step 2
if (newVal)
this.user.province_name = this.iranProvinces?.filter(item => item.ProvinceID === newVal)[0].ProvinceName
else this.user.province_name = ''
},
selectedCity(newVal, oldVal) {
if (newVal) this.user.city_name = this.iranCities?.filter(item => item.CityID === newVal)[0].CityName
else this.user.city_name = ''
}
},
methods: {
upload() {
const newEmail = this.user.email !== this.currentEmail
const newMobile = this.user.mobile_number !== this.currentMobile
const uploadFunc = async () => {
try {
this.postingProfile = true
this.validation = {}
await this.$axios.put('/api/user/update_profile', this.user)
this.postingProfile = false
this.$auth.fetchUser()
this.$message({
type: 'success',
message: 'اطلاعات با موفقیت بروزرسانی شد'
})
if (newEmail || newMobile) this.$router.push({ name: 'account-verify' })
} catch (err) {
this.postingProfile = false
if (err.response.status === 422) this.validation = err.response.data.validation
else {
this.$message({
type: 'error',
message: err.response.data.message
})
}
}
}
if (newEmail || newMobile) {
const title = 'هشدار'
const msg = 'با تغییر شماره تلفن همراه یا آدرس ایمیل نیاز به تایید دوباره اطلاعات خود دارید.'
this.$confirm(msg, title, {
confirmButtonText: 'ادامه',
cancelButtonText: 'لغو',
type: 'warning'
})
.then(() => {
uploadFunc()
})
.catch(() => {
this.$message({
type: 'warning',
message: 'بروزرسانی پروفایل لغو شد'
})
})
} else uploadFunc()
},
changePass() {
this.postingPassword = true
this.validation = {}
const data = {
_id: this.user._id,
password: this.newPass.password,
password_confirmation: this.newPass.password_confirmation
}
this.$axios
.put('/api/user/update_password', data)
.then(res => {
this.$message({
type: 'success',
message: 'کلمه عبور با موفقیت بروزرسانی شد'
})
this.$auth.logout()
this.$router.push({ name: 'auth-login-register' })
this.postingPassword = false
})
.catch(err => {
this.postingPassword = false
if (err.response.status === 422) this.validation = err.response.data.validation
else {
this.$message({
type: 'error',
message: err.response.data.message
})
}
})
}
}
}
</script>
+104
View File
@@ -0,0 +1,104 @@
<template>
<user-dashboard-container page-class="survey" panel-title="نظر سنجی">
<form class="form form_3" @submit.prevent="post">
<div v-if="code" class="mb-5">
<h3>
شما درحال ثبت نظر برای فرم
<b style="color: #065495">{{ code }}</b>
هستید:
</h3>
</div>
<div v-for="item in surveyOptions" :key="item.fieldName" class="mb-5" style="width: 100%">
<div class="mb-3">
<label>{{ item.title }}</label>
</div>
<el-radio-group v-model="survey[item.fieldName]">
<el-radio-button
v-for="option in surveyOptionsValues.keys()"
:key="option + '_Option_' + item.fieldName"
:label="option"
>
{{ surveyOptionsValues.get(option) }}
</el-radio-button>
</el-radio-group>
</div>
<hr />
<div class="formRow">
<label for="description">نظرات ، پیشنهادات و انتقادات (اختیاری):</label>
<textarea
id="description"
v-model="survey.description"
name="description"
placeholder="نظرات ، پیشنهادات و انتقادات را میتوانید اینجا بنویسید"
cols="30"
rows="10"
></textarea>
</div>
<div class="formBtnRow">
<button class="btn btn-primary" type="submit" :disabled="disabledBtn">ثبت نظر</button>
</div>
</form>
</user-dashboard-container>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'AccountSurveyPage',
layout: 'user',
data() {
return {
survey: this.initForm()
}
},
computed: {
...mapGetters({
surveyOptions: 'front/surveyOptions',
surveyOptionsValues: 'front/surveyOptionsValues'
}),
code() {
return this.$route?.query?.code
},
disabledBtn() {
return (
!this.survey.purchasedProduct ||
!this.survey.guaranteeWorkFlow ||
!this.survey.employeeResponsibility ||
!this.survey.serviceQuality ||
!this.survey.serviceTime ||
!this.survey.repairQuality ||
!this.survey.coast
)
}
},
methods: {
initForm() {
const survey = {
purchasedProduct: 0,
guaranteeWorkFlow: 0,
employeeResponsibility: 0,
serviceQuality: 0,
serviceTime: 0,
repairQuality: 0,
coast: 0,
description: ''
}
return survey
},
post() {
if (this.disabledBtn) return
this.$axios.$post('/api/user/survey', { ...this.survey, code: this.code || '' }).then(res => {
this.$message.success('با تشکر از زمانی که گذاشتید، نظر شما ثبت شد.')
if (this.code) {
return this.$router.push({ name: 'account-guarantee', query: { type: 'atl' } })
}
this.survey = this.initForm()
})
}
}
}
</script>
+110
View File
@@ -0,0 +1,110 @@
<template>
<user-dashboard-container page-class="guarantee-details ticket-messenger" :panel-title="conversation.title">
<div class="messenger">
<h3 class="messenger-title">پیام ها:</h3>
<div class="messenger-body">
<div class="messages" :class="!conversation.messages.length ? 'no-msg' : null">
<!-- no-msg -->
<p v-if="!conversation.messages.length">هیچ پیامی وجود ندارد.</p>
<div
v-for="item in conversation.messages"
:key="item._id"
class="message user"
:class="[item.isUser ? 'user' : 'asan-admin', !item.read && !item.isUser ? 'unread' : null]"
>
<div class="txt">
<img v-if="item.image" :src="item.image" alt="" />
<p>{{ item.message }}</p>
<p class="date">{{ $jDateTime(item.created_at) }}</p>
</div>
<user-icon />
</div>
</div>
<div class="newMsg">
<div class="relativePos">
<input v-model="message" type="text" placeholder="پیام خود را بنویسید" />
<label for="file"></label>
<input id="file" ref="attachment" type="file" @change="preview" />
<img v-if="attachment" :src="attachment" alt="" />
<i v-if="attachment" id="clearFile" class="fas fa-times-circle" @click="clearFile"></i>
<button class="btn btn-primary" :disabled="!message && !attachment" @click="sendMessage">ارسال</button>
<div class="validationMsg">
<p v-if="validation.message">{{ validation.message.msg }}</p>
<p v-if="validation.image">{{ validation.image.msg }}</p>
</div>
</div>
</div>
</div>
</div>
</user-dashboard-container>
</template>
<script>
import axiosUploadProcess from '@/mixins/axiosUploadProcess'
export default {
name: 'AccountTicketDetails',
mixins: [axiosUploadProcess],
layout: 'user',
async asyncData({ $axios, params, error }) {
try {
const conversation = await $axios.get(`/api/user/getTicket/${params.ticket}`)
return {
conversation: conversation.data
}
} catch (e) {
error({ status: 404, message: 'Page not found' })
}
},
data() {
return {
conversation: null,
message: '',
attachment: '',
validation: {}
}
},
methods: {
preview(event) {
this.attachment = URL.createObjectURL(event.target.files[0])
},
clearFile() {
this.attachment = null
this.$refs.attachment.value = null
},
sendMessage() {
this.validation = {}
const data = new FormData()
data.append('message', this.message)
if (this.$refs.attachment.files[0]) data.append('image', this.$refs.attachment.files[0])
this.$axios
.post(`/api/user/addMessageToTicket/${this.conversation._id}`, data, this.axiosConfig)
.then(res => {
this.$message({
type: 'success',
message: 'پیام با موفقیت ارسال شد.'
})
this.attachment = ''
this.message = ''
this.$refs.attachment.value = null
this.conversation = res.data
setTimeout(() => {
window.scrollTo(0, document.body.scrollHeight)
}, 100)
})
.catch(err => {
if (err.response.data.status === 401) {
return this.$message({
type: 'warning',
message: 'لطفا دوباره وارد حساب خود شوید'
})
}
if (err.response.status === 422) this.validation = err.response.data.validation
else console.log(err)
})
}
}
}
</script>
+78
View File
@@ -0,0 +1,78 @@
<template>
<user-dashboard-container page-class="tickets" panel-title="لیست تیکت ها">
<div class="tableBox">
<table class="tickets">
<thead>
<tr>
<th class="index">ردیف</th>
<th class="title">عنوان</th>
<th class="transactionId">شماره پذیرش</th>
<th class="date">تاریخ ایجاد مکالمه</th>
<th class="details">جزئیات</th>
</tr>
</thead>
<tbody>
<template v-if="conversations.length">
<tr v-for="(item, index) in conversations" :key="item._id" :title="item.title">
<td class="index">
<span>{{ index + 1 }}</span>
</td>
<td class="title">
<span class="singleLineTxt">{{ item.title }}</span>
</td>
<td class="transactionId">
<span>{{ item.transaction_id ? item.transaction_id : '-' }}</span>
</td>
<td class="date">
<span>{{ $jDate(item.created_at) }}</span>
</td>
<td class="rowButtons details">
<nuxt-link
:to="{ name: 'account-tickets-ticket', params: { ticket: item._id } }"
class="btn btn-primary"
>
<span>مشاهده</span>
<i v-if="hasUnread(item._id)">{{ hasUnread(item._id) }}</i>
</nuxt-link>
</td>
</tr>
</template>
<tr v-else>
<td class="noItem">
<span>هیچ اطلاعاتی وجود ندارد</span>
</td>
</tr>
</tbody>
</table>
</div>
<table-notice />
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountTicketList',
layout: 'user',
async asyncData({ $axios, error }) {
try {
const conversations = await $axios.get('/api/user/ticketConversations')
return {
conversations: conversations.data
}
} catch (e) {
error({ status: 500, message: 'There is a problem here' })
}
},
data() {
return {
conversations: null
}
},
methods: {
hasUnread(id) {
const conversation = this.conversations.filter(item => item._id === id)[0]
return conversation.messages.filter(item => !item.read && !item.isUser).length
}
}
}
</script>
+204
View File
@@ -0,0 +1,204 @@
<template>
<user-dashboard-container page-class="verify" panel-title="تایید اطلاعات">
<el-alert
v-if="!user.confirmed"
title="ثبت نام شما هنوز نهایی نشده است. چنانچه تا 24 ساعت پس از زمان ثبت نام اولیه اطلاعات خود را تایید نکنید اطلاعات حساب شما از سیستم پاک خواهد شد."
class="mb-3"
type="warning"
>
</el-alert>
<el-alert
v-if="!user.email_confirmed"
title="کاربر گرامی چنانچه قادر به مشاهده کد تایید در صندوق ورودی ایمیل خود نیستید پوشه spam را چک کنید"
class="mb-3"
type="warning"
>
</el-alert>
<div class="row">
<div v-if="!user.mobile_confirmed" class="col-12 col-lg">
<form class="form form_3" style="margin-bottom: 50px" @submit.prevent="verify('mobile')">
<div class="formRow">
<label class="verify-labels" for="mobileConfirmationKey">
<b>شماره: </b>
<b>{{ user.mobile_number }}</b>
<span @click="showModal('mobile')">(تغییر شماره)</span>
<span v-if="mobileResendCountDown < 1" @click="resend('mobile')">(ارسال مجدد کد)</span>
<span v-else class="countdown">( ارسال مجدد کد {{ mobileResendCountDown }} ثانیه دیگر)</span>
</label>
<input
id="mobileConfirmationKey"
v-model="mobileConfirmationKey"
type="text"
name="mobileConfirmationKey"
placeholder="کد امنیتی پیامک شده"
/>
</div>
<div class="btnRow">
<el-button
class="btn btn-primary custom-el-button"
type="primary"
native-type="submit"
:loading="verifyingMobile"
:disabled="mobileConfirmationKey.length < 6"
>
تایید شماره
</el-button>
</div>
</form>
</div>
<div v-if="!user.email_confirmed" class="col-12 col-lg">
<form class="form form_3" style="margin-bottom: 50px" @submit.prevent="verify('email')">
<div class="formRow">
<label class="verify-labels" for="emailConfirmationKey">
<b>ایمیل: </b>
<b>{{ user.email }}</b>
<span @click="showModal('email')">(تغییر ایمیل)</span>
<span v-if="emailResendCountDown < 1" @click="resend('email')">(ارسال مجدد کد)</span>
<span v-else class="countdown">( ارسال مجدد کد {{ emailResendCountDown }} ثانیه دیگر)</span>
</label>
<input
id="emailConfirmationKey"
v-model="emailConfirmationKey"
type="text"
name="emailConfirmationKey"
placeholder="کد امنیتی ایمیل شده"
/>
</div>
<div class="btnRow">
<el-button
class="btn btn-primary custom-el-button"
type="primary"
native-type="submit"
:loading="verifyingEmail"
:disabled="emailConfirmationKey.length < 6"
>
تایید ایمیل
</el-button>
</div>
</form>
</div>
</div>
<template #body>
<ChangeEmailModal :key="modalKey" :show="modalVisible" :type="modalType" @closeModal="closeModal" />
</template>
</user-dashboard-container>
</template>
<script>
export default {
name: 'AccountVerify',
layout: 'user',
data() {
return {
emailConfirmationKey: '',
mobileConfirmationKey: '',
verifyingEmail: false,
verifyingMobile: false,
currentTime: Date.now(),
mobileResendTime: 0,
emailResendTime: 0,
modalKey: 0,
modalType: '',
modalVisible: false
}
},
computed: {
user() {
return this.$auth.user
},
emailResendCountDown() {
const timer = 59
const secondsPassed = Math.floor((this.currentTime - this.emailResendTime) / 1000)
const remainSeconds = timer - secondsPassed
if (remainSeconds > 0) return remainSeconds
else return 0
},
mobileResendCountDown() {
const timer = 59
const secondsPassed = Math.floor((this.currentTime - this.mobileResendTime) / 1000)
const remainSeconds = timer - secondsPassed
if (remainSeconds > 0) return remainSeconds
else return 0
}
},
mounted() {
// fetch countdown data from localstorga
this.mobileResendTime = +localStorage.getItem('mobileResendTime')
this.emailResendTime = +localStorage.getItem('emailResendTime')
// update current time
setInterval(() => (this.currentTime = Date.now()), 1000)
},
methods: {
showModal(type) {
this.modalType = type
this.modalVisible = true
},
closeModal() {
this.modalType = ''
this.modalVisible = false
this.modalKey = Math.random()
},
async verify(type) {
try {
let res
if (type === 'email') {
this.verifyingEmail = true
res = await this.$axios.put('/api/user/confirmEmail', { verificationKey: this.emailConfirmationKey })
this.verifyingEmail = false
}
if (type === 'mobile') {
this.verifyingMobile = true
res = await this.$axios.put('/api/user/confirmMobile', { verificationKey: this.mobileConfirmationKey })
this.verifyingMobile = false
}
this.$message({
type: 'success',
message: res.data.message
})
await this.$auth.fetchUser()
if (this.user.email_confirmed && this.user.mobile_confirmed) {
this.$router.push({ name: 'account' })
}
} catch (err) {
if (err.config.url === '/api/user/confirmEmail') this.verifyingEmail = false
if (err.config.url === '/api/user/confirmMobile') this.verifyingMobile = false
this.$message({
type: 'error',
message: err.response.data.message
})
}
},
async resend(type) {
try {
const thisTime = Date.now()
let res
if (type === 'email') {
this.emailResendTime = thisTime
localStorage.setItem('emailResendTime', thisTime)
res = await this.$axios.post('/api/user/resendEmailConfirmation')
}
if (type === 'mobile') {
this.mobileResendTime = thisTime
localStorage.setItem('mobileResendTime', thisTime)
res = await this.$axios.post('/api/user/resendMobileConfirmation')
}
this.$message({
type: 'success',
message: res.data.message
})
} catch (err) {
this.$message({
type: 'error',
message: 'مشکلی در ارسال مجدد کد تایید پیش آمده'
})
}
}
}
}
</script>